[clang-tools-extra] r370305 - [clangd] Update themeRuleMatcher when color theme changes in vscode extension.

Johan Vikstrom via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 01:40:17 PDT 2019


Author: jvikstrom
Date: Thu Aug 29 01:40:17 2019
New Revision: 370305

URL: http://llvm.org/viewvc/llvm-project?rev=370305&view=rev
Log:
[clangd] Update themeRuleMatcher when color theme changes in vscode extension.

Summary:
Add event listener that listens to configuration changes and reloads the ThemeRuleMatcher when the theme changes.

Right now it will not recolor the files, depends on the colorizer CL for that.

Reviewers: hokein, ilya-biryukov

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

Tags: #clang

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

Modified:
    clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/semantic-highlighting.ts

Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/semantic-highlighting.ts?rev=370305&r1=370304&r2=370305&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/semantic-highlighting.ts (original)
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/semantic-highlighting.ts Thu Aug 29 01:40:17 2019
@@ -91,6 +91,13 @@ export class SemanticHighlightingFeature
     // highlighter being created.
     this.highlighter = new Highlighter(this.scopeLookupTable);
     this.subscriptions.push(vscode.Disposable.from(this.highlighter));
+    // Adds a listener to reload the theme when it changes.
+    this.subscriptions.push(
+        vscode.workspace.onDidChangeConfiguration((conf) => {
+          if (!conf.affectsConfiguration('workbench.colorTheme'))
+            return;
+          this.loadCurrentTheme();
+        }));
     this.loadCurrentTheme();
     // Event handling for handling with TextDocuments/Editors lifetimes.
     this.subscriptions.push(vscode.window.onDidChangeVisibleTextEditors(




More information about the cfe-commits mailing list