Skip to content
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 Language Plugin #842

Closed
wants to merge 2 commits into from
Closed

Typescript Language Plugin #842

wants to merge 2 commits into from

Conversation

pushkine
Copy link
Contributor

@pushkine pushkine commented Feb 24, 2021

This TSPlugin injects arbitrary languages to the list of files the real TS Language Server supports, when a file of that language is requested it simply transforms its cached contents into another language that TS natively understands (TSX in our case), and maps LanguageService requests back to the source when returning results.

This implementation edits the cached files content back and forth between languages on the fly, svelte essentially becomes tsx in the eyes of the ts language server. Benefits include refactoring, rename, codelens, references, imports, autocomplete and so on...

(WIP) Need to change how things are mapped in svelte2tsx, will submit a PR once #864 is resolved

Todo

  • Write a short breakdown of what's going on, list mutated parts of the internal API
  • Write tests

@dummdidumm
Copy link
Member

I created #978 which takes a different approach which is not that deeply integrated with the TS plugin. This has the advantage of not patching that many private APIs and having more control of the process. The only drawback is that Svelte file changes need to be saved to disk in order to get noticed, which is okay to me. Later on we could investigate a more deep integration if needed.

@pushkine pushkine closed this Jun 5, 2021
@pushkine pushkine deleted the typescript-language-plugin branch June 5, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants