Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf2ac1e

Browse files
committed
fixup! fix(lsp): when buffer detach remove buffer from client attached buffers
1 parent070ca8f commitdf2ac1e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

‎test/functional/plugin/lsp_spec.lua‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,41 @@ describe('LSP', function()
381381
}
382382
end)
383383

384+
it('should detach buffer on bufwipe',function()
385+
localresult=exec_lua([[
386+
local server = function(dispatchers)
387+
local closing = false
388+
return {
389+
request = function(method, params, callback)
390+
if method == 'initialize' then
391+
callback(nil, { capabilities = {} })
392+
end
393+
end,
394+
notify = function(...)
395+
end,
396+
is_closing = function() return closing end,
397+
terminate = function() closing = true end
398+
}
399+
end
400+
local bufnr = vim.api.nvim_create_buf(false, true)
401+
vim.api.nvim_set_current_buf(bufnr)
402+
local client_id = vim.lsp.start({ name = 'detach-dummy', cmd = server })
403+
assert(client_id, "lsp.start must return client_id")
404+
return { bufnr = bufnr, client_id = client_id }
405+
]])
406+
eq(true,result~=nil,"exec_lua must return result with client_id and bufnr")
407+
localis_attached,num_attached_before,num_attached_after=unpack(exec_lua([[
408+
local bufnr, client_id = ...
409+
local client = lsp.get_client_by_id(client_id)
410+
local count_before = vim.tbl_count(client.attached_buffers)
411+
vim.api.nvim_buf_delete(bufnr, { force = true })
412+
return { lsp.buf_is_attached(bufnr, client_id), count_before, vim.tbl_count(client.attached_buffers) }
413+
]],result.bufnr,result.client_id))
414+
eq(false,is_attached)
415+
eq(1,num_attached_before)
416+
eq(0,num_attached_after)
417+
end)
418+
384419
it('should fire autocommands on attach and detach',function()
385420
localclient
386421
test_rpc_server {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp