-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Provide log messages for the native server #12523
Comments
In addition to the log messages, it's also important for us to determine how to send these log messages to the client. Currently, all tracing logs are sent to stderr unless diverted by using the |
There was some internal discussion around using |
## Summary This pull request adds support for logging via `$/logTrace` RPC messages. It also enables that code path for when a client is Zed editor or VS Code (as there's no way for us to generically tell whether a client prefers `$/logTrace` over stderr. Related to: #12523 ## Test Plan I've built Ruff from this branch and tested it manually with Zed. --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
I think this is becoming more relevant because currently the user experience around viewing log messages isn't automatic. Currently, the default value of the ruff/crates/ruff_server/src/server/api.rs Lines 61 to 64 in a4ebe7d
Here, the client will display the notification with the message as in The differentiating factor is that which messages should always be logged ( |
Yeah. This doesn't seem like a good default. I think the default should be |
Do you mean the default trace value should be "messages"? The default value for the log level is Regardless, if we update the default trace value to be "messages", the output channel in the VS Code will be filled with the request - response cycle messages like:
We could have a separate output channel for the trace messages (similar to rust-analyzer) but that would also include the trace messages from the Ruff server. This is why we should also consider using |
Hmm. I would need to take a closer look at how our tracing setup works. Ideally, we would show info, warning, and error messages ( |
Hi there, newcomer to NeoVim here. After installing https://github.com/ray-x/navigator.lua, I started getting the generic error message quoted above: Nothing appears to be broken in functionality, it only Is there any way I can dig deeper into where this message is coming from? I already enabled the debug logging options as per #14959 (comment), even with a custom |
I think what I've suggested should provide some insights into why this is failing. Can you provide the initialization options that you're passing to the Ruff language server in Neovim? |
@dhruvmanila I'm currently passing the following options: require('lspconfig').ruff.setup {
on_attach = on_attach,
trace = 'verbose',
init_options = {
settings = {
args = {},
logLevel = 'debug',
logFile = '/home/mpsijm/ruff.log',
}
}
} Collapsing the `on_attach` function because I don't think it's relevant (but sharing it anyway just in case):local on_attach = function(client, _)
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, {})
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, {})
vim.keymap.set('n', ']g', vim.diagnostic.goto_next)
vim.keymap.set('n', '[g', vim.diagnostic.goto_prev)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {})
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, {})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
vim.keymap.set('n', '<C-Q>', vim.lsp.buf.hover, {})
-- Source: https://www.reddit.com/r/neovim/comments/10a31vo/how_does_vimlspbufformat_deal_with_multiple/
vim.keymap.set('n', '<leader>l', function()
vim.lsp.buf.format {
async = true,
filter = function()
return client.name ~= 'ruff_lsp'
end
}
end, {})
if client.name == 'ruff_lsp' then
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end
end |
That looks like it should work, it does for me:
(You don't need to pass the Are you getting nothing in You can also try removing the |
Thanks, I removed The file However, I've now found that I also had to call The messages I'm getting are:
Where I think the most important bit is in the second line:
I found https://www.reddit.com/r/neovim/comments/1g6cs0s/comment/lsmc40n/ who gets the same error, also caused by the Navigator plugin. Sounds like Navigator is trying to call the Ruff language server with incomplete arguments, which I'll pick up in their GitHub repo. If you happen to know from the top of your head where they could look to fix this, please share 🙂 Thanks for your help! ❤ |
Thanks, it seems that the plugin isn't passing in the |
Should we close this and add more logs as we make changes to the LSP? |
There aren't many log messages emitted by the server which can help in debugging. It would be quite useful to provide some more log messages at info / debug / trace levels.
Note that these log messages shouldn't include the request response messages because that's taken care by the editor. It should be specific to the server logic.
The text was updated successfully, but these errors were encountered: