Skip to content

Commit 30bb96f

Browse files
committed
fix hover provider when using computed attribute in vue template
1 parent cfd4e4f commit 30bb96f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lsp/util/find.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { isCssContext, isCssDoc } from './css'
55
import { isHtmlContext, isHtmlDoc, isSvelteDoc, isVueDoc } from './html'
66
import { isWithinRange } from './isWithinRange'
77
import { isJsContext, isJsDoc } from './js'
8-
import { getClassAttributeLexer } from './lexers'
8+
import {
9+
getClassAttributeLexer,
10+
getComputedClassAttributeLexer,
11+
} from './lexers'
912

1013
export function findAll(re: RegExp, str: string): RegExpMatchArray[] {
1114
let match: RegExpMatchArray
@@ -107,7 +110,10 @@ export function findClassListsInHtmlRange(
107110
matches.forEach((match) => {
108111
const subtext = text.substr(match.index + match[0].length - 1, 200)
109112

110-
let lexer = getClassAttributeLexer()
113+
let lexer =
114+
match[0][0] === ':'
115+
? getComputedClassAttributeLexer()
116+
: getClassAttributeLexer()
111117
lexer.reset(subtext)
112118

113119
let classLists: { value: string; offset: number }[] = []

0 commit comments

Comments
 (0)