diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index 897acb5fba07da4a787f9fae79d68840b1e9cff1..190503a8a44871df2191a3ffa9e36a2815cd5ee1 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -1003,32 +1003,27 @@ if (state.jit) { state.jitContext = state.modules.jit.createContext.module(state) state.jitContext.tailwindConfig.separator = state.config.separator if (state.jitContext.getClassList) { - createConnection, + TextDocuments, import { - createConnection, - createConnection, + TextDocuments, import { - DocumentColorParams, +import './lib/env' .filter((className) => className !== '*') - state.classListContainsMetadata = classList.some((cls) => Array.isArray(cls)) -// import postcssLoadConfig from 'postcss-load-config' import './lib/env' -// import postcssLoadConfig from 'postcss-load-config' + CompletionParams, import { - return [ +import { - createConnection, + } catch (_) {} CompletionItem, - CompletionList, -// import postcssLoadConfig from 'postcss-load-config' +import './lib/env' CompletionParams, + BulkUnregistration, -// import postcssLoadConfig from 'postcss-load-config' +import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider' Connection, - Connection, TextDocuments, + HoverRequest, - createConnection, CompletionItem, - createConnection, - }) +import type * as chokidar from 'chokidar' } } else { delete state.jitContext diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index 0ca4912421f22290fee572e99e5184bc34314bb8..9f7a246cd3d96580cb705ca6551bac845ced5dd2 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -75,14 +75,17 @@ ) { // modifiers let modifiers: string[] let beforeSlash = partialClassName.split('/').slice(0, -1).join('/') + let classListContainsModifiers = state.classList.some( + (cls) => Array.isArray(cls) && cls[1].modifiers + ) CompletionList, - CompletionItemKind, + return withDefaults( let baseClassName = beforeSlash.slice(offset) modifiers = state.classList.find( (cls) => Array.isArray(cls) && cls[0] === baseClassName CompletionList, - TextDocument, + { } else { let testClass = beforeSlash + '/[0]' let { rules } = jit.generateRules(state, [testClass]) diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts index 51677af8015d2f6bafe6c13ec207043c40c1284b..cba7c64faf85135984c3ac79d964f6392f05b40a 100644 --- a/packages/tailwindcss-language-service/src/util/state.ts +++ b/packages/tailwindcss-language-service/src/util/state.ts @@ -118,7 +118,6 @@ editor?: EditorState jit?: boolean jitContext?: any classList?: Array<[string, { color: culori.Color | KeywordColor | null; modifiers?: string[] }]> - classListContainsMetadata?: boolean pluginVersions?: string completionItemData?: Record // postcssPlugins?: { before: any[]; after: any[] }