-
Notifications
You must be signed in to change notification settings - Fork 19
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
Trying to create a local configuration gives error (Rust project) #42
Comments
It seems like the |
@korken89 Indeed, though it seems that it's only a coroutine for rust-analyzer? (Or at least isn't a coroutine for a few other server configs). I'm not sure if there's some way to dynamically detect if that a lspconfig function is a coroutine or not. This patch fixes the issue, it could be made conditional on diff --git a/lua/nlspsettings/command/init.lua b/lua/nlspsettings/command/init.lua
index 7454afe..1b21972 100644
--- a/lua/nlspsettings/command/init.lua
+++ b/lua/nlspsettings/command/init.lua
@@ -113,7 +113,11 @@ M.open_local_config = function(server_name)
local conf = config.get()
local root_dir
if lspconfig[server_name] then
- root_dir = lspconfig[server_name].get_root_dir(path.sanitize(start_path))
+ local sanitized_start_path = path.sanitize(start_path)
+ local coro = coroutine.wrap(function()
+ return lspconfig[server_name].get_root_dir(sanitized_start_path)
+ end)
+ root_dir = coro()
end
if not root_dir then but I'm not sure if there's a reason why this plugin calls Alternatively there's also |
Hi @Qyriad, thank you for the input! With that said I tried getting the original command to work in a fork: 72921a7 Your idea on using If you have any feedback I'd love to hear it! Edit: I tested your fix here: https://github.com/korken89/nlsp-settings.nvim/tree/fix2 |
Or, I should say it seem to be semi working? The issue I am seeing is that if I set the global config to the same config as I set in the local file, I see different results. If I set the correct config in the global config, this does not happen. I also the the print saying that the LSP configuration has been updated if I do update the local LSP config |
I can also see what is going wrong, with the following config: {
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.extraArgs": ["--bin", "app"]
}
|
Alright, I have gotten close to the root of the issue and I can get the local config to work with a caveat.
This looks like a race to me between my global config and my local config. Here is my global config for reference: https://github.com/korken89/nvim-config/blob/master/after/plugin/lspconfig.lua |
Hi ! I facing the same issue, any update on it? |
Hi!
I'm trying to give this plugin a try, but I am getting the following error when running
:LspSettings local rust_analyzer
:My current config is (use default config):
I'm not sure what's going wrong but it seems to be an internal error to the plugin.
Any assistance would be appreciated!
The text was updated successfully, but these errors were encountered: