-
-
Notifications
You must be signed in to change notification settings - Fork 157
lsp.commands not showing up anymore (e.g RustSetInlayHints) #114
Comments
This seems to be related to |
I just got this issue as well, did you manage to figure it out? |
I disabled |
Hm, I don't use any of them directly or indirectly as far as I know, so for me at least neither of those are the root causes. |
Do you use lsp installer of some sorts? |
Seems the upgrade to neovim 0.6.1 fixed the issue for me, I can't reproduce it anymore. |
I'm not really sure why this happens with nvim lsp installer, but @Leandros is it fixed with 6.1? else i'll look into it again |
I' m on the version 0.6.1 and it's not fixed if server.name == "rust_analyzer" then
local rustopts = {
tools = { -- rust-tools options
-- Automatically set inlay hints (type hints)
autoSetHints = true,
-- Whether to show hover actions inside the hover window
-- This overrides the default hover handler
hover_with_actions = true,
-- how to execute terminal commands
-- options right now: termopen / quickfix
executor = require("rust-tools/executors").termopen,
runnables = {
-- whether to use telescope for selection menu or not
use_telescope = true,
-- rest of the opts are forwarded to telescope
},
debuggables = {
-- whether to use telescope for selection menu or not
use_telescope = true,
-- rest of the opts are forwarded to telescope
},
-- These apply to the default RustSetInlayHints command
inlay_hints = {
-- Only show inlay hints for the current line
only_current_line = false,
-- Event which triggers a refersh of the inlay hints.
-- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
-- not that this may cause higher CPU usage.
-- This option is only respected when only_current_line and
-- autoSetHints both are true.
only_current_line_autocmd = "CursorHold",
-- wheter to show parameter hints with the inlay hints or not
show_parameter_hints = true,
-- prefix for parameter hints
parameter_hints_prefix = "<- ",
-- prefix for all the other hints (type, chaining)
other_hints_prefix = "=> ",
-- whether to align to the length of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = false,
-- padding from the right if right_align is true
right_align_padding = 7,
-- The color of the hints
highlight = "Comment",
},
hover_actions = {
-- the border that is used for the hover window
-- see vim.api.nvim_open_win()
border = {
{ "╭", "FloatBorder" },
{ "─", "FloatBorder" },
{ "╮", "FloatBorder" },
{ "│", "FloatBorder" },
{ "╯", "FloatBorder" },
{ "─", "FloatBorder" },
{ "╰", "FloatBorder" },
{ "│", "FloatBorder" },
},
-- whether the hover action window gets automatically focused
auto_focus = false,
},
-- settings for showing the crate graph based on graphviz and the dot
-- command
crate_graph = {
-- Backend used for displaying the graph
-- see: https://graphviz.org/docs/outputs/
-- default: x11
backend = "x11",
-- where to store the output, nil for no output stored (relative
-- path from pwd)
-- default: nil
output = nil,
-- true for all crates.io and external crates, false only the local
-- crates
-- default: true
full = true,
},
},
opts = vim.tbl_deep_extend("force", server:get_default_options(), opts, {
settings = {
["rust-analyzer"] = {
completion = {
postfix = {
enable = true,
},
},
checkOnSave = {
command = "clippy",
},
},
},
}),
}
require("rust-tools").setup(rustopts)
server:attach_buffers()
|
I'm having issue as well. I'm on nvim 0.6.1 and using nvim-lsp-installer with the default rust-tools configuration. Also noticed that inlay hints are enabled by default anymore when opening a rust file. Manually calling |
Sorry i've been very busy so I couldn't get back to it faster. Looks like this happens only with lsp-installer. I'll have to look at its internals a bit so please bear with me. |
It looks like this is happening (for me at least) when my config also calls nvim-lsp-installer's I was relying on the other setup function to pass in my |
@nkhlmn I believe what you need to do is take the on_attach callback you desire, and instead call:
(Assuming your on_attach callback is exported at |
+1 |
Yes, calling lspconfig's rust analyzer's setup overrides rust-tools setup, so please don't do it. This is why there is an if else in the rust-tools setup for nvim-lsp-installer, please see the wiki: https://github.com/williamboman/nvim-lsp-installer/wiki/Rust |
Using
rust-tools.nvim
together withnvim-lsp-installer
.Recently, it stopped working that the inlay hints show up when loading a buffer. Similarly the commands (like
RustSetInlayHints
) have disappeared.I'm using the config which is in the
nvim-lsp-installer
wiki (and I'm aware of #89).Current relevant
.vimrc
is here: https://github.com/Leandros/dotfiles/blob/e3cc5f7660df9f44056cecbcbdf0ccda64159a4f/.vimrc#L166-L231The relevant parts:
Added
on_attach
,on_init
oron_exit
handlers on theserver
property are not called.Opening the files, e.g
src/main.rs
directly via CLI (usingnvim src/main.rs
) works perfectly fine. While using a plugin likeNERDTree
orLeaderF
to open the file doesn't seem to work.VIM Version
OS Version
The text was updated successfully, but these errors were encountered: