Skip to content

Commit

Permalink
fix: keep linkedEditing working when tag name contains . (#2570)
Browse files Browse the repository at this point in the history
#2569
Since Svelte 5, dots are allowed and indicate a component name
  • Loading branch information
dyc3 authored Nov 8, 2024
1 parent 6513a28 commit a3a6393
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/language-server/src/plugins/html/HTMLPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,12 @@ export class HTMLPlugin
return null;
}

return { ranges };
// Note that `.` is excluded from the word pattern. This is intentional to support property access in Svelte component tags.
return {
ranges,
wordPattern:
'(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\\'\\"\\,\\<\\>\\/\\s]+)'
};
}

getFoldingRanges(document: Document): FoldingRange[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ describe('HTML Plugin', () => {
ranges: [
{ start: { line: 0, character: 1 }, end: { line: 0, character: 4 } },
{ start: { line: 0, character: 7 }, end: { line: 0, character: 10 } }
]
],
wordPattern:
'(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\\'\\"\\,\\<\\>\\/\\s]+)'
});
});

Expand Down

0 comments on commit a3a6393

Please sign in to comment.