-
-
Notifications
You must be signed in to change notification settings - Fork 209
Lack of Intellisense/typing with external components #2774
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
Comments
This is because the language server only treats the file as a Svelte 5 component if the file is under a directory with Svelte 5 installed. And this empty shared folder isn't. You can install Svelte 5 and add a jsconfig.json in the shared directory. |
That doesn't seem to work for me, but it also doesn't sound like a great option -- a user wouldn't need a second copy of Svelte to simply use those files in their project, so why should they need a second copy just for editor support? Is there a way for the language server's file list to be augmented with files included in a project's |
You'll need to restart the editor after the change for it to work. There are two parts to the problem: one is Svelte compiler diagnostics, and the other is TypeScript/JavaScript. The svelte compiler part doesn't involve tsconfig/jsconfig.json at all, so I don't think it makes sense to check the svelte version based on tsconfig with this.
If you're sharing these svelte files with two projects, don't you already have two versions? If you didn't reuse these files, why can't you just move these files to the same directory? Or maybe you can try installing Svelte in the repo root. That way, you would only have one Svelte version. If we change the default Svelte version in the future, it might work again, but I don't think we'll change it anytime soon. |
@jasonlyu123 You're right, the Svelte diagnostics did start to work after installing Svelte 5 in
I do -- your suggestion would be that I have three, unless I'm misunderstanding:
And your suggestion makes sense -- if Installing Svelte at the root fixes these problems, but introduces a larger one in not being able to selectively update Svelte versions on projects.
Could I ask for a setting then, to assume that all files are Svelte 5 without looking for a version? I'm imagining a scenario like:
As is, the extension wouldn't assume that the contents of |
Describe the bug
Niche issue I'm sure, but I have a setup with a number of components in an external folder, aliased to
$shared
. These can be imported and used without issue, but when migrating to Svelte 5, I get warnings for missing declarations on all runes. I also get incorrect type-checking, as illustrated in the reproduction.I tried modifying my
jsconfig.json
with:but this didn't seem to have any effect.
Reproduction
https://github.com/stephenlrandall/svelte-lang-tools-issue
Expected behaviour
I'd expect to get the same first-class Svelte extension support in the "shared" folder, perhaps by some configuration option that I haven't figured out yet.
System Info
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
The text was updated successfully, but these errors were encountered: