Skip to content

Commit

Permalink
feat: support multiple v-bind(...) in single css expression
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Aug 21, 2021
1 parent df2a3ac commit 28ae08b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/vscode-vue-languageservice/src/parsers/cssBinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 28ae08b

Please sign in to comment.