feat(nvim): improve inlay hint startup
Rust analyzer seems to be one of the few lsp servers which needs a small timeout for inlay hints to show up correctly. All other servers get their inlay hints activated without delay.
This commit is contained in:
parent
d6b95fdef6
commit
403d88f161
1 changed files with 8 additions and 1 deletions
|
@ -107,9 +107,13 @@ local on_attach_def = function(client, bufnr)
|
||||||
}, { buffer = bufnr, silent = true })
|
}, { buffer = bufnr, silent = true })
|
||||||
|
|
||||||
if client.server_capabilities.inlayHintProvider then
|
if client.server_capabilities.inlayHintProvider then
|
||||||
|
local slow_lsp_servers = {
|
||||||
|
"rust_analyzer",
|
||||||
|
}
|
||||||
|
local timeout = vim.tbl_contains(slow_lsp_servers, client.name, {}) and 500 or 0
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
vim.lsp.inlay_hint(bufnr, true)
|
vim.lsp.inlay_hint(bufnr, true)
|
||||||
end, 1000)
|
end, timeout)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -173,6 +177,9 @@ lspconfig_setup("lua_ls", {
|
||||||
format = {
|
format = {
|
||||||
enable = false,
|
enable = false,
|
||||||
},
|
},
|
||||||
|
hint = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue