[clang-tools-extra] r371038 - [clangd][vscode] Add a flag to enable semantic highlighting in clangd

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 02:26:03 PDT 2019


Author: hokein
Date: Thu Sep  5 02:26:03 2019
New Revision: 371038

URL: http://llvm.org/viewvc/llvm-project?rev=371038&view=rev
Log:
[clangd][vscode] Add a flag to enable semantic highlighting in clangd

Reviewers: ilya-biryukov

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

Tags: #clang

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

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

Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json?rev=371038&r1=371037&r2=371038&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json (original)
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json Thu Sep  5 02:26:03 2019
@@ -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"
                 }
             }
         },

Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts?rev=371038&r1=371037&r2=371038&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts (original)
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts Thu Sep  5 02:26:03 2019
@@ -109,12 +109,14 @@ export function activate(context: vscode
 
   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(




More information about the cfe-commits mailing list