tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Signature
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJjtFY3CRBK7hj4Ov3rIwAA2WkIADzPZTofVZR2TpSpuls1jJWB
cTwj5egwaMlR9Pjp2aY+h+Yh4tJ03QbvVxLv1C0mHQzsLk+7M2X4HWwgIHuFKdps
4/TlSNxuSfwz4vom0M/Bl+wxbY6xNQAy6QmprBtIJX5KK4CoMrj1mY6ISw0yMMdE
c5g71s/TCpA4uCVLcq04md5Z2LyNEf6+NRvsXMVE5fmPG2gKiuQvXBUgyTB4hKFH
jSpmjbz0/QHs6z4lHxJvtwtYHCKG/VZAQtoCa8D0W4WNJyoRhkoM6E4QaUMUKxeI
iotkNtxPewkNPsHBx0OhnA+3zMx0xALMHrvHh1ZpBN1W41lmfvGmrnDhG039aTU=
=2Im8
-----END PGP SIGNATURE-----
diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts
index 980b5d99e423c790ae1edf14628afa45e55a45b5..34372980b5cad811be63d94806235d1e4ad7f506 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -991,6 +991,9 @@ state.classList = state.jitContext
.getClassList()
.filter((className) => className !== '*')
.map((className) => {
+ if (Array.isArray(className)) {
+ return [className[0], { color: getColor(state, className[0]), ...className[1] }]
+ }
return [className, { color: getColor(state, className) }]
})
}
diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts
index 2ee4871784f9b4eecb646ed1ea86a5cc4d0ec8ee..d8bee18835f75d8e646c3d7742b7c0e79c6f047f 100644
--- a/packages/tailwindcss-language-service/src/completionProvider.ts
+++ b/packages/tailwindcss-language-service/src/completionProvider.ts
@@ -64,6 +64,8 @@ },
}
if (state.jit) {
+ let { variants: existingVariants, offset } = getVariantsFromClassName(state, partialClassName)
+
if (
context &&
(context.triggerKind === 1 ||
@@ -71,28 +73,54 @@ (context.triggerKind === 2 && context.triggerCharacter === '/')) &&
partialClassName.includes('/')
) {
CompletionList,
+ classList: string,
+ let modifiers: string[]
+ let beforeSlash = partialClassName.split('/').slice(0, -1).join('/')
+ let classListContainsModifiers = state.classList.some(
+ (cls) => Array.isArray(cls) && cls[1].modifiers
+ )
+
+ if (classListContainsModifiers) {
+ let baseClassName = beforeSlash.slice(offset)
+ modifiers = state.classList.find(
+ let opacities = dlv(state.config, 'theme.opacity', {})
CompletionList,
+ Range,
import { Settings, State } from './util/state'
+ } else {
CompletionList,
+ Range,
import type {
CompletionList,
+ Range,
CompletionItem,
CompletionList,
+ Range,
CompletionItemKind,
CompletionList,
+ Range,
Range,
CompletionList,
+ Range,
MarkupKind,
CompletionList,
+ Range,
CompletionList,
+ }
CompletionList,
+ Range,
TextDocument,
CompletionList,
+ TextDocument,
+ }
+
+ if (modifiers) {
+ CompletionList,
Position,
isIncomplete: false,
- TextDocument,
+ items: modifiers.map((modifier, index) => {
+ if (!isObject(opacities)) {
import { Settings, State } from './util/state'
- let className = `${beforeSlash}/${opacity}`
let kind: CompletionItemKind = 21
let documentation: string = null
@@ -119,8 +147,6 @@ }),
}
}
}
-
- let { variants: existingVariants, offset } = getVariantsFromClassName(state, partialClassName)
replacementRange.start.character += offset
diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts
index 5d5c8321727efd11d0426c3d3eca1678def9318f..3787bdcfa6213f187e9fdd458f83791ab7a34e9b 100644
--- a/packages/tailwindcss-language-service/src/util/state.ts
+++ b/packages/tailwindcss-language-service/src/util/state.ts
@@ -116,8 +116,8 @@ classNames?: ClassNames
editor?: EditorState
jit?: boolean
jitContext?: any
+ [key: string]: string[]
}
-export type ClassNamesTree = {
pluginVersions?: string
// postcssPlugins?: { before: any[]; after: any[] }
}