-
Notifications
You must be signed in to change notification settings - Fork 45
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
Static capabilities #15
Comments
Yep, I've been mulling over this myself! That said, I haven't run into any situations so far (since 10 days ago at least) where I've regretted dynamic registration for performance reasons, and it's resulted in some pretty clean code (or at least as clean as I can make it with the pygls interface). This topic is actually part of an ongoing conversation in pygls: openlawlibrary/pygls#112 |
But will you ever de-register as completionProvider during the lifetime of the server? |
I doubt I will! This is definitely something I'm happy to add the the roadmap. I'll also prioritize it immediately if we notice sluggish server start times, or if it's clearly demonstrated that moving some things to static configuration simplifies the code. If you have any ideas regarding implementation, I'm all ears! |
The start up time doesn't matter that much to me :) One thing you can do to make this much more performant is to collect all your registrations and send them in one big list with a single request, instead of one request per capability. |
Thank you @pappasam for implementing this! The implementation seems much cleaner than pyls to me. I am trying to use the server in Emacs with lsp-mode and dynamic registration of capabilities seems to cause issues. The client seems to permit dynamic registration of only certain capabilities. As I am not familiar with the LSP specification, I can open up an issue to discuss it there. After moving completion registration to initialize response like this, completetion starts working for me. I didn't test all of the capabilities, as I can use a previous version of the server with static capabilities for now. |
@harismandal I'm trying to enable end-users to configure things like "triggerCharacters". See this issue, which is still an active discussion on pygls: openlawlibrary/pygls#112 I'm hoping a resolution will be as simple as moving logic from INITIALIZED to INITIALIZE. I'm working on adding a feature today and will look into this once that's merged |
If all you want to do is to let users decide what the trigger chars are, then you can use initializationOptions. These are passed in the IMO letting the user decide what the trigger chars are is bad anyway. The completion trigger char is |
@rwols completion characters are somewhat complicated by jedi's dictionary key completion support. I add additional completion characters That said, can you please test out the latest version |
The trigger chars are a broken part of the LSP spec. Language servers should not be bothered by this and just provide their maximum amount of trigger chars. For instance: if your language server was also capable of handling Lua files, you would be forced to advertise Not showing the auto-complete widget in certain scenarios is a job for editors, not language servers. |
In the case of SublimeText, we would have to adjust the |
They are not sent in the initialize response for me.
|
Maybe you can do something like this? |
@harismandal I'll give that a try! |
Now the only dynamic configurations are for diagnostics. Aims to resolve #15
Can you try version 0.12.0 and let me know if this issue is resolved? |
Yes, it's working great for me now. Thanks for fixing this! I'll try to create a PR in lsp-mode for emacs mentioning the server and adding the configurations. |
Just for the sake of it, here are all capabilities being sent during initialization:
|
The |
@rwols done |
I don't quite understand why this language server needs to register all of its capabilities dynamically:
Wouldn't it be easier to put all this stuff in the
initialize
response?The text was updated successfully, but these errors were encountered: