From 822d96969b6c54d4b26df4a656ec0699bb5d1ada Mon Sep 17 00:00:00 2001 From: jdrouhard Date: Tue, 30 Jun 2026 18:15:54 -0500 Subject: [PATCH] fix(lsp): request semantic tokens in BufWinEnter #40513 Problem: A previous refactor removed the BufWinEnter autocmd that initiated a token request. When an LSP server sends a refresh notification, then buffers that aren't shown in any window lost their only trigger to request new tokens. Solution: Add the BufWinEnter autocmd back which simply requests tokens for all clients attached to the buffer. --- runtime/lua/vim/lsp/semantic_tokens.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua index 57264db127..24f2ccba35 100644 --- a/runtime/lua/vim/lsp/semantic_tokens.lua +++ b/runtime/lua/vim/lsp/semantic_tokens.lua @@ -245,6 +245,14 @@ function STHighlighter:on_attach(client_id) end, }) + api.nvim_create_autocmd('BufWinEnter', { + buf = self.bufnr, + group = self.augroup, + callback = function() + self:send_request() + end, + }) + if state.supports_range then api.nvim_create_autocmd('WinScrolled', { buf = self.bufnr,