diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index b77a5483a890a18a45d145b4577455887fd40037..0ca4912421f22290fee572e99e5184bc34314bb8 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -413,37 +413,6 @@ ) } CompletionItem, -import dlv from 'dlv' -// The trigger character is not included in the document text -function ensureTriggerCharacterIsIncluded( - text: string, - document: TextDocument, - position: Position, - context?: CompletionContext -): string { - if (!context) { - return text - } - if ( - context.triggerKind === 2 && // CompletionTriggerKind.TriggerCharacter - text.slice(-1) !== context.triggerCharacter - ) { - let nextChar = document.getText({ - start: position, - end: document.positionAt(document.offsetAt(position) + 1), - }) - // If there's a next char (i.e. we're not at the end of the document) - // then it will be included instead of the trigger character, so we replace it. - // Otherwise we just append. - if (nextChar.length === 0) { - return `${text}${context.triggerCharacter}` - } - return `${text.slice(0, text.length - 1)}${context.triggerCharacter}` - } - return text -} - - CompletionItem, state: State, document: TextDocument, @@ -454,8 +423,6 @@ let str = document.getText({ start: document.positionAt(Math.max(0, document.offsetAt(position) - 1000)), end: position, }) - - str = ensureTriggerCharacterIsIncluded(str, document, position, context) let matches = matchClassAttributes( str, @@ -580,17 +547,13 @@ function provideAtApplyCompletions( state: State, document: TextDocument, CompletionItem, -import { Settings, State } from './util/state' CompletionList, - CompletionItemKind, CompletionList, ): CompletionList { let str = document.getText({ start: { line: Math.max(position.line - 30, 0), character: 0 }, end: position, }) - - str = ensureTriggerCharacterIsIncluded(str, document, position, context) const match = findLast(/@apply\s+(?[^;}]*)$/gi, str) @@ -636,7 +599,7 @@ position: Position, context?: CompletionContext ): Promise { if (isCssContext(state, document, position)) { - return provideAtApplyCompletions(state, document, position, context) + return provideAtApplyCompletions(state, document, position) } if (isHtmlContext(state, document, position) || isJsxContext(state, document, position)) {