From 49756ebc70dcd37eb7465f9cacd5e78803619daa Mon Sep 17 00:00:00 2001 From: Bartłomiej Maryńczak Date: Sun, 30 Mar 2025 17:39:10 +0200 Subject: fix(vim.lsp.inlay_hint): requesting inlay_hints even when disabled #32999 Problem: Nvim needlessly requests inlay_hints even if they are disabled for a given buffer. Solution: Add the missing `enabled` check in `on_refresh`. Rest of the code has this check already so that's the only needed one to fix this. --- runtime/lua/vim/lsp/inlay_hint.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua index ab3a269937..a37fa42aac 100644 --- a/runtime/lua/vim/lsp/inlay_hint.lua +++ b/runtime/lua/vim/lsp/inlay_hint.lua @@ -94,10 +94,10 @@ function M.on_refresh(err, _, ctx) for _, bufnr in ipairs(vim.lsp.get_buffers_by_client_id(ctx.client_id)) do for _, winid in ipairs(api.nvim_list_wins()) do if api.nvim_win_get_buf(winid) == bufnr then - if bufstates[bufnr] then + if bufstates[bufnr] and bufstates[bufnr].enabled then bufstates[bufnr].applied = {} + util._refresh(ms.textDocument_inlayHint, { bufnr = bufnr }) end - util._refresh(ms.textDocument_inlayHint, { bufnr = bufnr }) end end end -- cgit