From 2f6d1d3c887a87d9402137425b418dd12a904aac Mon Sep 17 00:00:00 2001 From: francisco souza <108725+fsouza@users.noreply.github.com> Date: Tue, 23 Jun 2020 11:50:37 -0400 Subject: lsp: when apply text edits, set buflisted on buffers (#12489) The client creates buffers on the fly to be able to apply text edits on files that weren't previously open, which is great, but it uses the bufadd() function, which creates unlisted buffers and can lead to a weird experience in the text editor. Setting the buffer to buflisted fixes this. Closes #12488. Co-authored-by: francisco souza --- runtime/lua/vim/lsp/util.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/lsp') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 71ca1048e1..0f366c2b57 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -119,6 +119,7 @@ function M.apply_text_edits(text_edits, bufnr) if not api.nvim_buf_is_loaded(bufnr) then vim.fn.bufload(bufnr) end + api.nvim_buf_set_option(bufnr, 'buflisted', true) local start_line, finish_line = math.huge, -1 local cleaned = {} for i, e in ipairs(text_edits) do -- cgit