-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
TypeScript Plugin #580
Comments
Dumping some thoughts:
Idea for an incomplete solutionIn the client inside |
Hey I worked on a proof of concept today 2021-02-15.02-18-31_2.mp4https://github.com/pushkine/ts-plugin-svelte/ Beside obvious bugs where everything gets stale this doesn't yet work with Components, might be a conflict with Looks good to me though, what do you think ? |
This is a nice POC! I though about this topic a little more and there are to me two ways to get to a solution: Option 1: A "real" TS plugin (variant 1)
Steps 1/2 can be done in parallel, the others are best done one after another. If someone wants to help in one of these steps, please ping here so we can coordinate. Step 5 is best done by me or @jasonlyu123 because we know the code base best and this is a critical part. Advante: A "real solution" Option 2: A "fake" TS plugin
Advantage: We keep the language server as-is mostly Option 3: A "real" TS plugin (variant 2)This is a combination of option 1 and 2: Create a TS plugin which converts Svelte files through Advantage: Separate, clean implementation ========= Right now I think I prefer option 3. What do others think? |
This replaces asynchronous `source-map` with a synchronous mapping implementation using `sourcemap-codec`. According to the performance test there is no noticeable difference at file lenghts like these - `source-map` is better at really large files (thousands of lines), which is not the case for 99,9% of all Svelte files the user will edit with this. A further (according to tests not noticeable) performance improvment would be to return the decoded form of the source map from svelte2tsx (it used sourcemap-coded, too). The mapping implementation could also serve as a reference implementation for synchronous source mapping for TS plugin (sveltejs#580)
I also prefer option 3. Maybe we can export some functions from the plugin package or create another utility package to reuse some logic. For example, svelte-sys, source mapping utility, and source mapping workarounds. |
First: Thanks for all the great work you are doing! You are creating a really good DX. Now to the question: 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? 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? If this is the wrong issue I will move that into a separate issue. Thanks for your time. |
Thanks for the kind words! This question is unrelated to this issue. This issue is about implementing a TS plugin for Svelte. What you want is to hook into the Svelte language server. Please open a separate issue for that. |
Initially support - rename (doesn't work properly for all kinds of renames yet; need to filter out references inside generated code) - diagnostics - find references (need to filter out references inside generated code) This makes all files TSX hardcoded for now, it seems the TS server is okay with importing tsx into js sveltejs#580 sveltejs#550 sveltejs#342 sveltejs#110
There exists a TypeScript plugin now which comes packaged with the VS Code extension and which you need to enable through the settings. It also is available standalone as a npm package if you need to use it outside of VS Code. Please test out the plugin and provide feedback. If you find bugs, please open separate issues for them. |
sveltejs/svelte#5817 (comment) @dummdidumm should using this plugin resolve the 'has no exported member' issue with exported members from Svelte modules when building with webpack? Or is it only intended to help IDEs? |
Only IDEs can use plugins, they are not loaded by tsc |
There was no negative feedback so far, so let's make discoverability better by asking if it should be enabled. sveltejs#580
There was no negative feedback so far, so let's make discoverability better by asking if it should be enabled. #580
Just following up on #1413 . I am using v105.13.0 of the extension and I do have svelte.enable-ts-plugin : true but the issue still persists on my work machine. Home machine is working fine. Anything I do/provide to help diagnose the issue? Just FYI updating vscode from 1.64 to 1 |
Now implemented, please provide feedback
See this comment for more info
Original Post
The language-server has quite a few features by now. What's missing for the complete developer experience and intellisense though is crossing the boundaries of Svelte and JS/TS files. This can be achieved through a TypeScript plugin. The following features would be cool to have:
Open Questions
The text was updated successfully, but these errors were encountered: