-
-
Save PatOConnor43/88156409b03794f5e05280dbfb42faa6 to your computer and use it in GitHub Desktop.
local dart_capabilities = vim.lsp.protocol.make_client_capabilities() | |
dart_capabilities.textDocument.codeAction = { | |
dynamicRegistration = false; | |
codeActionLiteralSupport = { | |
codeActionKind = { | |
valueSet = { | |
"", | |
"quickfix", | |
"refactor", | |
"refactor.extract", | |
"refactor.inline", | |
"refactor.rewrite", | |
"source", | |
"source.organizeImports", | |
}; | |
}; | |
}; | |
} | |
nvim_lsp.dartls.setup({ | |
on_attach = dart_attach; | |
init_options = { | |
onlyAnalyzeProjectsWithOpenFiles = true, | |
suggestFromUnimportedLibraries = false, | |
closingLabels = true, | |
}; | |
capabilities = dart_capabilities; | |
}) |
Hi, thanks for the comment.
I don't know if there was a recent change (like the past couple days) that could have fixed this but I just pulled neovim and rebuilt and updated my plugins as well (probably not necessary for this case 🤷). Everything seems to work though. I would make sure that your server is actually running. You can print your active clients by calling:
:lua print(vim.inspect(vim.lsp.get_active_clients()))
That should print a table of clients. Next, I would check the log file. You can get the path to this file by doing :lua print(vim.lsp.get_log_path())
. Then open that file and see if there were any errors thrown by your language server. Hope that helps!
The language server is running. Except code actions, everything is working fine. I tried setting this:
local dart_capabilities = vim.lsp.protocol.make_client_capabilities()
dart_capabilities.textDocument.codeAction = {
dynamicRegistration = true;
}
Now, I can see code actions. But, only a few of them. Like
1. Sort Members
2. Organize Imports
3. Extract Method
Thanks for the tips. I'll keep debugging
After reinstalling dart, flutter and neovim one by one, I found that it was a problem with the version of neovim I was using. Upgrading that to the latest nightly has fixed the problem. Thanks for the help.
This worked perfectly for me. That is until today. I see this error on
:lua vim.lsp.buf.code_action()
This is the command used to start analysis server:
/opt/dart-sdk/bin/dart /opt/dart-sdk/bin/snapshots/analysis_server.dart.snapshot --lsp
.I did update neovim, flutter and all my plugins. So, not quite sure what broke this. Do you face these issues by any chance?