@@ -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 } from './util/html'
16+ import { isHtmlContext , isHtmlDoc , isVueDoc } from './util/html'
1717import { isCssContext } from './util/css'
1818import { findLast , matchClassAttributes } from './util/find'
1919import { stringifyConfigValue , stringifyCss } from './util/stringify'
@@ -728,10 +728,20 @@ async function provideClassAttributeCompletions(
728728 position : Position ,
729729 context ?: CompletionContext ,
730730) : Promise < CompletionList > {
731- let str = document . getText ( {
731+ let range : Range = {
732732 start : document . positionAt ( Math . max ( 0 , document . offsetAt ( position ) - SEARCH_RANGE ) ) ,
733733 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+ }
735745
736746 let settings = ( await state . editor . getConfiguration ( document . uri ) ) . tailwindCSS
737747
0 commit comments