Skip to content

Commit ce98ac2

Browse files
committed
Cleanup
1 parent 4424796 commit ce98ac2

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

packages/tailwindcss-language-service/src/completionProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { TextDocument } from 'vscode-languageserver-textdocument'
1313
import dlv from 'dlv'
1414
import removeMeta from './util/removeMeta'
1515
import { formatColor, getColor, getColorFromValue } from './util/color'
16-
import { isHtmlContext, isHtmlDoc, isVueDoc } from './util/html'
16+
import { isHtmlContext, isHtmlDoc } from './util/html'
1717
import { isCssContext } from './util/css'
1818
import { findLast, matchClassAttributes, matchClassFunctions } from './util/find'
1919
import { stringifyConfigValue, stringifyCss } from './util/stringify'

packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,15 @@ export function getLanguageBoundaries(
157157

158158
let isJs = isJsDoc(state, doc)
159159

160-
let defaultType = isVueDoc(doc)
161-
? 'none'
162-
: isHtmlDoc(state, doc) || isSvelteDoc(doc)
163-
? 'html'
164-
: isJs
165-
? 'jsx'
166-
: null
160+
let defaultType: string | null = null
161+
162+
if (isVueDoc(doc)) {
163+
defaultType = 'none'
164+
} else if (isHtmlDoc(state, doc) || isSvelteDoc(doc)) {
165+
defaultType = 'html'
166+
} else if (isJs) {
167+
defaultType = 'jsx'
168+
}
167169

168170
if (defaultType === null) {
169171
cache.set(cacheKey, null)
@@ -172,7 +174,14 @@ export function getLanguageBoundaries(
172174

173175
text = getTextWithoutComments(text, isJs ? 'js' : 'html')
174176

175-
let lexer = defaultType === 'none' ? vueLexer : defaultLexer
177+
let lexer = defaultLexer
178+
179+
if (defaultType === 'none') {
180+
if (isVueDoc(doc)) {
181+
lexer = vueLexer
182+
}
183+
}
184+
176185
lexer.reset(text)
177186

178187
let type = defaultType

0 commit comments

Comments
 (0)