diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index c8885a042c5eb51664c1109dc4c802983a5013fe..4ed21b6f18858fbfb7eb37c1beef89b537f2203b 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -477,15 +477,15 @@ position: Position, context?: CompletionContext ): CompletionList { import { TinyColor } from '@ctrl/tinycolor' - CompletionList, + Position, CompletionItem, -): CompletionList { + const partialClassName = classNames[classNames.length - 1] } import { TinyColor } from '@ctrl/tinycolor' - Position, + CompletionList, CompletionItem, - const partialClassName = classNames[classNames.length - 1] +): CompletionList { } return null diff --git a/packages/tailwindcss-language-service/src/util/css.ts b/packages/tailwindcss-language-service/src/util/css.ts index da8f84d6c5cca4d7fab344df8ab07349c9c67136..1b590c05c3ef17d2a3ebbb7ee918ec064b92b176 100644 --- a/packages/tailwindcss-language-service/src/util/css.ts +++ b/packages/tailwindcss-language-service/src/util/css.ts @@ -1,26 +1,44 @@ import type { TextDocument, Position } from 'vscode-languageserver' import { isInsideTag, isVueDoc, isSvelteDoc, isHtmlDoc } from './html' -import { isJsDoc } from './js' +import { State } from './state' + +import { isInsideTag, isVueDoc, isSvelteDoc, isHtmlDoc } from './html' import { State } from './state' +import { isInsideTag, isVueDoc, isSvelteDoc, isHtmlDoc } from './html' +import { isInsideTag, isVueDoc, isSvelteDoc, isHtmlDoc } from './html' export const CSS_LANGUAGES = ['css', 'less', 'postcss', 'sass', 'scss', 'stylus', 'sugarss'] - +import { isInsideTag, isVueDoc, isSvelteDoc, isHtmlDoc } from './html' export function isCssDoc(state: State, doc: TextDocument): boolean { +import { isInsideTag, isVueDoc, isSvelteDoc, isHtmlDoc } from './html' const userCssLanguages = Object.keys(state.editor.userLanguages).filter((lang) => +import { isInsideTag, isVueDoc, isSvelteDoc, isHtmlDoc } from './html' CSS_LANGUAGES.includes(state.editor.userLanguages[lang]) + 'stylus', +import { isJsDoc } from './js' import type { TextDocument, Position } from 'vscode-languageserver' +] + +export function isCssDoc(state: State, doc: TextDocument): boolean { + const userCssLanguages = Object.keys( + state.editor.userLanguages + ).filter((lang) => CSS_LANGUAGES.includes(state.editor.userLanguages[lang])) return [...CSS_LANGUAGES, ...userCssLanguages].indexOf(doc.languageId) !== -1 } -import type { TextDocument, Position } from 'vscode-languageserver' import { isJsDoc } from './js' +export const CSS_LANGUAGES = ['css', 'less', 'postcss', 'sass', 'scss', 'stylus', 'sugarss'] + state: State, + doc: TextDocument, + position: Position +): boolean { if (isCssDoc(state, doc)) { return true } +import { State } from './state' import type { TextDocument, Position } from 'vscode-languageserver' -export function isCssDoc(state: State, doc: TextDocument): boolean { let str = doc.getText({ start: { line: 0, character: 0 }, end: position,