-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Use external typescript-plugin for IntelliSense within svelte files #905
Comments
I haven't tested this but maybe it's enough to add it to the |
What I want to achieve is autocompletion for the I could use a RegExp to "parse" but if there is a way to can an AST that would be awesome. I could then re-use some logic I have in the typescript-plugin. Is there any way to communicate or hook in to the Svelte language server? |
I found this StackOverflow question which was able to get typescript plugins running in the instantiated ts language server. I however can't find any bits in the source code where this logic could fit in. I too have a typescript plugin that I hope to work in Svelte files. |
The language service is initialized here Note to self: It needs to be checked what happens if the Svelte plugin is enabled, it could interfere with some of the language service functionality. |
Did some more digging today, and I might have to conclude that it's impossible to load plugins just with a typescript language server. By just looking at a ts plugin's interface PluginCreateInfo {
project: Project;
languageService: LanguageService;
languageServiceHost: LanguageServiceHost;
serverHost: ServerHost;
config: any;
} Also from the In turn, I looked into how typescript loads it, and by painstakingly walking up the call stack, it seems that it requires at least a "project" to load a plugin. I'm not sure if it's a flawed or intentional design, but it sucks :/ |
Aren't there any plans to add support for TypeScript plugins? Have things changed by any chance since this comment? It would really be an immensely useful new feature. This is a pretty big thing that's currently lacking. |
@dummdidumm do you know if this will be possible in Svelte 5? Is there a chance that this could work some day? |
The problem isn't something to do with svelte core. So no, it won't be possible in Svelte 5.
Maybe. The problem is explained in previous discussions. The object required simply doesn't exist in the Svelte language server. The situation has changed slightly in the later TypeScript version. The "typescript" import now has the necessary class(Project) that is needed but creating the object is considered an internal API for typescript. And we'll have to migrate our code that does similar things to the Project class. This won't be easy. |
Just stumbled into this again. Using things like gql.tada is not possible in Svelte today either; since its TypeScript plugin would work in neither |
Is there any updates on this? Any new discussion or milestone set? I am also a user of gql.tada, who cannot get LSP running with gql.tada. |
I have created a typescript plugin that powers Twind IntelliSense for VS Code.
Is it possible or would it be possible to have the completions/diagnostics from that typescript plugin within svelte files using the same implementation?
@dummdidumm Mentioned that it is maybe possible to hook into the Svelte language server. How would that be done?
I'm happy to contribute if there needs something to be implemented here. Or could give me some pointers/ideas on how that could be implemented in userland?
Originally asked here: #580 (comment)
The text was updated successfully, but these errors were encountered: