From cdc5c228f4948fc940bab0ec7a41f82c763f255e Mon Sep 17 00:00:00 2001 From: aceforeverd Date: Sun, 21 Apr 2024 22:35:54 +0800 Subject: [PATCH] fix: inlay hints confuse for clangd --- lua/aceforeverd/lsp/servers.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lua/aceforeverd/lsp/servers.lua b/lua/aceforeverd/lsp/servers.lua index 14c6603..2e70e2e 100644 --- a/lua/aceforeverd/lsp/servers.lua +++ b/lua/aceforeverd/lsp/servers.lua @@ -88,13 +88,13 @@ return { ) vim.keymap.set( 'n', - 'av', + 'av', 'vClangdSwitchSourceHeader', { noremap = true, silent = true, buffer = bufnr, desc = 'switch source (vsplit)' } ) vim.keymap.set( 'n', - 'as', + 'as', 'sClangdSwitchSourceHeader', { noremap = true, silent = true, buffer = bufnr, desc = 'switch source (split)' } ) @@ -105,7 +105,15 @@ return { { noremap = true, silent = true, buffer = bufnr, desc = 'toggle inlay hints' } ) - require("clangd_extensions.inlay_hints").setup_autocmd() + vim.keymap.set( + 'n', + 'al', + 'ClangdSetInlayHints', + { noremap = true, silent = true, buffer = bufnr, desc = 'refresh inlay hints' } + ) + + -- inlay hints autocmd get confused with :ClangdToggleInlayHints, a workaround is toggle manually + -- require("clangd_extensions.inlay_hints").setup_autocmd() require("clangd_extensions.inlay_hints").set_inlay_hints() -- use lsp-status only for clangd