From 1983c70d109eaaff97c998035b8f5ed19e2fcff9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 26 Feb 2026 02:04:31 +0800 Subject: [PATCH] test(lsp): flaky lsp/semantic_tokens_spec #38063 The wait added in #37853 doesn't seem to do anything as request is sent immediately on InsertLeave, and the number 4 also seems wrong. Instead, the actual cause for the flakiness that the feed() (and hence the buffer change) may arrive before the scheduled initialization of capabilities, causing there be only only one textDocument/semanticTokens/full request instead of two. --- test/functional/plugin/lsp/semantic_tokens_spec.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/functional/plugin/lsp/semantic_tokens_spec.lua b/test/functional/plugin/lsp/semantic_tokens_spec.lua index 7523472cc7..92e00a8888 100644 --- a/test/functional/plugin/lsp/semantic_tokens_spec.lua +++ b/test/functional/plugin/lsp/semantic_tokens_spec.lua @@ -307,15 +307,12 @@ describe('semantic token highlighting', function() return vim.lsp.start({ name = 'dummy', cmd = _G.server_full.cmd }) end) + -- ensure initial semantic token requests have been sent before feeding input + n.poke_eventloop() -- modify the buffer feed('o') - local messages = exec_lua(function() - vim.wait(1000, function() - return #_G.server_full.messages >= 4 - end) - return _G.server_full.messages - end) + local messages = exec_lua('return _G.server_full.messages') local called_full = 0 local called_range = 0 for _, m in ipairs(messages) do