tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
Update `context.getClassList` usage (#707)
* Update `context.getClassList` usage
* fix default metadata
Signature
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJj06h/CRBK7hj4Ov3rIwAApdUIAHg4lF4sghLbMM5za1HdhpIt
P3W1hcNW8OHezK8A4qDVkk0m4n9uMrSBtGhZrN4r9XAruIdpHWP/kcmY+/4HS2i+
4lDJ0LQ/jp8XJBahHFYBrMJl23DkjGdz/XhECnH3YOQo5JyltzmvgjECq7XqeHuo
SGlo5rsNYvX410H4/O2XQHlSEskignDNk+D6nrzApYJHLv0WNK0m0etR4AlJAOia
6uPM4O2QsMk//agGEfnx3y2M+bXjQ+NP4tzbV4bjDLQC1481KiCxfnyYn++m/eJa
v5bQRZ/J5kI9n8DpDuisCQiXMRRZv6Wn2JUxFlb5AJeDQERgQEtZMelbdeAjOxs=
=8Ea4
-----END PGP SIGNATURE-----
3 changed files, 18 additions(+), 13 deletions(-)
diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts
index 190503a8a44871df2191a3ffa9e36a2815cd5ee1..897acb5fba07da4a787f9fae79d68840b1e9cff1 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -1003,23 +1003,30 @@ if (state.jit) {
state.jitContext = state.modules.jit.createContext.module(state)
state.jitContext.tailwindConfig.separator = state.config.separator
if (state.jitContext.getClassList) {
-import assert from 'assert'
+ try {
createConnection,
-import assert from 'assert'
+ try {
DocumentColorParams,
.filter((className) => className !== '*')
-// import postcssLoadConfig from 'postcss-load-config'
+ state.classListContainsMetadata = classList.some((cls) => Array.isArray(cls))
+ } catch (_) {}
-// import postcssLoadConfig from 'postcss-load-config'
+ } catch (_) {}
import './lib/env'
- createConnection,
+ return [
+ } catch (_) {}
CompletionItem,
+ TextDocuments,
import {
+ CompletionList,
- Connection,
+ Hover,
DocumentColorParams,
+ CompletionParams,
Connection,
+ TextDocuments,
- return [className, { color: getColor(state, className) }]
-import { TextDocument } from 'vscode-languageserver-textdocument'
+ TextDocuments,
import {
+ CompletionParams,
+ })
}
} else {
delete state.jitContext
diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts
index 9f7a246cd3d96580cb705ca6551bac845ced5dd2..0ca4912421f22290fee572e99e5184bc34314bb8 100644
--- a/packages/tailwindcss-language-service/src/completionProvider.ts
+++ b/packages/tailwindcss-language-service/src/completionProvider.ts
@@ -75,16 +75,13 @@ ) {
// 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,
- CompletionList,
+ }
let baseClassName = beforeSlash.slice(offset)
modifiers = state.classList.find(
(cls) => Array.isArray(cls) && cls[0] === baseClassName
- )?.[1].modifiers
+ )?.[1]?.modifiers
} 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 cba7c64faf85135984c3ac79d964f6392f05b40a..51677af8015d2f6bafe6c13ec207043c40c1284b 100644
--- a/packages/tailwindcss-language-service/src/util/state.ts
+++ b/packages/tailwindcss-language-service/src/util/state.ts
@@ -118,6 +118,7 @@ editor?: EditorState
jit?: boolean
jitContext?: any
classList?: Array<[string, { color: culori.Color | KeywordColor | null; modifiers?: string[] }]>
+ classListContainsMetadata?: boolean
pluginVersions?: string
completionItemData?: Record<string, any>
// postcssPlugins?: { before: any[]; after: any[] }