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'
13
13
import dlv from 'dlv'
14
14
import removeMeta from './util/removeMeta'
15
15
import { formatColor , getColor , getColorFromValue } from './util/color'
16
- import { isHtmlContext , isHtmlDoc , isVueDoc } from './util/html'
16
+ import { isHtmlContext , isHtmlDoc } from './util/html'
17
17
import { isCssContext } from './util/css'
18
18
import { findLast , matchClassAttributes , matchClassFunctions } from './util/find'
19
19
import { stringifyConfigValue , stringifyCss } from './util/stringify'
Original file line number Diff line number Diff line change @@ -157,13 +157,15 @@ export function getLanguageBoundaries(
157
157
158
158
let isJs = isJsDoc ( state , doc )
159
159
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
+ }
167
169
168
170
if ( defaultType === null ) {
169
171
cache . set ( cacheKey , null )
@@ -172,7 +174,14 @@ export function getLanguageBoundaries(
172
174
173
175
text = getTextWithoutComments ( text , isJs ? 'js' : 'html' )
174
176
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
+
176
185
lexer . reset ( text )
177
186
178
187
let type = defaultType
You can’t perform that action at this time.
0 commit comments