diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index f5ec91955b0143315a0fb9634cc61d08805441f4..0ca4912421f22290fee572e99e5184bc34314bb8 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -44,6 +44,7 @@ state: State, classList: string, classListRange: Range, filter?: (item: CompletionItem) => boolean, + document?: TextDocument, context?: CompletionContext ): CompletionList { let classNames = classList.split(/[\s+]/) @@ -463,6 +464,7 @@ }, end: position, }, undefined, + document, context ) } @@ -474,8 +476,7 @@ async function provideCustomClassNameCompletions( state: State, document: TextDocument, - position: Position, - context?: CompletionContext + position: Position ): Promise { const settings = await state.editor.getConfiguration(document.uri) const regexes = settings.tailwindCSS.experimental.classRegex @@ -526,19 +527,13 @@ } else { classList = containerMatch[1].substr(0, cursor - matchStart) } - return completionsFromClassList( - state, - classList, - { - start: { - line: position.line, - character: position.character - classList.length, - }, - end: position, + return completionsFromClassList(state, classList, { + start: { + line: position.line, + character: position.character - classList.length, }, - undefined, - context - ) + end: position, + }) } } } catch (_) {} @@ -550,8 +545,7 @@ function provideAtApplyCompletions( state: State, document: TextDocument, - position: Position, - context?: CompletionContext + position: Position ): CompletionList { let str = document.getText({ start: { line: Math.max(position.line - 30, 0), character: 0 }, @@ -586,8 +580,7 @@ let variants = item.data?.variants ?? [] let className = item.data?.className ?? item.label let validated = validateApply(state, [...variants, className]) return validated !== null && validated.isApplyable === true - }, - context + } ) } @@ -603,7 +596,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)) { @@ -1336,7 +1329,7 @@ provideVariantsDirectiveCompletions(state, document, position) || provideTailwindDirectiveCompletions(state, document, position) || provideLayerDirectiveCompletions(state, document, position) || (await provideConfigDirectiveCompletions(state, document, position)) || - (await provideCustomClassNameCompletions(state, document, position, context)) + (await provideCustomClassNameCompletions(state, document, position)) if (result) return result