File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
packages/tailwindcss-language-service/src Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import type { TextDocument } from 'vscode-languageserver-textdocument'
1313import dlv from 'dlv'
1414import removeMeta from './util/removeMeta'
1515import { formatColor , getColor , getColorFromValue } from './util/color'
16- import { isHtmlContext , isHtmlDoc , isVueDoc } from './util/html'
16+ import { isHtmlContext , isHtmlDoc } from './util/html'
1717import { isCssContext } from './util/css'
1818import { findLast , matchClassAttributes , matchClassFunctions } from './util/find'
1919import { stringifyConfigValue , stringifyCss } from './util/stringify'
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments