jvikstrom updated this revision to Diff 217785.
jvikstrom marked an inline comment as done.
jvikstrom added a comment.

Use `conf.affectsConfiguration('workbench.colorTheme')` instead of keeping 
track of the old color theme manually.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66406

Files:
  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
@@ -91,6 +91,13 @@
     // 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(


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
@@ -91,6 +91,13 @@
     // 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(
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to