[PATCH] D67096: [clangd][vscode] Add a flag to enable semantic highlighting in clangd

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 02:18:51 PDT 2019


hokein updated this revision to Diff 218864.
hokein marked 2 inline comments as done.
hokein added a comment.

rebase and simplify the code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67096/new/

https://reviews.llvm.org/D67096

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


Index: clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts
===================================================================
--- clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts
@@ -109,12 +109,14 @@
 
   const clangdClient = new ClangdLanguageClient('Clang Language Server',
                                                 serverOptions, clientOptions);
-  const semanticHighlightingFeature =
+  if (getConfig<boolean>('semanticHighlighting')) {
+    const semanticHighlightingFeature =
       new semanticHighlighting.SemanticHighlightingFeature(clangdClient,
-                                                           context);
-  context.subscriptions.push(
+        context);
+    context.subscriptions.push(
       vscode.Disposable.from(semanticHighlightingFeature));
-  clangdClient.registerFeature(semanticHighlightingFeature);
+    clangdClient.registerFeature(semanticHighlightingFeature);
+  }
   console.log('Clang Language Server is now active!');
   context.subscriptions.push(clangdClient.start());
   context.subscriptions.push(vscode.commands.registerCommand(
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===================================================================
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -89,6 +89,11 @@
                 "clangd.trace": {
                     "type": "string",
                     "description": "Names a file that clangd should log a performance trace to, in chrome trace-viewer JSON format."
+                },
+                "clangd.semanticHighlighting": {
+                    "type": "boolean",
+                    "default": "false",
+                    "description": "Enable semantic highlighting in clangd"
                 }
             }
         },


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67096.218864.patch
Type: text/x-patch
Size: 1941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190905/fc4973cf/attachment.bin>


More information about the cfe-commits mailing list