Skip to content

Commit

Permalink
fixup! refactor(lsp): replace util.buf_versions with changedtick
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed May 23, 2024
1 parent 289d52a commit 077daeb
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions test/functional/plugin/lsp/semantic_tokens_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,14 @@ describe('semantic token highlighting', function()
end)

it('buffer is highlighted when attached', function()
insert(text)
exec_lua([[
bufnr = vim.api.nvim_get_current_buf()
vim.api.nvim_win_set_buf(0, bufnr)
vim.bo[bufnr].filetype = 'some-filetype'
client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd })
]])

insert(text)

screen:expect {
grid = [[
#include <iostream> |
Expand All @@ -141,6 +140,7 @@ describe('semantic token highlighting', function()
end)

it('use LspTokenUpdate and highlight_token', function()
insert(text)
exec_lua([[
vim.api.nvim_create_autocmd("LspTokenUpdate", {
callback = function(args)
Expand All @@ -157,8 +157,6 @@ describe('semantic token highlighting', function()
client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd })
]])

insert(text)

screen:expect {
grid = [[
#include <iostream> |
Expand All @@ -180,14 +178,18 @@ describe('semantic token highlighting', function()
end)

it('buffer is unhighlighted when client is detached', function()

insert(text)

exec_lua([[
bufnr = vim.api.nvim_get_current_buf()
vim.api.nvim_win_set_buf(0, bufnr)
client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd })
vim.wait(1000, function()
return #server.messages > 1
end)
]])

insert(text)

exec_lua([[
vim.notify = function() end
vim.lsp.buf_detach_client(bufnr, client_id)
Expand Down Expand Up @@ -331,14 +333,13 @@ describe('semantic token highlighting', function()
end)

it('buffer is re-highlighted when force refreshed', function()
insert(text)
exec_lua([[
bufnr = vim.api.nvim_get_current_buf()
vim.api.nvim_win_set_buf(0, bufnr)
client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd })
]])

insert(text)

screen:expect {
grid = [[
#include <iostream> |
Expand Down Expand Up @@ -412,13 +413,15 @@ describe('semantic token highlighting', function()
end)

it('updates highlights with delta request on buffer change', function()

insert(text)

exec_lua([[
bufnr = vim.api.nvim_get_current_buf()
vim.api.nvim_win_set_buf(0, bufnr)
client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd })
]])

insert(text)
screen:expect {
grid = [[
#include <iostream> |
Expand Down Expand Up @@ -597,6 +600,7 @@ describe('semantic token highlighting', function()
end)

it('does not send delta requests if not supported by server', function()
insert(text)
exec_lua(
[[
local legend, response, edit_response = ...
Expand Down Expand Up @@ -625,7 +629,6 @@ describe('semantic token highlighting', function()
edit_response
)

insert(text)
screen:expect {
grid = [[
#include <iostream> |
Expand Down Expand Up @@ -1449,6 +1452,7 @@ int main()
},
}) do
it(test.it, function()
insert(test.text1)
exec_lua(create_server_definition)
exec_lua(
[[
Expand Down Expand Up @@ -1485,7 +1489,6 @@ int main()
test.response2
)

insert(test.text1)

test.expected_screen1()

Expand Down

0 comments on commit 077daeb

Please sign in to comment.