Comments (10)
@haeck98 Sure, thank you.
from codemirror-languageserver.
@haeck98 In the meantime I have added preliminary support for reusing the LSP client across multiple plugin instances.
from codemirror-languageserver.
As I understand this is not yet supported. I had a quick look into the source code and had the following idea:
Maybe the languageServer()
function could accept an optional client instance, which it uses to send further requests. This way it would be possible to create a client instance beforehand and share it between multiple Editors. By creating the client instance it sends the 'initialize'
-Request and the LanguageServerPlugin then just sends the 'textDocument/didOpen'
-Request via the client it receives. If you do not set a client instance for languageServer()
call, it just creates a new one, like it is already doing right now.
Would You be open to integrate this feature into the library? Since I need this functionality, I'm willing to contribute to this project and implement the feature I described above.
from codemirror-languageserver.
@haeck98 Is this something the Language Server Protocol even supports?
- microsoft/language-server-protocol#23
- "The protocol currently assumes that one server serves one tool." https://microsoft.github.io/language-server-protocol/specifications/specification-current/#language-server-protocol
Sorry if I am missing something obvious.
If we are going to allow a client to be passed to the plugin's constructor, we will also have to do the same for transport. Since it is used here:
codemirror-languageserver/src/index.ts
Line 107 in 283b946
from codemirror-languageserver.
Hi thanks for your response @hjr265 !
"The protocol currently assumes that one server serves one tool."
As far as I understand, this only refers to the number of connections between a client and a server. One Server can only serve one client. BUT one client can get notifications and send requests for multiple open files. For example consider the following order of notifications and requests a single LSP Client can send to the server:
- request "initialize"
- notify "textDocument/didOpen" for
./src/file1.ts
- notify "textDocument/didOpen" for
./src/file2.ts
- notify "textDocument/didOpen" for
./src/file3.ts
Now the client can retrieve information for these three files, e.g. diagnostics, completions, hover, etc..
Knowing this, I propose to strictly separate the LSP client from the LanguageServerPlugin.
I actually started implementing my own library for LSP support in CodeMirror 6, since I actually needed some other features, which are also not implemented here. However, if you are interested I can explain how I managed to share one LSP Client with multiple CodeMirror Editors. But since I already implemented it in my own library, feel free to close the issue.
from codemirror-languageserver.
As far as I undestand, this is issue is about connecting multiple clients to a single language server instance, e.g. opening multiple web socket connections to a server which all communicate with one single language server process. This is not possible. However, what I requested was the possiblity to open a single websocket connection and share this single connections between multiple open CodeMirror Editors in a website. The current implementation will open a web socket connection for every open editor in a website and therefor, since one language server can only server one client, requires a separate language server process for every editor in a website.
from codemirror-languageserver.
@haeck98 I see what you mean.
Yeah, this is a current limitation of this implementation.
I will eventually have to add support for this as well once I start dealing with multiple co-existing CodeMirror instances at the same time in my project.
from codemirror-languageserver.
@hjr265 When my implementation is in a stable state, I will make it publicly available and also publish to npm. If you want, I can share the repository in here, when it is public.
from codemirror-languageserver.
Hello, may I ask this package has been released?
from codemirror-languageserver.
@panchaoco Do you mean with the support for reusing LSP clients? Yes.
https://www.npmjs.com/package/codemirror-languageserver
from codemirror-languageserver.
Related Issues (20)
- [enhancement] Transport Agnostic HOT 2
- Wrong types HOT 1
- Codemirror not recognizing returned extensions and throwing "Unrecognized extension value in extension set" HOT 15
- Module loader error
- Better tooltips
- How would you configure this if you don't have a server? HOT 7
- Waiting for reply of `initialized` before continuing HOT 1
- Feature Request: Support code snippets
- Can't integrate with sveltekit HOT 2
- Anyway to make the lsp project aware?
- Is the autocompletion provided by the language server reconfigurable?
- "Events" error HOT 2
- Is there any plan to make it fully support LSP? (jump to def, find references, symbol search)
- Issue with dependencies;
- What is the proper way to import with Rollup? HOT 2
- how to connect to tcp instead of web socket? HOT 1
- got "SyntaxError: Cannot use import statement outside a module" when running HOT 2
- How does filename work? HOT 4
- Lua language server not working: `Loading workspace (0/0)` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codemirror-languageserver.