From 28ae08ba57dfc91618e555d960ac87033881f9ed Mon Sep 17 00:00:00 2001 From: johnsoncodehk Date: Sat, 21 Aug 2021 17:03:12 +0800 Subject: [PATCH] feat: support multiple `v-bind(...)` in single css expression #335 --- .../src/parsers/cssBinds.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/vscode-vue-languageservice/src/parsers/cssBinds.ts b/packages/vscode-vue-languageservice/src/parsers/cssBinds.ts index b155534bf..059251103 100644 --- a/packages/vscode-vue-languageservice/src/parsers/cssBinds.ts +++ b/packages/vscode-vue-languageservice/src/parsers/cssBinds.ts @@ -16,12 +16,14 @@ export function parse(docText: string, ss: css.Stylesheet) { function visChild(node: StylesheetNode) { if (node.type === 22) { const nodeText = docText.substring(node.offset, node.end); - const reg = /^v-bind\s*\(\s*(\S*)\s*\)$/; - const match = nodeText.match(reg); - if (match) { - const matchText = match[1]; - const offset = node.offset + nodeText.lastIndexOf(matchText); - result.push({ start: offset, end: offset + matchText.length }); + const reg = /v-bind\s*\(\s*([^\s\)]*)\s*\)/g; + const matchs = nodeText.matchAll(reg); + for (const match of matchs) { + if (match.index !== undefined) { + const matchText = match[1]; + const offset = node.offset + match.index + nodeText.substr(match.index).indexOf(matchText); + result.push({ start: offset, end: offset + matchText.length }); + } } } else if (node.children) {