-
Notifications
You must be signed in to change notification settings - Fork 262
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
workspace: Make didChangeConfiguration use its parameter #973
base: master
Are you sure you want to change the base?
workspace: Make didChangeConfiguration use its parameter #973
Conversation
Do you have a language client that needs this? |
eglot (the Emacs' builtin LSP client) does. It is far better compared to restarting ccls when doing a git rebase or switching between builds. And it's the last point I have to solve to switch my Emacs config from lsp-mode to eglot :) Thx for all you work on ccls. |
db890d4
to
cc13ced
Compare
It seems your are waiting for a more rationale reason. Here I go: I looked at 3 editors to see how they handle the LSP client part. First, vscode (obviously) relies on Second, neovim expects to configure the LSP server with a Last, Emacs (which has 2 LSP clients). The one I want to use (eglot) expects to send LSP server configuration through The other client I want to move from (lsp-mode) is design to rely on Then I looked at some LSP servers code. All those with support for Clangd can handle configuration through So, we have 4 LSP clients expecting the servers (independently of the programming language) will read their configuration from So, my PR aims to bring ccls hot-reconfiguration support to any editor which does not have the kill'n'start that vscode-ccls and emacs-ccls have. Obviously, updating files or symbolic links at the project's root is not really a durable solution as it implies to add unnecessary complexity inside or outside of the editors. Best regards |
to update the configuration settings.
6c3047b
to
e55cc68
Compare
Thanks for the explanation.
Can you point me to the restart code in the 2 clients? What operations did you do to trigger restart? When does neovim send didChangeConfiguration? |
In vscode-ccls, look at For Emacs with emacs-ccls, the users have to call lsp-mode's function With my PR merged, emacs-ccls should simply use lsp-mode's function
As stated just above, the function to call is (progn (setq ccls-initialization-options
`(:compilationDatabaseDirectory ,current-build-dir))
(lsp-restart-workspace))
It happens in if next(self.settings) then
self:notify(ms.workspace_didChangeConfiguration, { settings = self.settings })
end As I never programmed in lua and don't use neovim, I don't know how to consider the file Best regards |
I realized that my PR is missing an important point: if a workspace is reindexed, the diagnostic of any of its working files should be updated and sent to the client. As I don't know how github will handle a new commit after the one you added in the PR, here is a commit (from a testing branch): rherilier@458e0e4 So, if you are fine with these changes, do you mind if I merge your changes on my side before doing a force-pushed with the aforementioned changes in a second commit? Or all in one commit if your prefer. |
Feel free to force push to this PR and drop my commit after the change is merged into yours. I don't mind:) I am still not clear why the client sends didChangeConfiguration. Is that because you have a hook that changes initialization options only after initialize? Why? With the new didChangeConfiguration,
I have seen
If we do change |
Doh! I just notice there is another big issue: the index stops working unless the LSP client sent a |
thx
Your guess is right: I make my Emacs config send a
It can be needed too while rebasing or bissecting.
But it gives me an hint to investigate the issue from my previous message. thx twice ;)
The commit neovim/neovim@d5c489c seems to imply there are LSP servers which does/did not read the configuration from the
the lone way to know if it is redundant or not is to compare the outputs of
I'll fix it! Best regards |
Can you tell me why a cache is not automatically updated by As this function is quite complex, I'm not sure where to trigger the update of all invalid caches... Do you have an idea? And the commit from my test branch is completely irrelevant regarding to the non-updated invalid cache entries. Best regards |
EDIT: Doh! I forget cache entries are not accessible in I forgot my proposal to trigger the invalid caches update:
diff --git a/src/messages/workspace.cc b/src/messages/workspace.cc
index 2e58fe9e..61cbac01 100644
--- a/src/messages/workspace.cc
+++ b/src/messages/workspace.cc
@@ -48,6 +48,9 @@ void MessageHandler::workspace_didChangeConfiguration(JsonReader &reader) {
project->load(folder);
project->index(wfiles, RequestId());
+ for (auto &[folder, _] : g_config->workspaceFolders)
+ manager->updateInvalidCaches(folder);
+
manager->clear();
} |
Hi,
Here is a patch to make
workspace/didChangeConfiguration
capable of changing the configuration settings as describe in the LSP spec.any comment/feed-back are welcome