From 30bb96f983d5bd7dfdb364e0b506d4a4696565ea Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 12 Jun 2020 12:30:12 +0100 Subject: [PATCH] fix hover provider when using computed attribute in vue template --- src/lsp/util/find.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lsp/util/find.ts b/src/lsp/util/find.ts index 7a09c30..265fdc2 100644 --- a/src/lsp/util/find.ts +++ b/src/lsp/util/find.ts @@ -5,7 +5,10 @@ import { isCssContext, isCssDoc } from './css' import { isHtmlContext, isHtmlDoc, isSvelteDoc, isVueDoc } from './html' import { isWithinRange } from './isWithinRange' import { isJsContext, isJsDoc } from './js' -import { getClassAttributeLexer } from './lexers' +import { + getClassAttributeLexer, + getComputedClassAttributeLexer, +} from './lexers' export function findAll(re: RegExp, str: string): RegExpMatchArray[] { let match: RegExpMatchArray @@ -107,7 +110,10 @@ export function findClassListsInHtmlRange( matches.forEach((match) => { const subtext = text.substr(match.index + match[0].length - 1, 200) - let lexer = getClassAttributeLexer() + let lexer = + match[0][0] === ':' + ? getComputedClassAttributeLexer() + : getClassAttributeLexer() lexer.reset(subtext) let classLists: { value: string; offset: number }[] = []