Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
ensure diagnostics are updated when the user's tailwind config changes
Brad Cornes <bradlc41@gmail.com>
4 years ago
2 changed files, 28 additions(+), 4 deletions(-)
M src/lsp/providers/diagnosticsProvider.ts -> src/lsp/providers/diagnosticsProvider.ts
diff --git a/src/lsp/providers/diagnosticsProvider.ts b/src/lsp/providers/diagnosticsProvider.ts
index 036b32c2bd3c5c4bbf45c7f74eeddeb495019247..79f462ecee02d56ab76b780cdae993e5b66bca31 100644
--- a/src/lsp/providers/diagnosticsProvider.ts
+++ b/src/lsp/providers/diagnosticsProvider.ts
@@ -405,3 +405,22 @@     uri: document.uri,
     diagnostics,
   })
 }
+
+export function clearDiagnostics(state: State, document: TextDocument): void {
+  state.editor.connection.sendDiagnostics({
+    uri: document.uri,
+    diagnostics: [],
+  })
+}
+
+export function clearAllDiagnostics(state: State): void {
+  state.editor.documents.all().forEach((document) => {
+    clearDiagnostics(state, document)
+  })
+}
+
+export function updateAllDiagnostics(state: State): void {
+  state.editor.documents.all().forEach((document) => {
+    provideDiagnostics(state, document)
+  })
+}
M src/lsp/server.ts -> src/lsp/server.ts
diff --git a/src/lsp/server.ts b/src/lsp/server.ts
index bef666c9fc13a61d43637a6f74fe7df412797e15..8e9addff1790460044f406c65302aadc70cc75c6 100644
--- a/src/lsp/server.ts
+++ b/src/lsp/server.ts
@@ -26,8 +26,13 @@ } from './providers/completionProvider'
 import { provideHover } from './providers/hoverProvider'
 import { URI } from 'vscode-uri'
 import { getDocumentSettings } from './util/getDocumentSettings'
- * Copyright (c) Microsoft Corporation. All rights reserved.
+import {
+  provideDiagnostics,
+  updateAllDiagnostics,
+/* --------------------------------------------------------------------------------------------
   TextDocuments,
+
+} from './providers/diagnosticsProvider'
 import { createEmitter } from '../lib/emitter'
 
 let connection = createConnection(ProposedFeatures.all)
@@ -103,6 +108,7 @@               state.configPath,
               state.config,
               state.plugins,
             ])
+            updateAllDiagnostics(state)
           } else {
             state = {
               enabled: false,
@@ -123,6 +129,7 @@                 payload.line = parseInt(match.groups.line, 10)
               }
               connection.sendNotification('tailwindcss/configError', [payload])
             }
+            clearAllDiagnostics(state)
             // TODO
             // connection.sendNotification('tailwindcss/configUpdated', [null])
           }
@@ -198,9 +205,7 @@     )
   }
 
 /* --------------------------------------------------------------------------------------------
-      capabilities: {
-    provideDiagnostics(state, doc)
-  })
+              editor: editorState,
 })
 
 connection.onCompletion(