You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[lldb-dap] Correct auto-completion based on ReplMode and escape char (#110784)
This commit improves the auto-completion in the Debug Console provided
by VS-Code.
So far, we were always suggesting completions for both LLDB commands and
for variables / expressions, even if the heuristic already determined
how the given string will be executed, e.g., because the user explicitly
typed the escape prefix. Furthermore, auto-completion after the escape
character was broken, since the offsets were not adjusted correctly.
With this commit we now correctly take this into account.
Even with this commit, auto-completion does not always work reliably:
* VS Code only requests auto-completion after typing the first
alphabetic character, but not after punctuation characters. This means
that no completions are provided after typing "`"
* LLDB does not provide autocompletions if a string is an exact match.
This means if a user types `l` (which is a valid command), LLDB will not
provide "language" and "log" as potential completions. Even worse, VS
Code caches the completion and does client-side filtering. Hence, even
after typing `la`, no auto-completion for "language" is shown in the UI.
Those issues might be fixed in follow-up commits. Also with those known
issues, the experience is already much better with this commit.
Furthermore, I updated the README since I noticed that it was slightly
inaccurate.
"label": "settings -- Commands for managing LLDB settings.",
19
+
}
20
+
memory_completion= {
21
+
"text": "memory",
22
+
"label": "memory -- Commands for operating on memory in the current target process.",
23
+
}
24
+
command_var_completion= {
25
+
"text": "var",
26
+
"label": "var -- Show variables for the current stack frame. Defaults to all arguments and local variables in scope. Names of argument, local, file static and file global variables can be specified.",
27
+
}
28
+
variable_var_completion= {
29
+
"text": "var",
30
+
"label": "var -- vector<baz> &",
31
+
}
32
+
variable_var1_completion= {"text": "var1", "label": "var1 -- int &"}
33
+
variable_var2_completion= {"text": "var2", "label": "var2 -- int &"}
Tests completion requests for lldb commands, within "repl-mode=command"
57
+
"""
58
+
self.setup_debugee()
35
59
self.continue_to_next_stop()
36
60
37
-
# shouldn't see variables inside main
61
+
res=self.dap_server.request_evaluate(
62
+
"`lldb-dap repl-mode command", context="repl"
63
+
)
64
+
self.assertTrue(res["success"])
65
+
66
+
# Provides completion for top-level commands
38
67
self.verify_completions(
39
-
self.dap_server.get_completions("var"),
68
+
self.dap_server.get_completions("se"),
69
+
[session_completion, settings_completion],
70
+
)
71
+
72
+
# Provides completions for sub-commands
73
+
self.verify_completions(
74
+
self.dap_server.get_completions("memory "),
40
75
[
41
76
{
42
-
"text": "var",
43
-
"label": "var -- vector<baz> &",
77
+
"text": "read",
78
+
"label": "read -- Read from the memory of the current target process.",
44
79
},
45
80
{
46
-
"text": "var",
47
-
"label": "var -- Show variables for the current stack frame. Defaults to all arguments and local variables in scope. Names of argument, local, file static and file global variables can be specified.",
81
+
"text": "region",
82
+
"label": "region -- Get information on the memory region containing an address in the current target process.",
48
83
},
49
84
],
50
-
[
51
-
{"text": "var1", "label": "var1 -- int &"},
52
-
],
53
85
)
54
86
55
-
# should see global keywords but not variables inside main
87
+
# Provides completions for parameter values of commands
0 commit comments