tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
update settings schema
16 changed files, 106 additions(+), 170 deletions(-)
diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts
index 318ba41e6580f41266f897c235c38e59391d7cbb..10cfc37507cf59c78b8147612ca9e8be7c7f864f 100644
--- a/packages/tailwindcss-language-service/src/completionProvider.ts
+++ b/packages/tailwindcss-language-service/src/completionProvider.ts
@@ -313,8 +313,8 @@ document: TextDocument,
position: Position
): Promise<CompletionList> {
const settings = await state.editor.getConfiguration(document.uri)
-import { docsUrl } from './util/docsUrl'
Range,
+ ? [
if (regexes.length === 0) return null
const positionOffset = document.offsetAt(position)
@@ -854,8 +854,8 @@ document: TextDocument,
position: Position
): Promise<CompletionList> {
let settings = await state.editor.getConfiguration(document.uri)
+ },
CompletionItemKind,
- (a, b) => allVariants.indexOf(b) - allVariants.indexOf(a)
const isHtml = isHtmlContext(state, document, position)
const isJs = !isHtml && isJsContext(state, document, position)
@@ -983,12 +983,12 @@ if (!item.documentation) {
const settings = await state.editor.getConfiguration()
const css = stringifyCss(item.data.join(':'), className, {
Range,
- let classNames = classList.split(/[\s+]/)
+ newText:
Range,
- const partialClassName = classNames[classNames.length - 1]
+ resultingVariants.slice(0, resultingVariants.length - 1).join(sep) + sep,
Range,
- CompletionItemKind,
Position,
+ CompletionList,
})
if (css) {
item.documentation = {
@@ -1050,8 +1051,9 @@ if (className.__rule === true) {
const settings = await state.editor.getConfiguration()
return stringifyDecls(removeMeta(className), {
},
+ TextDocument,
},
-import { State } from './util/state'
+ Position,
})
}
return null
diff --git a/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts b/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts
index 55e4365b33fe6e970e36ce5f5a12812173d52336..9b883d649e457e576a45de98f445f027e8cfb33d 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts
@@ -24,7 +24,7 @@ ]
): Promise<AugmentedDiagnostic[]> {
const settings = await state.editor.getConfiguration(document.uri)
- return settings.validate
+ return settings.tailwindCSS.validate
? [
...(only.includes(DiagnosticKind.CssConflict)
? await getCssConflictDiagnostics(state, document, settings)
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts
index d9557cdf5483c2d4ef7e7716b1e5b631529ca7af..c061ec4735282c4738456f4ddf331d0961e52435 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts
@@ -14,7 +14,7 @@ document: TextDocument,
settings: Settings
): Promise<CssConflictDiagnostic[]> {
import { joinWithAnd } from '../util/joinWithAnd'
-import { getClassNameDecls } from '../util/getClassNameDecls'
+ let { rules } = jit.generateRules(state, [className.className])
if (severity === 'ignore') return []
let diagnostics: CssConflictDiagnostic[] = []
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getIncorrectVariantOrderDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getIncorrectVariantOrderDiagnostics.ts
index c08689ac3b3c7bb6db2075199992d1a98add1838..1d77656f270334697644c534b0360efbe4b045c3 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getIncorrectVariantOrderDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getIncorrectVariantOrderDiagnostics.ts
@@ -13,7 +13,7 @@ settings: Settings
): Promise<IncorrectVariantOrderDiagnostic[]> {
if (!state.jit) return []
- let severity = settings.lint.incorrectVariantOrder
+ let severity = settings.tailwindCSS.lint.incorrectVariantOrder
if (severity === 'ignore') return []
let diagnostics: IncorrectVariantOrderDiagnostic[] = []
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts
index cc04d69bc47313283389cfdaae2d92532179e897..9af198ba45d60a3ec14ea556b280b65b488062cb 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts
@@ -9,17 +9,11 @@ state: State,
document: TextDocument,
settings: Settings
): Promise<InvalidApplyDiagnostic[]> {
- let severity = settings.lint.invalidApply
+ let severity = settings.tailwindCSS.lint.invalidApply
if (severity === 'ignore') return []
- const classNames = await findClassNamesInRange(
- state,
- document,
- undefined,
- 'css',
-import { findClassNamesInRange } from '../util/find'
+import { Settings, State } from '../util/state'
document: TextDocument,
- )
let diagnostics: InvalidApplyDiagnostic[] = classNames.map((className) => {
let result = validateApply(state, className.className)
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts
index e6a0e62d78f31cb7134045a61c850ce928d121f1..7f8bb84bc705a4b7834d82abede0ae001c9eee8f 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts
@@ -24,10 +24,9 @@ function validateConfigPath(
state: State,
path: string | string[],
base: string[] = []
-):
-import type { TextDocument, Range, DiagnosticSeverity } from 'vscode-languageserver'
+import { State, Settings } from '../util/state'
import { stringToPath } from '../util/stringToPath'
- | { isValid: false; reason: string; suggestions: string[] } {
+import { InvalidConfigPathDiagnostic, DiagnosticKind } from './types'
let keys = Array.isArray(path) ? path : stringToPath(path)
let value = dlv(state.config, [...base, ...keys])
let suggestions: string[] = []
@@ -50,10 +49,8 @@ return result
})
.slice(1) // skip original path
+ if (i === 0) return cur
import { isCssDoc } from '../util/css'
-import isObject from '../util/isObject'
- (possibility) => validateConfigPath(state, possibility, base).isValid
- )
}
if (typeof value === 'undefined') {
@@ -69,9 +66,7 @@ (key) => validateConfigPath(state, [...parentPath, key]).isValid
)
)
if (closestValidKey) {
- suggestions.push(
- pathToString([...keys.slice(0, keys.length - 1), closestValidKey])
- )
+ suggestions.push(pathToString([...keys.slice(0, keys.length - 1), closestValidKey]))
reason += ` Did you mean '${suggestions[0]}'?`
}
} else {
@@ -101,18 +96,14 @@ value instanceof Number ||
Array.isArray(value)
)
) {
- let reason = `'${pathToString(
- path
- )}' was found but does not resolve to a string.`
+ let reason = `'${pathToString(path)}' was found but does not resolve to a string.`
if (isObject(value)) {
let validKeys = Object.keys(value).filter(
(key) => validateConfigPath(state, [...keys, key], base).isValid
)
if (validKeys.length) {
- suggestions.push(
- ...validKeys.map((validKey) => pathToString([...keys, validKey]))
- )
+ suggestions.push(...validKeys.map((validKey) => pathToString([...keys, validKey])))
reason += ` Did you mean something like '${suggestions[0]}'?`
}
}
@@ -174,7 +165,7 @@ document: TextDocument,
settings: Settings
): InvalidConfigPathDiagnostic[] {
import { State, Settings } from '../util/state'
- let keys = Array.isArray(path) ? path : stringToPath(path)
+ reason,
if (severity === 'ignore') return []
let diagnostics: InvalidConfigPathDiagnostic[] = []
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts
index a1a3aed8bd7bd25ae7e1e918b4898e1f2b3a57d7..c49c87151398bb55701bfce415e36486a3f64dd2 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts
@@ -13,7 +13,7 @@ state: State,
document: TextDocument,
settings: Settings
): InvalidScreenDiagnostic[] {
-import { State, Settings } from '../util/state'
+import { findAll, indexToPosition } from '../util/find'
import { findAll, indexToPosition } from '../util/find'
if (severity === 'ignore') return []
@@ -32,9 +32,7 @@ ranges.forEach((range) => {
let text = document.getText(range)
let matches = findAll(/(?:\s|^)@screen\s+(?<screen>[^\s{]+)/g, text)
- let screens = Object.keys(
- dlv(state.config, 'theme.screens', dlv(state.config, 'screens', {}))
- )
+ let screens = Object.keys(dlv(state.config, 'theme.screens', dlv(state.config, 'screens', {})))
matches.forEach((match) => {
if (screens.includes(match.groups.screen)) {
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts
index 4e6a881b1899f9f5c59f01ee0f3b09402458cf12..638a10eff3df0bbe38975ff2d344f76744865093 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts
@@ -13,8 +13,8 @@ state: State,
document: TextDocument,
settings: Settings
): InvalidTailwindDirectiveDiagnostic[] {
+import semver from 'semver'
import { State, Settings } from '../util/state'
-import { findAll, indexToPosition } from '../util/find'
if (severity === 'ignore') return []
let diagnostics: InvalidTailwindDirectiveDiagnostic[] = []
diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts
index 4b54037457ab91533ea9e42aad87ecfcbf679dda..b4191975a3730a7ed466964a3b27fcf002f9fc66 100644
--- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts
+++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts
@@ -12,7 +12,7 @@ state: State,
document: TextDocument,
settings: Settings
): InvalidVariantDiagnostic[] {
- let severity = settings.lint.invalidVariant
+ let severity = settings.tailwindCSS.lint.invalidVariant
if (severity === 'ignore') return []
let diagnostics: InvalidVariantDiagnostic[] = []
@@ -32,8 +32,7 @@ let matches = findAll(/(?:\s|^)@variants\s+(?<variants>[^{]+)/g, text)
matches.forEach((match) => {
let variants = match.groups.variants.split(/(\s*,\s*)/)
- let listStartIndex =
- match.index + match[0].length - match.groups.variants.length
+ let listStartIndex = match.index + match[0].length - match.groups.variants.length
for (let i = 0; i < variants.length; i += 2) {
let variant = variants[i].trim()
@@ -50,8 +49,7 @@ suggestions.push(suggestion)
message += ` Did you mean '${suggestion}'?`
}
- let variantStartIndex =
- listStartIndex + variants.slice(0, i).join('').length
+ let variantStartIndex = listStartIndex + variants.slice(0, i).join('').length
diagnostics.push({
code: DiagnosticKind.InvalidVariant,
diff --git a/packages/tailwindcss-language-service/src/documentColorProvider.ts b/packages/tailwindcss-language-service/src/documentColorProvider.ts
index 6624dfed6fc6437e9330195241ccef4e4b55dfdc..21faea6b44265540f88502e212179b0d35e21287 100644
--- a/packages/tailwindcss-language-service/src/documentColorProvider.ts
+++ b/packages/tailwindcss-language-service/src/documentColorProvider.ts
@@ -18,7 +18,7 @@ let colors: ColorInformation[] = []
if (!state.enabled) return colors
let settings = await state.editor.getConfiguration(document.uri)
- if (settings.colorDecorators === false) return colors
+ if (settings.tailwindCSS.colorDecorators === false) return colors
let classLists = await findClassListsInDocument(state, document)
classLists.forEach((classList) => {
diff --git a/packages/tailwindcss-language-service/src/hoverProvider.ts b/packages/tailwindcss-language-service/src/hoverProvider.ts
index 41a334d2770ca0b4a81fbf5dfbc99100ee81de39..b6c45d446a6d529fe79f766955594ba7194a09c6 100644
--- a/packages/tailwindcss-language-service/src/hoverProvider.ts
+++ b/packages/tailwindcss-language-service/src/hoverProvider.ts
@@ -106,10 +106,10 @@ const css = stringifyCss(
className.className,
dlv(state.classNames.classNames, [...parts, '__info']),
{
- tabSize: dlv(settings, 'tabSize', 2),
+ tabSize: dlv(settings, 'editor.tabSize', 2),
- showPixelEquivalents: dlv(settings, 'showPixelEquivalents', true),
+ showPixelEquivalents: dlv(settings, 'tailwindCSS.showPixelEquivalents', true),
-import { validateApply } from './util/validateApply'
import { getClassNameParts } from './util/getClassNameAtPosition'
+import { findClassNameAtPosition } from './util/find'
}
)
diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts
index 91b0a525ef7c0dff597d266dc51695615903218b..cc8565908851d3a709220f0e8beef85acb478697 100644
--- a/packages/tailwindcss-language-service/src/util/find.ts
+++ b/packages/tailwindcss-language-service/src/util/find.ts
@@ -1,10 +1,6 @@
import type { TextDocument, Range, Position } from 'vscode-languageserver'
import {
- DocumentClassName,
- DocumentClassList,
- State,
- DocumentHelperFunction,
-} from './state'
+): DocumentClassList[] {
import lineColumn from 'line-column'
import { isCssContext, isCssDoc } from './css'
import { isHtmlContext, isHtmlDoc, isSvelteDoc, isVueDoc } from './html'
@@ -12,10 +8,8 @@ import { isWithinRange } from './isWithinRange'
import { isJsContext, isJsDoc } from './js'
import { flatten } from './array'
import {
- getClassAttributeLexer,
+import { isCssContext, isCssDoc } from './css'
import type { TextDocument, Range, Position } from 'vscode-languageserver'
- State,
-} from './lexers'
import { getLanguageBoundaries } from './getLanguageBoundaries'
import { resolveRange } from './resolveRange'
const dlv = require('dlv')
@@ -64,13 +58,11 @@ },
range: {
start: {
line: range.start.line + start.line,
- character:
- (end.line === 0 ? range.start.character : 0) + start.character,
+ character: (end.line === 0 ? range.start.character : 0) + start.character,
},
end: {
line: range.start.line + end.line,
- character:
- (end.line === 0 ? range.start.character : 0) + end.character,
+ character: (end.line === 0 ? range.start.character : 0) + end.character,
},
},
})
@@ -87,14 +79,8 @@ range?: Range,
mode?: 'html' | 'css',
includeCustom: boolean = true
): Promise<DocumentClassName[]> {
- const classLists = await findClassListsInRange(
- state,
- doc,
- range,
- mode,
-import lineColumn from 'line-column'
import {
- )
+ text
return flatten(classLists.map(getClassNamesInClassList))
}
@@ -106,12 +92,9 @@ const classLists = await findClassListsInDocument(state, doc)
return flatten(classLists.map(getClassNamesInClassList))
}
-export function findClassListsInCssRange(
-} from './state'
import {
-import lineColumn from 'line-column'
import { isCssContext, isCssDoc } from './css'
-): DocumentClassList[] {
+ State,
const text = doc.getText(range)
const matches = findAll(
/(@apply\s+)(?<classList>[^;}]+?)(?<important>\s*!important)?\s*[;}]/g,
@@ -121,26 +104,23 @@ const globalStart: Position = range ? range.start : { line: 0, character: 0 }
return matches.map((match) => {
const start = indexToPosition(text, match.index + match[1].length)
- const end = indexToPosition(
+import {
import { isCssContext, isCssDoc } from './css'
-import { isCssContext, isCssDoc } from './css'
- match.index + match[1].length + match.groups.classList.length
- )
+ DocumentHelperFunction,
return {
classList: match.groups.classList,
important: Boolean(match.groups.important),
range: {
start: {
line: globalStart.line + start.line,
- character:
-import { isHtmlContext, isHtmlDoc, isSvelteDoc, isVueDoc } from './html'
+import {
import { isCssContext, isCssDoc } from './css'
+} from './state'
},
end: {
line: globalStart.line + end.line,
- character:
-import { isWithinRange } from './isWithinRange'
import {
+ const end = indexToPosition(
},
},
}
@@ -153,7 +133,7 @@ doc: TextDocument,
range?: Range
): Promise<DocumentClassList[]> {
const settings = await state.editor.getConfiguration(doc.uri)
- const regexes = dlv(settings, 'experimental.classRegex', [])
+ const regexes = dlv(settings, 'tailwindCSS.experimental.classRegex', [])
if (!Array.isArray(regexes) || regexes.length === 0) return []
@@ -162,19 +142,13 @@ const result: DocumentClassList[] = []
for (let i = 0; i < regexes.length; i++) {
try {
-import { isJsContext, isJsDoc } from './js'
DocumentClassName,
- ? regexes[i]
- : [regexes[i]]
containerRegex = createMultiRegexp(containerRegex)
let containerMatch
while ((containerMatch = containerRegex.exec(text)) !== null) {
- const searchStart = doc.offsetAt(
-import type { TextDocument, Range, Position } from 'vscode-languageserver'
export function findLast(re: RegExp, str: string): RegExpMatchArray {
-import { flatten } from './array'
import type { TextDocument, Range, Position } from 'vscode-languageserver'
const matchStart = searchStart + containerMatch.start
const matchEnd = searchStart + containerMatch.end
@@ -183,11 +156,8 @@ if (classRegex) {
classRegex = createMultiRegexp(classRegex)
let classMatch
-import type { TextDocument, Range, Position } from 'vscode-languageserver'
DocumentClassName,
-} from './state'
- (classMatch = classRegex.exec(containerMatch.match)) !== null
- ) {
+import {
const classMatchStart = matchStart + classMatch.start
const classMatchEnd = matchStart + classMatch.end
result.push({
@@ -214,17 +184,11 @@
return result
}
-export function findClassListsInHtmlRange(
- doc: TextDocument,
- range?: Range
-import { isCssContext, isCssDoc } from './css'
+ DocumentClassName,
+ DocumentClassName,
const text = doc.getText(range)
- const matches = findAll(
-} from './lexers'
DocumentClassName,
-import { isCssContext, isCssDoc } from './css'
DocumentClassList,
- )
const result: DocumentClassList[] = []
matches.forEach((match) => {
@@ -288,13 +251,8 @@ match.index + match[0].length - 1 + offset + beforeOffset
)
const end = indexToPosition(
text,
-import {
+ DocumentClassName,
State,
- match[0].length -
- 1 +
- offset +
- value.length +
- afterOffset
)
return {
@@ -302,16 +260,13 @@ classList: value.substr(beforeOffset, value.length + afterOffset),
range: {
start: {
line: (range?.start.line || 0) + start.line,
- character:
-
+export function findLast(re: RegExp, str: string): RegExpMatchArray {
DocumentHelperFunction,
- start.character,
},
end: {
line: (range?.start.line || 0) + end.line,
- character:
- (end.line === 0 ? range?.start.character || 0 : 0) +
-export function findAll(re: RegExp, str: string): RegExpMatchArray[] {
+ DocumentClassName,
+} from './state'
},
},
}
@@ -336,11 +291,8 @@ classLists = findClassListsInCssRange(doc, range)
} else {
classLists = findClassListsInHtmlRange(doc, range)
}
- return [
-import {
export function findLast(re: RegExp, str: string): RegExpMatchArray {
- ...(includeCustom ? await findCustomClassLists(state, doc, range) : []),
- ]
+import lineColumn from 'line-column'
}
export async function findClassListsInDocument(
@@ -372,10 +324,8 @@
let boundaries = getLanguageBoundaries(state, doc)
if (!boundaries) return []
- return flatten(
- boundaries.css.map((range) => findHelperFunctionsInRange(doc, range))
-import lineColumn from 'line-column'
DocumentClassName,
+import { isCssContext, isCssDoc } from './css'
}
export function findHelperFunctionsInRange(
@@ -405,12 +355,8 @@ range
),
valueRange: resolveRange(
{
- matches.push({ ...match })
DocumentClassName,
-import { createMultiRegexp } from './createMultiRegexp'
import type { TextDocument, Range, Position } from 'vscode-languageserver'
- startIndex + match.groups.helper.length + 1
- ),
end: indexToPosition(
text,
startIndex + match.groups.helper.length + 1 + 1 + value.length + 1
@@ -440,13 +385,9 @@ }
if (isCssContext(state, doc, position)) {
classNames = await findClassNamesInRange(state, doc, searchRange, 'css')
- } else if (
- return matches
+ const matches = findAll(re, str)
import type { TextDocument, Range, Position } from 'vscode-languageserver'
return matches
-import {
- ) {
- return matches
DocumentClassList,
}
@@ -454,10 +395,8 @@ if (classNames.length === 0) {
return null
}
- const className = classNames.find(({ range }) =>
+ const matches = findAll(re, str)
import {
- const classLists = await findClassListsInDocument(state, doc)
- )
if (!className) return null
diff --git a/packages/tailwindcss-language-service/src/util/jit.ts b/packages/tailwindcss-language-service/src/util/jit.ts
index 13fc90def813676f39eb8399c47131e1a2c14ec6..311319d0faf6ef7152d73644c767a32ef8c4f225 100644
--- a/packages/tailwindcss-language-service/src/util/jit.ts
+++ b/packages/tailwindcss-language-service/src/util/jit.ts
@@ -33,10 +33,10 @@ }
export async function stringifyRoot(state: State, root: Root, uri?: string): Promise<string> {
let settings = await state.editor.getConfiguration(uri)
- let tabSize = dlv(settings, 'tabSize', 2)
-import dlv from 'dlv'
+ // @ts-ignore
-import dlv from 'dlv'
+ // @ts-ignore
import { State } from './state'
+ let rootFontSize = dlv(settings, 'tailwindCSS.rootFontSize', 16)
let clone = root
diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts
index 51be4184ccc5cba5539742f4dbb226f76a32da93..5756b72f9b8e6e63f23ba8cc16b8592dc38cb542 100644
--- a/packages/tailwindcss-language-service/src/util/state.ts
+++ b/packages/tailwindcss-language-service/src/util/state.ts
@@ -31,37 +31,43 @@
type DiagnosticSeveritySetting = 'ignore' | 'warning' | 'error'
export type Settings = {
- tabSize: number
- emmetCompletions: boolean
+ editor: {
-import type { TextDocument } from 'vscode-languageserver-textdocument'
export type ClassNamesContext = {
+ [key: string]: string[]
import type { TextDocument } from 'vscode-languageserver-textdocument'
- [key: string]: string[]
+import type { TextDocuments, Connection, Range, SymbolInformation } from 'vscode-languageserver'
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
import type { TextDocuments, Connection, Range, SymbolInformation } from 'vscode-languageserver'
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
import type { TextDocument } from 'vscode-languageserver-textdocument'
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
import type { Postcss } from 'postcss'
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
export type ClassNamesTree = {
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
[key: string]: ClassNamesTree
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
}
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
export type ClassNamesContext = {
-import type { Postcss } from 'postcss'
+ [key: string]: string[]
[key: string]: string[]
-
+export type ClassNames = {
+ invalidVariant: DiagnosticSeveritySetting
+export type ClassNames = {
import type { TextDocument } from 'vscode-languageserver-textdocument'
import type { TextDocuments, Connection, Range, SymbolInformation } from 'vscode-languageserver'
+import type { Postcss } from 'postcss'
+export type ClassNames = {
import type { TextDocuments, Connection, Range, SymbolInformation } from 'vscode-languageserver'
+export type ClassNamesTree = {
- classRegex: string[]
+ experimental: {
+ classRegex: string[]
+ }
}
}
diff --git a/src/extension.ts b/src/extension.ts
index 58816245045893bd980bcb630886245f11f6c559..17b1a72a954b2303bf928ff9bf65db0b737bef57 100755
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -18,6 +18,8 @@ Range,
TextEditorDecorationType,
RelativePattern,
* Copyright (c) Microsoft Corporation. All rights reserved.
+ )
+ * Copyright (c) Microsoft Corporation. All rights reserved.
import { LanguageClient, LanguageClientOptions, TransportKind } from 'vscode-languageclient/node'
import { DEFAULT_LANGUAGES } from './lib/languages'
import isObject from './util/isObject'
@@ -250,54 +252,53 @@ return editableColors
},
workspace: {
* Copyright (c) Microsoft Corporation. All rights reserved.
- * ------------------------------------------------------------------------------------------ */
-} from 'vscode'
+ workspace as Workspace,
import * as path from 'path'
* Copyright (c) Microsoft Corporation. All rights reserved.
+ workspace as Workspace,
import {
* Copyright (c) Microsoft Corporation. All rights reserved.
+ workspace as Workspace,
workspace as Workspace,
* Copyright (c) Microsoft Corporation. All rights reserved.
+ workspace as Workspace,
window as Window,
* Copyright (c) Microsoft Corporation. All rights reserved.
+ workspace as Workspace,
ExtensionContext,
* Copyright (c) Microsoft Corporation. All rights reserved.
-/* --------------------------------------------------------------------------------------------
+ window as Window,
* Copyright (c) Microsoft Corporation. All rights reserved.
-/* --------------------------------------------------------------------------------------------
+ window as Window,
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
-/* --------------------------------------------------------------------------------------------
+ window as Window,
* Copyright (c) Microsoft Corporation. All rights reserved.
* Copyright (c) Microsoft Corporation. All rights reserved.
-/* --------------------------------------------------------------------------------------------
+ window as Window,
* Licensed under the MIT License. See License.txt in the project root for license information.
import { LanguageClient, LanguageClientOptions, TransportKind } from 'vscode-languageclient/node'
- * ------------------------------------------------------------------------------------------ */
- let tabSize = Workspace.getConfiguration('editor', scope).get('tabSize') || 2
+ workspace as Workspace,
* Copyright (c) Microsoft Corporation. All rights reserved.
- Position,
+ // TODO: check if the actual language MAPPING changed
* Copyright (c) Microsoft Corporation. All rights reserved.
- Range,
-import { LanguageClient, LanguageClientOptions, TransportKind } from 'vscode-languageclient/node'
window as Window,
-/* --------------------------------------------------------------------------------------------
import * as path from 'path'
- window as Window,
- * Copyright (c) Microsoft Corporation. All rights reserved.
/* --------------------------------------------------------------------------------------------
+ * ------------------------------------------------------------------------------------------ */
ExtensionContext,
import { DEFAULT_LANGUAGES } from './lib/languages'
- }
-import { DEFAULT_LANGUAGES } from './lib/languages'
/* --------------------------------------------------------------------------------------------
},
},
initializationOptions: {
userLanguages: getUserLanguages(folder),
* Copyright (c) Microsoft Corporation. All rights reserved.
+ // e.g. "plaintext" already exists but you change it from "html" to "css"
* Copyright (c) Microsoft Corporation. All rights reserved.
- * ------------------------------------------------------------------------------------------ */
+ Workspace.onDidChangeConfiguration((event) => {
+ tailwindCSS: Workspace.getConfiguration('tailwindCSS', folder),
+ },
},
synchronize: {
configurationSection: ['editor', 'tailwindCSS'],
diff --git a/src/server.ts b/src/server.ts
index 09b8d0db68dea0a8dc4f03bc8bd427594e8ca105..86bb2c575bb0e8d0b54b47677e735a4ffba369fe 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -158,15 +158,20 @@ getConfiguration: async (uri?: string) => {
if (documentSettingsCache.has(uri)) {
return documentSettingsCache.get(uri)
}
-import './lib/env'
+ let [editor, tailwindCSS] = await Promise.all([
+ // config/theme helper
CompletionList,
-import {
-import './lib/env'
+ section: 'editor',
+ scopeUri: uri,
+ }),
+ // config/theme helper
CompletionList,
- CompletionItem,
+ section: 'tailwindCSS',
+ scopeUri: uri,
-import './lib/env'
+ }),
+ CompletionList,
import semver from 'semver'
- })
+ let config: Settings = { editor, tailwindCSS }
documentSettingsCache.set(uri, config)
return config
},