Skip to content

Commit a3a6393

Browse files
authored
fix: keep linkedEditing working when tag name contains . (#2570)
#2569 Since Svelte 5, dots are allowed and indicate a component name
1 parent 6513a28 commit a3a6393

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/language-server/src/plugins/html/HTMLPlugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,12 @@ export class HTMLPlugin
333333
return null;
334334
}
335335

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

339344
getFoldingRanges(document: Document): FoldingRange[] {

packages/language-server/test/plugins/html/HTMLPlugin.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ describe('HTML Plugin', () => {
256256
ranges: [
257257
{ start: { line: 0, character: 1 }, end: { line: 0, character: 4 } },
258258
{ start: { line: 0, character: 7 }, end: { line: 0, character: 10 } }
259-
]
259+
],
260+
wordPattern:
261+
'(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\\'\\"\\,\\<\\>\\/\\s]+)'
260262
});
261263
});
262264

0 commit comments

Comments
 (0)