Repository navigation
Commit e549d19
authored
fix(syntax): don't let comments inside
The default template-content injection selector excluded `meta source` but not
`comment`, so it also matched while the tokenizer was inside an HTML comment.
Any `>` followed by whitespace inside a comment, such as `<div>` on its own
line, made the injection begin again there, and the new instance's
`end: (?=</template)` shadowed the comment's `end: -->`. The comment then never
closed, and `</template>` was scoped as part of it.
Excluding `comment` from the selector keeps the injection from re-beginning
inside a comment. The comment closes normally and the content after it is still
highlighted, which the added sample covers.
Fixes #2663<template> swallow the file (#3137)1 parent af7c6a5 commit e549d19
3 files changed
Lines changed: 36 additions & 1 deletion
File tree
- packages/svelte-vscode
- syntaxes
- test/grammar/samples/template-comment
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments