[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
Tue Sep 3 06:40:28 PDT 2019
hokein created this revision.
hokein added a reviewer: ilya-biryukov.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
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
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
Index: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===================================================================
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -58,6 +58,10 @@
highlighter: Highlighter;
// Any disposables that should be cleaned up when clangd crashes.
private subscriptions: vscode.Disposable[] = [];
+ // Whether the semantic highlighting feature is enabled in the extension.
+ private enable: boolean;
+
+ constructor(enable: boolean) { this.enable = enable; }
fillClientCapabilities(capabilities: vscodelc.ClientCapabilities) {
// Extend the ClientCapabilities type and add semantic highlighting
// capability to the object.
@@ -65,7 +69,7 @@
{semanticHighlightingCapabilities?: {semanticHighlighting : boolean}} =
capabilities.textDocument;
textDocumentCapabilities.semanticHighlightingCapabilities = {
- semanticHighlighting : true,
+ semanticHighlighting : this.enable,
};
}
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
@@ -110,7 +110,8 @@
const clangdClient = new ClangdLanguageClient('Clang Language Server',
serverOptions, clientOptions);
const semanticHighlightingFeature =
- new semanticHighlighting.SemanticHighlightingFeature();
+ new semanticHighlighting.SemanticHighlightingFeature(
+ getConfig<boolean>('semanticHighlighting'));
context.subscriptions.push(
vscode.Disposable.from(semanticHighlightingFeature));
clangdClient.registerFeature(semanticHighlightingFeature);
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.218445.patch
Type: text/x-patch
Size: 2705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190903/11a50973/attachment.bin>
More information about the cfe-commits
mailing list