@@ -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 } from './util/html'
16
+ import { isHtmlContext , isHtmlDoc , isVueDoc } from './util/html'
17
17
import { isCssContext } from './util/css'
18
18
import { findLast , matchClassAttributes } from './util/find'
19
19
import { stringifyConfigValue , stringifyCss } from './util/stringify'
@@ -728,10 +728,20 @@ async function provideClassAttributeCompletions(
728
728
position : Position ,
729
729
context ?: CompletionContext ,
730
730
) : Promise < CompletionList > {
731
- let str = document . getText ( {
731
+ let range : Range = {
732
732
start : document . positionAt ( Math . max ( 0 , document . offsetAt ( position ) - SEARCH_RANGE ) ) ,
733
733
end : position ,
734
- } )
734
+ }
735
+
736
+ let str : string
737
+
738
+ if ( isJsDoc ( state , document ) ) {
739
+ str = getTextWithoutComments ( document , 'js' , range )
740
+ } else if ( isHtmlDoc ( state , document ) ) {
741
+ str = getTextWithoutComments ( document , 'html' , range )
742
+ } else {
743
+ str = document . getText ( range )
744
+ }
735
745
736
746
let settings = ( await state . editor . getConfiguration ( document . uri ) ) . tailwindCSS
737
747
0 commit comments