nvim --version: v0.5.0-445-gca02db1f9 :checkhealth result:health#nvim_lsp#check
========================================================================
## Checking language server protocol configuration
- INFO: clangd: configuration checked.
- INFO: als: configuration checked.
- INFO: tsserver: configuration checked.
$TERM: xterm-kitty/tmp/a.gpr, /tmp/b.gpr and /tmp/a.adb:LspInstall alslocal options = {}
options["ada.projectFile"] = "a.gpr"
require("nvim_lsp").als.setup{ init_options = options }
/tmp/a.adbThe Ada language server will throw the following error and ask you to press enter:
LSP[als] More than one .gpr found.
Note: you can configure a project through the ada.projectFile setting.
The error and the Press Enter prompt will appear on each modification applied to the file.
There are two things that I would like to see.
First, if an error message has already been displayed to the user with a Press enter prompt, it should not ask for the user to press enter again. This can be achieved by forcing a :redraw after displaying the message a second time (or maybe just not displaying the message again?).
Second, I would expect the Ada Language Server to be able to detect the ada.projectFile setting I've set with init_options. I believe the ada.projectFile setting is an InitializationOption because the Ada Language Server provides an example showing how to configure this setting with LanguageClient-Neovim. LanguageClient-Neovim reads the settings and sends them as initializationOptions.
Actually, it looks like this the setting I'm trying to set isn't an InitializationOption:
https://github.com/AdaCore/ada_language_server/blob/01808399b01849b83367722f0fa1ff6aaac5781a/source/protocol/lsp-messages.ads#L3194
It looks like it is instead transmitted with a DidChangeConfiguration notification:
https://github.com/AdaCore/ada_language_server/blob/2215d7ac15473296b7da31f7e349598d0a6a9b01/source/ada/lsp-ada_handlers.adb#L2383
Not sure how to send these with nvim's lsp.
Hm, maybe in the on_attach callback? I didn't look closely, but that might be a good place to start.
Nvim-lsp already sends didChangeConfiguration notifications:
https://github.com/neovim/nvim-lsp/blob/68873604e1cbadf784e864c4ff08ff1735ca9be2/lua/nvim_lsp/configs.lua#L125
You just need to set the settings key instead of init_options. So this should work:
require("nvim_lsp").als.setup{ settings = { ["ada.projectFile"] = "a.gpr" } }
But it doesn't.
Adding
print(vim.inspect(encoded))
Right before this line:
https://github.com/neovim/neovim/blob/6c9a5743a0c296e74a48368a65783b9d49e6f702/runtime/lua/vim/lsp/rpc.lua#L272
Results in the following message being printed:
'{"method": "workspace/didChangeConfiguration", "jsonrpc": "2.0", "params": {"settings": {"ada.projectFile": "a.gpr"}}}'
Which should be exactly what the ALS is expecting, if I understand everything correctly.
Ah reading the Ada Language Server's source code, settings should actually be { ada = { projectFile = "a.gpr" } }! LanguageClient-Neovim's config file is weird.
I guess the only remaining issue I have with nvim-lsp is the blocking errors that spawn on every keystroke then :).
if an error message has already been displayed to the user with a
Press enterprompt, it should not ask for the user to press enter again. This can be achieved by forcing a:redrawafter displaying the message a second time (or maybe just not displaying the message again?).
馃憤 definitely in favor of that, need to track down the code doing that echo...