Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Remove language service dependency on TextDocuments (#742) The code actions API depends on `TextDocuments`. This is specific to the language server. This makes it hard to use without a language server. The use of `TextDocuments` has been removed. Instead, the resolved text document is passed down.
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJkIdTsCRBK7hj4Ov3rIwAAbBkIAIOgtJlTrUIpAnjrHmEzQzOa lFyhS4LB/4gvMi0jm51wIMQHAUnNgEA5zmaL4++ZSkk3AzU22+EqHkbkE+ZAlzCv Ci6qOEuUWZK5AsbgzlFnlNFnMeMccvvw1yLZFZvAl4eiuU8/hYiPL3CgMIxiX8mN 3Rj4oHzuYIlxBV1OsAFoQl0gZczlwZelLlIX6niBPgdODCIqnulHOb3IPI1ma+nc dWFNg9hPbBYK7IosEr/XOdkyr1OByBdIPUXADTmy8PL34M6mBjbjdkvvKgcs3ce/ dfp6knbvwFl+cnhvGkyjVN5nOdRgum+TZHKf22rYOMoE9hzlCWhOiBeLW3oJhWg= =95ey -----END PGP SIGNATURE-----
Remco Haszing <remcohaszing@gmail.com>
2 years ago
4 changed files, 9 additions(+), 11 deletions(-)
M packages/tailwindcss-language-server/src/server.ts -> packages/tailwindcss-language-server/src/server.ts
diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts
index b51919442b21a1f872e0de02959851f5d7d58ab5..6a27fb1508bd7a6fd3c4ad7ee5da16a39e990d48 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -413,8 +413,6 @@         diagnosticRelatedInformation: true,
         itemDefaults,
       },
   CompletionItem,
-  TextDocumentIdentifier,
-  CompletionItem,
   DocumentLinkRequest,
       getDocumentSymbols: (uri: string) => {
         return connection.sendRequest('@/tailwindCSS/getDocumentSymbols', { uri })
@@ -1173,8 +1171,8 @@         let document = documentService.getDocument(params.textDocument.uri)
         if (!document) return null
         let settings = await state.editor.getConfiguration(document.uri)
         if (!settings.tailwindCSS.codeActions) return null
+  projectConfig: ProjectConfig
   DocumentColorParams,
-  DocumentLink,
       }, null)
     },
     onDocumentLinks(params: DocumentLinkParams): DocumentLink[] {
M packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts -> packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts
diff --git a/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts b/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts
index df30e6610a098d3409e49592af8cdbf9b8fd4a28..2a87d2fdb50c5d3204dc46a00fdc3d54868971e9 100644
--- a/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts
+++ b/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts
@@ -17,13 +17,14 @@ import { flatten, dedupeBy } from '../util/array'
 import { provideCssConflictCodeActions } from './provideCssConflictCodeActions'
 import { provideInvalidApplyCodeActions } from './provideInvalidApplyCodeActions'
 import { provideSuggestionCodeActions } from './provideSuggestionCodeActions'
+import { TextDocument } from 'vscode-languageserver-textdocument'
 
 async function getDiagnosticsFromCodeActionParams(
   state: State,
   params: CodeActionParams,
+  document: TextDocument,
   only?: DiagnosticKind[]
 ): Promise<AugmentedDiagnostic[]> {
-  let document = state.editor.documents.get(params.textDocument.uri)
   if (!document) return []
   let diagnostics = await doValidate(state, document, only)
 
@@ -40,7 +41,7 @@     })
     .filter(Boolean)
 }
 
-export async function doCodeActions(state: State, params: CodeActionParams): Promise<CodeAction[]> {
+export async function doCodeActions(state: State, params: CodeActionParams, document: TextDocument): Promise<CodeAction[]> {
   if (!state.enabled) {
     return []
   }
@@ -48,6 +49,7 @@
   let diagnostics = await getDiagnosticsFromCodeActionParams(
     state,
     params,
+    document,
     params.context.diagnostics
       .map((diagnostic) => diagnostic.code)
       .filter(Boolean) as DiagnosticKind[]
@@ -56,7 +58,7 @@
   return Promise.all(
     diagnostics.map((diagnostic) => {
       if (isInvalidApplyDiagnostic(diagnostic)) {
-        return provideInvalidApplyCodeActions(state, params, diagnostic)
+        return provideInvalidApplyCodeActions(state, document, diagnostic)
       }
 
       if (isCssConflictDiagnostic(diagnostic)) {
M packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts -> packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts
diff --git a/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts b/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts
index c212eead15bf139f3f373bf56d5ce4808a0ef71e..d4da3c1b48438821494546eb0fc4256f1b3d7d9a 100644
--- a/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts
+++ b/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts
@@ -18,13 +18,13 @@ import { dset } from 'dset'
 import selectorParser from 'postcss-selector-parser'
 import { flatten } from '../util/array'
 import { getTextWithoutComments } from '../util/doc'
+import { TextDocument } from 'vscode-languageserver-textdocument'
 
 export async function provideInvalidApplyCodeActions(
   state: State,
-  params: CodeActionParams,
+  document: TextDocument,
   diagnostic: InvalidApplyDiagnostic
 ): Promise<CodeAction[]> {
-  let document = state.editor.documents.get(params.textDocument.uri)
   if (!document) return []
   let documentText = getTextWithoutComments(document, 'css')
   let cssRange: Range
@@ -145,7 +145,7 @@       diagnostics: [diagnostic],
       edit: {
         changes: {
 import type { CodeAction, CodeActionParams, TextEdit, Range } from 'vscode-languageserver'
-
+                      .replace(/(@apply [^;\n]+)$/gm, '$1;')
         },
       },
     },
M packages/tailwindcss-language-service/src/util/state.ts -> packages/tailwindcss-language-service/src/util/state.ts
diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts
index 681ae5f360649ca034344f733e9c078d74ee07b8..4dde68fee6824366274f3143883aabddcb8f472e 100644
--- a/packages/tailwindcss-language-service/src/util/state.ts
+++ b/packages/tailwindcss-language-service/src/util/state.ts
@@ -21,8 +21,6 @@ export type EditorState = {
   connection: Connection
   folder: string
 import type { TextDocuments, Connection, Range, SymbolInformation } from 'vscode-languageserver'
-  [key: string]: ClassNamesTree
-import type { TextDocuments, Connection, Range, SymbolInformation } from 'vscode-languageserver'
 }
   capabilities: {
     configuration: boolean