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

tsserver should implement the Language Server Protocol #39459

Open
5 tasks done
leungbk opened this issue Jul 7, 2020 · 49 comments
Open
5 tasks done

tsserver should implement the Language Server Protocol #39459

leungbk opened this issue Jul 7, 2020 · 49 comments
Assignees
Labels
Committed The team has roadmapped this issue Domain: TSServer Issues related to the TSServer Suggestion An idea for TypeScript

Comments

@leungbk
Copy link

leungbk commented Jul 7, 2020

Search Terms

language server protocol

Suggestion

As the language server protocol ( https://github.com/Microsoft/language-server-protocol ) is getting more and more popularity and clients ( https://github.com/Microsoft/language-server-protocol/wiki/Protocol-Implementations ), it would be very useful to have the tsserver implement this protocol.

This is a duplicate of issue #11274, which the OP closed because at that time, there existed two reasonable-looking LSP implementations for TypeScript.

But the times have changed. The Theia IDE now uses a VS Code extension for its TypeScript needs, and in the last eighteen months, Sourcegraph's server has received exactly one update by a sentient person.

There continue to be requests for LSP support within #11724 despite its Closed status. The OP has expressed no interest in revisiting the issue.

Use Cases

It would be useful to programmers who use TypeScript but don't use VS Code.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@halfnibble
Copy link

Is there any traction on this? I feel like this should be somewhat high priority, but only because my favorite IDE's all blame TypeScript's non-conformance to the Language Server Protocol as the reason TypeScript support is buggy.

How bad is this issue, and how difficult would it be to remedy? Thanks. I'd also be interested in links to reading material that might enlighten me on the subject.

@RyanCavanaugh
Copy link
Member

We're working on this, albeit slowly. tsserver's implementation predates LSP so it's nontrivial work to move forward in a way that doesn't adversely affect old clients or result in code duplication.

Your favorite IDE should misplace their blame somewhere else 🙃

@laktak
Copy link

laktak commented Sep 23, 2020

@RyanCavanaugh If you are looking for a testing environment may I suggest vim with vim-lsp.

@yyoncho
Copy link

yyoncho commented Dec 11, 2020

@RyanCavanaugh is there a branch to track? Or what is the best way to track the work on that?

@rubencaro
Copy link

@RyanCavanaugh In line with last comment: any list of issues/tasks that someone could tackle on free time to help with this?

@mickaelistria
Copy link

From Eclipse Wild Web Developer perspective, we'd also gladly participate in some testing of this feature when it's available for experiments. We're not looking for a 100% LSP conformance from day 1, we're just looking for a sustainable and more standard alternative to the https://github.com/theia-ide/typescript-language-server and we'd gladly migrate to standard tsserver LSP support even if we lose a few features by the way. We'll more easily be able to contribute to tsserver after we can have a minimum viable experimental LSP support.

@DanielRosenwasser DanielRosenwasser added Committed The team has roadmapped this issue and removed In Discussion Not yet reached consensus labels Feb 3, 2021
@DanielRosenwasser DanielRosenwasser added the Domain: TSServer Issues related to the TSServer label Feb 3, 2021
@DanielRosenwasser
Copy link
Member

I don't have any major updates; as Ryan mentioned, the work is happening bit by bit, but we are working on it so I've at least labeled the issue as such. One thing that @minestarks mentioned to me is that it would be good to have a channel with implementers who plan to use an LSP server so that we can potentially coordinate and hear more about use-cases. If you're an LSP client implementer, I'd encourage you to just drop a reply here.

@apexskier
Copy link

I'm not directly an LSP client implementer, but I'm hoping to use tsserver as a language server in https://github.com/apexskier/nova-typescript as a language server for Nova instead of typescript-language-server.

@halfnibble
Copy link

And I am willing to help with any tasks that might help @apexskier achieve that goal because I much prefer Nova and I work all day on build tools for large TypeScript monorepos.

@yyoncho
Copy link

yyoncho commented Feb 4, 2021

@DanielRosenwasser

more about use-cases.

I guess we all(lsp client maintainers) have one use-case - we want to access the tsserver functionality via LSP protocol to avoid the need to support multiple protocols.

If you're an LSP client implementer, I'd encourage you to just drop a reply here.

@leungbk and I are maintainers of Emacs LSP client - https://emacs-lsp.github.io

@DonnieWest
Copy link

DonnieWest commented Feb 4, 2021

@DanielRosenwasser I'd be interested in being included - I'm the maintainer of typescript-language-server, which uses tsserver internally :)

@leungbk
Copy link
Author

leungbk commented Feb 4, 2021

@joaotavora, the author of eglot, another LSP client for Emacs, may also be interested.

@polyzen
Copy link

polyzen commented Feb 4, 2021

cc @prabirshrestha @hrsh7th

@Kingwl
Copy link
Contributor

Kingwl commented Dec 1, 2021

Happy to continue to work on it If I may.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Dec 1, 2021

We appreciate that - but this is a fairly large work item, and on top of that I think we need to work closely with our editor teams to make sure both sides of the LSP implementation are working correctly. For example, VS or VS Code might implement some specific field of a request in theory, but they might implement it differently, or there may have been some oversight. There are also situations where we need to discuss adding some support for some TypeScript-specific extension that the LSP doesn't specify as part of its core list of request types. For that reason, I think it would be best for having someone on the core team tackle this.

@tim-hilt
Copy link

tim-hilt commented Dec 1, 2021

@DanielRosenwasser does that mean your implementation might not be useable in other editors?

@kitsonk
Copy link
Contributor

kitsonk commented Dec 1, 2021

@DanielRosenwasser does that mean your implementation might not be useable in other editors?

Not addressed to me, but I can tell you from experience with the Deno language server, just adhering to the LSP protocol is only half the battle. What you fill in is quite complex. There is a lot of logic that currently isn't in tsc. So it doesn't mean it won't be unusable by other editors, but it will and does come with opinions. There is a whole set of them in what is in the TypeScript plugin for vscode that would need to be moved to tsc. So I can totally see the need for tight integration, let alone the need to provide the same thing for VS (which likely has had different opinions on that glue code).

For example, vscode uses typescriptreact for .tsx but other editors use tsx as the language ID. 🤷 So, once it is there for VS/VS Code, there would likely still need to be work with other editors, but that wouldn't be by intent.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Dec 1, 2021

@DanielRosenwasser does that mean your implementation might not be useable in other editors?

It's really the same as how TSServer integration works today. We add functionality to it, and we strive not to break clients that aren't aware of the changes. Clients then have to add some functionality if they wish to support a new feature. The same would be true of how we develop for LSP.

@tim-hilt
Copy link

tim-hilt commented Dec 1, 2021

@kitsonk @DanielRosenwasser thanks for the insight! It's great to see, that there's something happening behind the scenes :)

@mickaelistria
Copy link

@DanielRosenwasser I don't think it's correct to assume same support or even quality expectations between how TSServer would support LSP vs its internal protocol.
The goal and expectation from community about TSServer supporting LSP is to make it more easily usable in other IDEs and editors. VS and VSCode already have a great integration with the tsserver-protocol; would you plan to replace usage of the specific protocal with LSP in the VS/VSCode support? If not and you prefer sticking to the tsserver-protocol for VS/VSCode integration because it's working well, then it means that the integration through LSP in VS/VSCode is really not important and that LSP support in tsserver could be implemented independently of VS/VSCode as it does not target those tools; any other LSP-aware tool can be used for testing. However, if you plan to replace tsserver-protocol by LSP in VS/VSCode on the long run, because it allows better factorization and thus allows to save resources, then it makes sense to start working on the VS/VSCode integration early on, but as you said that would be a major piece of work that would take time to be complete and reach same level of quality as current integration, while I imagine having some relatively simple operations available soon for other IDEs/editors to consume tsserver more directly with LSP would be highly profitable.
I would have expected that community contributions to bring this to TypeScript "core" would be more welcome; particularly as there is already some good part of code available for inclusion (eg https://github.com/typescript-language-server/typescript-language-server )...

@maltenuhn
Copy link

@DanielRosenwasser thank you for the clarity and transparency - appreciate the classic dilemma (better handled by core team, but also limited resources on core team).

Somewhat orthogonal to the LSP/tsserver discussion: would there be value in pushing something forward here now that would help someone on the core team later? Or should this really be end-to-end taken by someone on core? Asking in good faith; clearly there's community demand.

@marcelbeumer
Copy link

Hi TypeScript team, any update on this? It seems nothing happened since Sep 2021, and it's not part of the TS 4.7 Iteration Plan (#48027) or overall roadmap either. Is it the right conclusion it has no priority and we should set our expectations accordingly?

@znck
Copy link

znck commented May 14, 2022

If it ever happens, I hope tsserver plugin API survives as https://github/vuedx/languagetools depends on it.

@w0rp
Copy link

w0rp commented May 16, 2022

The sensible thing to do is support tsserver for probably years to come, and LSP in addition to that. That will give all editors and plugin authors plenty of chance to replace their tsserver implementations with LSP. This being added to the spec very recently is of great help: microsoft/language-server-protocol#737

@predragnikolic
Copy link

Is it ok to close the issue
and say that LSP support is not planned?

When this issue got traction,
I could not wait for TS 4.5 to arrive with LSP, then 4.6... 4.7.... Now we are at TS 5.2... still no LSP support.

Given how things played out, it looks like this will not be a priority anytime soon.

@w0rp
Copy link

w0rp commented Oct 3, 2023

I've closed issues after years of them being open as a good solution was found, and I have had issues I have never closed because no one has ever solved the problem in years. I fundamentally believe issues should only ever be closed if they are resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Committed The team has roadmapped this issue Domain: TSServer Issues related to the TSServer Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests