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 · 59 comments
Open
5 tasks done

tsserver should implement the Language Server Protocol #39459

leungbk opened this issue Jul 7, 2020 · 59 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

@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.

@dcousens
Copy link

dcousens commented Jan 21, 2025

For others following, @jakebailey last commented on this topic in #57475, with #59250 and #59905 both seeming to still capture this in their iteration plans 💙.

The current LSP thinking is to slowly onboard calls away from the old protocol onto the new one, so it's not going to be like one day we aren't LSP and one day we are, either.

@jakebailey did you have any thoughts on a rough timeline for support? Are we months or probably years away?

@jakebailey
Copy link
Member

jakebailey commented Jan 23, 2025

I can't promise anything, but I'm certainly hoping it's not years. This is work I want to do.

The main question I have for you is "why do you want LSP?" What specific problem are you looking to solve by having it implemented?

To be clear, I am not saying it's a bad idea to do, not at all, I want to do it! But, my experience talking to interested parties has mainly found that a switch to LSP will not actually fix any of their problems; this work boils down to tsserver talking in terms of different JSON blobs. It likely will not enable any new functionality, nor is it likely to change tsserver's performance characteristics, cancellation semantics, ability to use a VFS, etc.

@dcousens
Copy link

dcousens commented Jan 23, 2025

Talking for myself, I don't want to use a third party intermediary translation layer (or proxy) for my editor to support tsserver when LSP is supported natively by my editor.

@halfnibble
Copy link

I'm using Nova, which also support LSP (but not tsserver). :(

@polyzen
Copy link

polyzen commented Jan 23, 2025

It would free the maintainers of typescript-language-server from having to maintain the proxy, free downstream from having to maintain packages of the proxy, and users would not have to find a way to install the proxy when they already have typescript installed.

@0xdevalias
Copy link

This might be a naive question to ask, and it might not be something the project wants to take on, but would it make sense for typescript to basically embed one of the LSP proxy translation layers for the time being, and then be able to slowly switch out the underlying calls from proxied -> native as that work gets completed?

@DonnieWest
Copy link

DonnieWest commented Jan 23, 2025

this work boils down to tsserver talking in terms of different JSON blobs. It likely will not enable any new functionality

The different JSON blobs actually matters a lot. Most of the ecosystem tooling has converged around the LSP spec and provided LSP specific tools to make for an excellent editing experience. tsserver not speaking that spec now requires an entire extra ecosystem of tools around tsserver to make it interact with those editors directly.

Which is a bit funny, considering that's exactly the reason Microsoft created the LSP spec to begin with. It's odd that this Microsoft project would wonder what providing an LSP implementation would actually help with 😉

typescript-language-server helps with that gap, but there's issues with that

  • It's not nearly as performant as having this built in
  • It hasn't actually collapsed the number of competing tooling and related maintenance costs. In Neovim, there's at least 3 ways to set up completion support (vstls, typescript-tools, typescript-language-server)
  • New users getting this set up now have added cognitive load of getting started

In short, I think the benefits are actually pretty clear and at the core of why Microsoft created the LSP specification to begin with

Edit: Follow up

But, my experience talking to interested parties has mainly found that a switch to LSP will not actually fix any of their problems

I'd suggest that the mere existence of typescript-language-server and related tools demonstrate outside parties attempting to solve problems that aren't being acknowledged here. Perhaps speak to the maintainers and users of those tools?

@jakebailey
Copy link
Member

jakebailey commented Jan 23, 2025

I don't want to use a third party intermediary translation layer (or proxy)

It would free the maintainers of typescript-language-server from having to maintain the proxy, free downstream from having to maintain packages of the proxy, and users would not have to find a way to install the proxy when they already have typescript installed.

The different JSON blobs actually matters a lot.

I'd suggest that the mere existence of typescript-language-server and related tools demonstrate outside parties attempting to solve problems that aren't being acknowledged here.

I understand the interop rationale fully (I've worked on three LSP servers before joining the TypeScript team!), so it does not surprise me that everyone's reply is "because interop" or "to not have to have a wrapper". There have been other threads where people have implied that LSP would enable features that it actually wouldn't (e.g. virtual workspaces, embedded languages), so I mainly just wanted to set expectations about how I am personally thinking.

would it make sense for typescript to basically embed one of the LSP proxy translation layers for the time being

This turns into a licensing/CLA question, among other implementation/design constraints.

Which is a bit funny, considering that's exactly the reason Microsoft created the LSP spec to begin with. It's odd that this Microsoft project would wonder what providing an LSP implementation would actually help with

The tsserver protocol predates LSP (and in some ways inspired it), and until recently had some critical tricks that LSP did not have (e.g. pull-ish diagnostics, which are still not implemented in many editors, but are effectively required for editors like VS; TS doesn't have push diagnostics exactly like LSP wants, either). I'm not "pondering" per se; just trying to read the room and again set expectations.

@DonnieWest
Copy link

I understand the interop rationale fully (I've worked on three LSP servers before joining the TypeScript team!), so it does not surprise me that everyone's reply is "because interop" or "to not have to have a wrapper".

Right. We know you know. That's why my reply was a bit on the nose - the entire point for us is having a well maintained LSP provider and that's why many of us work on the tsserver wrappers. We understand what LSP support entails here 🤷

@gshpychka
Copy link

gshpychka commented Jan 24, 2025

The main question I have for you is "why do you want LSP?" What specific problem are you looking to solve by having it implemented?

You can ask "Why does the LSP exist?" and the answer(s) will also apply to your question.

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