Currently Dart Code contains a lot of code that maps from the analysis server API into the VS Code API. Since VS Code's APIs are specific to Code, this code is very specific and not re-usable. If we pushed this code into an LSP implementation then it could be shared by other editors that implement LSP (for example, Visual Studio has preview support for it).
To consume LSP in VS Code you create an extension as normal and then use the vscode-languageclient package to create an adapter for VS Code to use to communicate with your server. The client can spawn the process or be provided with a function that returns a process or a set or input/output streams (see here).
For Dart Code, we would need to be able to communicate with the server for custom requests additional to what the LSP supports which can be done with custom messages.
Note: "The Visual Studio LSP extension can only be installed on the preview channel of Visual Studio. You should not use the preview for production purposes."
To consume LSP in Visual Studio you would create an extension as normal (which currently has the LSP preview extension as a dependency) and then use the Microsoft.VisualStudio.LanguageServer.Client NuGet package to create an adapter for Visual Studio to communicate with your server.
Based on the above, there would need to be a small amount of TypeScript to get VS Code (and a small amount of C# if doing the same in Visual Studio) to connect to an LSP implementation. This code is relatively minor and is just to spawn the server and hand off to the IDE. The IDEs should themselves advertise their capabilities to the server and communicate directly.
There are a number of possible ways to do this:
Also, other IDEs as Atom or Eclipse support the LSP.
If you would offer standard LSP support my team could try to integrate Flutter into the Eclipse IDE. I believe diverse tool support would be very beneficial for the adaption of Flutter.
By the way, there is a natebosch/dart_language_server repository on GitHub maintained by @natebosch. It seems reasonably active.
@rcjsuen Yeah, that's what I've been using for my experiments (I've sent some PRs this week) :-)
Investigation has been done, and I've started on adding LSP to the Dart analysis server. Progress is tracked here:
https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md
I don't think we need this issue any more. The VS Code plugin may move to the LSP protocol in the future once it supports everything we need (either through official requests or custom requests) to avoid spinning up two copies of the server.
Most helpful comment
Also, other IDEs as Atom or Eclipse support the LSP.
If you would offer standard LSP support my team could try to integrate Flutter into the Eclipse IDE. I believe diverse tool support would be very beneficial for the adaption of Flutter.