Skip to content

Commit

Permalink
fix svelte 5 issues. workaround the await block issue and fixing it s…
Browse files Browse the repository at this point in the history
…eparately
  • Loading branch information
jasonlyu123 committed Oct 12, 2024
1 parent d47f48d commit 8971042
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class DocumentHighlightProviderImpl implements DocumentHighlightProvider
const ranges: RangeTupleArray = [];

walkSvelteAst(candidate.else, {
enter(node) {
enter(node, _, key) {
const templateNode = node as TemplateNode;
if (templateNode.type === 'IfBlock' && templateNode.elseif) {
const elseIfStart = content.lastIndexOf(
Expand All @@ -224,7 +224,7 @@ export class DocumentHighlightProviderImpl implements DocumentHighlightProvider
}
}

if (templateNode.type === 'ElseBlock') {
if (templateNode.type === 'ElseBlock' && key === 'else') {
const elseStart = content.lastIndexOf(':else', templateNode.start);

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ describe('DocumentHighlightProvider', function () {

it('get highlight for await block (skip pending)', async () => {
await testSameHighlight(
'{#await expression then name}{/await}',
[2, 20, 30],
'{#await expression then name} {/await}',
[2, 20, 31],
[
[1, 7],
[19, 23],
[30, 36]
[31, 37]
]
);
});
Expand Down

0 comments on commit 8971042

Please sign in to comment.