You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tsserver should implement the Language Server Protocol #11274
We did some work at Sourcegraph in wrapping the TS language service as a language server, but hit some limitations with the current API. Specifically, the LanguageServiceHost interface you can provide to the server requires the methods that return file contents to return synchronously. In a language server however this is most likely done asynchronously because retrieving the file content involves IO with the file system or over the protocol stream.
I would be very interested in help or improvements in the TS server to solve this use case.
Felix Becker (@felixfbecker) Sorry, I'll try to clarify what I mean. Instead of implementing LanguageServiceHost, you could let tsserver host the language service, and you wouldn't need to care about how it satisfies that interface. Your language server process would rely on passing messages to/from tsserver, which is inherently async.
Felix Becker (@felixfbecker) Yeah, it would read the files directly. I don't think that would affect your language server process in any way though. If/when they make performance improvements to tsserver you don't need to make any changes.
I have implemented the initial version of language server protocol for typescript which can be found at https://github.com/prabirshrestha/typescript-language-server. It acts as a proxy for tsserver. Currently textDocument/didOpen, textDocument/change and textDocument/completion are implemented but adding others should be fairly easy.
In the long term I would definitely love to see LSP shipping as part of the official typescript installation.
Reacted by Asad Saeeduddin, Thomas Bonk, Danny Martini, Scott Bronson, Josh Wedekind, Mickael Istria, Arnaud, Corentin Girard and nyngwang
Here is another LSP implementation of Typescript based on my original tsserver proxy idea. https://github.com/theia-ide/typescript-language-server. They have added more protocol feature support. It is maintained by folks at TypeFox. I have also handed over the typescript-language-server npm package to them.
Can we get an update on whether there are plans for this issue?
The two existing TS LSP servers both have big issues. If the TS team wants TypeScript to be used outside of VSCode / VStudio, they should resolve this issue. SourceGraph: worst-case warm-up time is extremely long; no support for files that change on disk, such as the tsconfig.json file. TypeFox: incomplete implementation of LSP.
Reacted by Thomas Bonk, Nick Chen, Ændra Rininsland, Parasrah, Andrew Nester, Roy Lee, Hao Li, Trey Thomas, Robert Simpson, Derek Sifford and 10 more
Reacted by Andy Russell, Nurbol Alpysbayev, Elliot Dohm, Thomas Bonk, JQ Zhu, Simon Siefke, Martin Schenck, Предраг Николић, Aria Buckles, Lynn Dylan Hurley and 8 more
The library of theia-ide seems to be not bad, but as felixbecker said, indeed has problems, unfortunately. For instance it does not raise errors on unused variables when noUnusedLocals is enabled. And I have just started exploring it (fearing of other inconsistencies).
One more anecdote is microsoft/vscode#70239
By not using LSP in tsserver, it means there are features that exist in vscode + tsserver that aren't yet possible to implement with LSP + vscode alone. This puts LSP implementations at a disadvantage compared to non-LSP implementations.
Reacted by ᴙɘɘᴙgYmɘᴙɘj, Nathan, David Else, Dmitry Gutov, Предраг Николић, Anton Kosyakov, kuator, Christian Zangl, Josh Wedekind, Victor Malov and 2 more
It would be great if typescript embraces LSP and makes sure that features are available through it when they are added. That's VS Code uses tsserver directly without using LSP put all other tools to disadvantage. That's one of reasons for Theia to use VS Code extensions instead of trying to align https://github.com/theia-ide/typescript-language-server with VS Code extension each release.
Reacted by Makoto Motohashi, Предраг Николић, Aria Buckles, kuator, Maurn, thanhvg, Paweł Sacawa, Jeff Heaton, Bnaya Peretz, Bálint Fülöp and 3 more
This request means additional work for the TS team, and VSCode's tight integration with TSServer makes a subtle to hint to use another Microsoft product. But not doing it leaves influence on the table. There are many people that can't or won't use VSCode, but will use LSP. Neovim's upcoming LSP client for example.
Reacted by Adam Quinn Snow, Christian Zangl, Alexandru Ungur, Bálint Fülöp, Rogin Farrer, Felix Schröter, Germano Gabbianelli and Jost
Activity
StevenDoesStuffs commentedon Nov 27, 2016
Been 2 monthts, any updates?
felixfbecker commentedon Feb 9, 2017
We did some work at Sourcegraph in wrapping the TS language service as a language server, but hit some limitations with the current API. Specifically, the
LanguageServiceHostinterface you can provide to the server requires the methods that return file contents to return synchronously. In a language server however this is most likely done asynchronously because retrieving the file content involves IO with the file system or over the protocol stream.I would be very interested in help or improvements in the TS server to solve this use case.
masaeedu commentedon Feb 24, 2017
Felix Becker (@felixfbecker) Would it be possible to overcome the limitations if you interfaced with an instance of tsserver instead?
felixfbecker commentedon Feb 24, 2017
Asad Saeeduddin (@masaeedu) I don't understand the question - the TS language server is using the
LanguageServicefrom TypeScript?masaeedu commentedon Feb 24, 2017
Felix Becker (@felixfbecker) Sorry, I'll try to clarify what I mean. Instead of implementing
LanguageServiceHost, you could lettsserverhost the language service, and you wouldn't need to care about how it satisfies that interface. Your language server process would rely on passing messages to/from tsserver, which is inherently async.felixfbecker commentedon Mar 24, 2017
Asad Saeeduddin (@masaeedu) wouldn't the tsserver try to read from the file system directly?
masaeedu commentedon Mar 24, 2017
Felix Becker (@felixfbecker) Yeah, it would read the files directly. I don't think that would affect your language server process in any way though. If/when they make performance improvements to tsserver you don't need to make any changes.
felixfbecker commentedon Mar 24, 2017
Asad Saeeduddin (@masaeedu) That is a dealbreaker unfortunately, because the files are not available locally in the container.
prabirshrestha commentedon Aug 11, 2017
I have implemented the initial version of language server protocol for typescript which can be found at https://github.com/prabirshrestha/typescript-language-server. It acts as a proxy for
tsserver. CurrentlytextDocument/didOpen,textDocument/changeandtextDocument/completionare implemented but adding others should be fairly easy.In the long term I would definitely love to see LSP shipping as part of the official typescript installation.
prabirshrestha commentedon Oct 3, 2017
Here is another LSP implementation of Typescript based on my original tsserver proxy idea. https://github.com/theia-ide/typescript-language-server. They have added more protocol feature support. It is maintained by folks at TypeFox. I have also handed over the
typescript-language-servernpm package to them.vvakame commentedon Jun 1, 2018
https://github.com/Microsoft/TypeScript/wiki/Roadmap#30-july-2018
I saw the roadmap. next version up is major version up! 🥂
do you have any plans about this issue?
keyboardDrummer commentedon Sep 5, 2018
Can we get an update on whether there are plans for this issue?
The two existing TS LSP servers both have big issues. If the TS team wants TypeScript to be used outside of VSCode / VStudio, they should resolve this issue.
SourceGraph: worst-case warm-up time is extremely long; no support for files that change on disk, such as the tsconfig.json file.
TypeFox: incomplete implementation of LSP.
anurbol commentedon Mar 9, 2019
6 months from the time last comment was written. Any updates on this? LSP is promoted by Microsoft, yet TypeScript seems to ignore it. Weird :-)
mickaelistria commentedon Mar 9, 2019
You can use https://github.com/theia-ide/typescript-language-server which more or less does the work of wrapping tsserver messages as LSP ones.
I'm closing this issue as I'm satisfied with https://github.com/theia-ide/typescript-language-server and wouldn't -as a consumer- get.any clear added-value if this were implemented directly in tsserver.
felixfbecker commentedon Mar 9, 2019
I am using https://github.com/theia-ide/typescript-language-server too and it has lots of problems. Problems that I think wouldn't exist if the official server spoke LSP.
anurbol commentedon Mar 10, 2019
The library of theia-ide seems to be not bad, but as felixbecker said, indeed has problems, unfortunately. For instance it does not raise errors on unused variables when
noUnusedLocalsis enabled. And I have just started exploring it (fearing of other inconsistencies).mickaelistria commentedon Mar 10, 2019
vicapow commentedon Mar 11, 2019
One more anecdote is microsoft/vscode#70239
By not using LSP in tsserver, it means there are features that exist in vscode + tsserver that aren't yet possible to implement with LSP + vscode alone. This puts LSP implementations at a disadvantage compared to non-LSP implementations.
mmktomato commentedon Apr 23, 2020
I'm also using https://github.com/theia-ide/typescript-language-server . But I found it's looking for maintainers. typescript-language-server/typescript-language-server#141 I think it shows we can't rely on it so long time.
Is it the time to reconsider this issue?
akosyakov commentedon May 1, 2020
It would be great if typescript embraces LSP and makes sure that features are available through it when they are added. That's VS Code uses tsserver directly without using LSP put all other tools to disadvantage. That's one of reasons for Theia to use VS Code extensions instead of trying to align https://github.com/theia-ide/typescript-language-server with VS Code extension each release.
saltmade commentedon May 24, 2020
This request means additional work for the TS team, and VSCode's tight integration with TSServer makes a subtle to hint to use another Microsoft product. But not doing it leaves influence on the table. There are many people that can't or won't use VSCode, but will use LSP. Neovim's upcoming LSP client for example.
marc2332 commentedon Aug 16, 2020
So, what's the status of this?
There isn't any updated and maintained language server for JS / TS currently, as far I know
mickaelistria commentedon Aug 16, 2020
See #39459 which revives this issue in this new context.