[clangd] Add activate command to the vscode extension.
authorHaojian Wu <hokein@google.com>
Wed, 27 Mar 2019 15:41:59 +0000 (15:41 +0000)
committerHaojian Wu <hokein@google.com>
Wed, 27 Mar 2019 15:41:59 +0000 (15:41 +0000)
Summary:
This would help minizime the annoying part of not activating the extension
for .cu file.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 357075

clang-tools-extra/clangd/clients/clangd-vscode/package.json
clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts

index f9ac922..b9e42e0 100644 (file)
@@ -24,7 +24,8 @@
         "onLanguage:c",
         "onLanguage:cpp",
         "onLanguage:objective-c",
-        "onLanguage:objective-cpp"
+        "onLanguage:objective-cpp",
+        "onCommand:clangd-vscode.activate"
     ],
     "main": "./out/src/extension",
     "scripts": {
             {
                 "command": "clangd-vscode.switchheadersource",
                 "title": "Switch between Source/Header"
+            },
+            {
+                "command": "clangd-vscode.activate",
+                "title": "Manually activate clangd extension"
             }
         ],
         "keybindings": [
index e02bb79..e34f26a 100644 (file)
@@ -139,4 +139,8 @@ export function activate(context: vscode.ExtensionContext) {
                 status.clear();
             }
         })
+    // An empty place holder for the activate command, otherwise we'll get an
+    // "command is not registered" error.
+    context.subscriptions.push(vscode.commands.registerCommand(
+            'clangd-vscode.activate', async () => {}));
 }