Skip to content

Commit c4d2bd3

Browse files
committed
feat: support multiple v-bind(...) in single css expression
#335
1 parent df2a3ac commit c4d2bd3

File tree

1 file changed

+8
-5
lines changed
  • packages/vscode-vue-languageservice/src/parsers

1 file changed

+8
-5
lines changed

packages/vscode-vue-languageservice/src/parsers/cssBinds.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ export function parse(docText: string, ss: css.Stylesheet) {
1616
function visChild(node: StylesheetNode) {
1717
if (node.type === 22) {
1818
const nodeText = docText.substring(node.offset, node.end);
19-
const reg = /^v-bind\s*\(\s*(\S*)\s*\)$/;
20-
const match = nodeText.match(reg);
21-
if (match) {
19+
const reg = /v-bind\s*\(\s*([^\s\)]*)\s*\)/g;
20+
const matchs = nodeText.matchAll(reg);
21+
for (const match of matchs) {
2222
const matchText = match[1];
23-
const offset = node.offset + nodeText.lastIndexOf(matchText);
24-
result.push({ start: offset, end: offset + matchText.length });
23+
const matchIndex = match.index!;
24+
if (match.index !== undefined) {
25+
const offset = node.offset + matchIndex + nodeText.substr(matchIndex).indexOf(matchText);
26+
result.push({ start: offset, end: offset + matchText.length });
27+
}
2528
}
2629
}
2730
else if (node.children) {

0 commit comments

Comments
 (0)