mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
nvim/lsp: add an usercommand to toggle inlay hints
This commit is contained in:
parent
d3a439f324
commit
10c8aa854d
1 changed files with 8 additions and 0 deletions
|
|
@ -28,12 +28,20 @@ M.on_attach = function(client, bufnr)
|
|||
nnoremap("<leader>r", vim.lsp.buf.rename, "rename symbol")
|
||||
pcall(nnoremap, "<leader>f", function() vim.lsp.buf.format { async = true } end, "format buffer", { unique = true })
|
||||
|
||||
vim.api.nvim_buf_create_user_command(
|
||||
bufnr,
|
||||
"LspToggleInlayHints",
|
||||
function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end,
|
||||
{}
|
||||
)
|
||||
local filetype = vim.api.nvim_get_option_value("filetype", { buf = bufnr })
|
||||
if
|
||||
client:supports_method(methods.textDocument_inlayHint)
|
||||
-- Never start cabal with inlay hint request
|
||||
-- Related: https://github.com/mrcjkb/haskell-tools.nvim/discussions/485
|
||||
and filetype ~= "cabal"
|
||||
-- I find it annoying especially with qmk
|
||||
and filetype ~= "c"
|
||||
then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue