-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snippet exports cause errors in VSCode #2640
Comments
Additions to the bug descriptionMore generally it seems to happen when trying to export snippets that reference any declaration ReproductionI've ran into this issue when trying to create formatter snippets. It seems to happen
<script lang="ts" module>
export { noConst }; // Works just fine
export { withConst }; // ts(2304): Cannot find name 'withConst'.
export { withNonPrimitiveParam }; // ts(2304): Cannot find name 'withNonPrimitiveParam'.
</script>
{#snippet noConst(foo: string)}
{foo}
{/snippet}
{#snippet withConst(foo: string)}
{@const bar = foo}
{bar}
{/snippet}
{#snippet withNonPrimitiveParam(foo: Record<string, string>)}
Not even using the param.
{/snippet}
|
After further experimenting, I can confirm it also does break compilation ( |
Instead of collecting the types/values that are allowed, we collect the types/values that are _disallowed_ - this makes it possible to reference global values/types and still have them properly be declared as hoistable #2640
Instead of collecting the types/values that are allowed, we collect the types/values that are _disallowed_ - this makes it possible to reference global values/types and still have them properly be declared as hoistable #2640
Instead of collecting the types/values that are allowed, we collect the types/values that are _disallowed_ - this makes it possible to reference global values/types and still have them properly be declared as hoistable #2640
I just noticed this error, and it is now fixed (thanks @dummdidumm !!), except, it reappears if you set |
Describe the bug
In VSCode the svelte language server breaks when exporting a snippet that:
props
gotten as an argument#if
statement referencing an "unknown" identifier likeError
(i.e it can't find it in the file scope)Reproduction
Expected behaviour
There shouldn't be an error because the compiler doesn't break as shown in this REPL
System Info
Which package is the issue about?
Svelte for VS Code extension, svelte-language-server
Additional Information, eg. Screenshots
The text was updated successfully, but these errors were encountered: