[lldb-vscode] Use `expression` command for completion
authorDave Lee <davelee.com@gmail.com>
Mon, 6 Mar 2023 23:06:25 +0000 (15:06 -0800)
committerDave Lee <davelee.com@gmail.com>
Tue, 7 Mar 2023 19:13:25 +0000 (11:13 -0800)
Change lldb-vscode to use the `expression` command for generating completions, instead
of the `p` alias.

Aliases are user overrideable, and even deletable, but the `expression` command is
unchangeable.

See D141539 where a similar replacement was done to tests.

Differential Revision: https://reviews.llvm.org/D145437

lldb/tools/lldb-vscode/lldb-vscode.cpp

index b70f5b0..51a72f2 100644 (file)
@@ -1065,8 +1065,9 @@ void request_completions(const llvm::json::Object &request) {
     text = text.substr(1);
     actual_column--;
   } else {
-    text = "p " + text;
-    actual_column += 2;
+    char command[] = "expression -- ";
+    text = command + text;
+    actual_column += strlen(command);
   }
   lldb::SBStringList matches;
   lldb::SBStringList descriptions;