fix: snippets with TS incorrect transformation #2412
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After sveltejs/svelte#12070 the AST for the SnippetBlock has changed (to be more correct).
The problem is that
svelte2tsx
was using that wrong information for the transformation. This means that currently last version of svelte produces wrong ts code fromsvelte2tsx
.The problem is that before parameter
end
was including the typeAnnotationwhile now it stops where it should (at the parameter)
this PR fixes this problem by looking at the end of typeAnnotation if there's one and falling back to the end of the parameter otherwise.
I tried to update a test but despite messing with the expected to make it fail it was still passing so i think i need a bit of guidance over this (sorry).
Also currently there's one failing test for the language server (in the SemanticTokenProvider so i have to check what's that.Ok by debugging the language server it seems like the type semantic tokens are lost in the snippet...will try to fixLol scratch last one it was failing in master too, i just needed a
pnpm i