From bec242dfa7fce45335d39e8a092f284572ca6bbf Mon Sep 17 00:00:00 2001 From: bhagwan Date: Sat, 4 May 2024 05:36:58 -0700 Subject: [PATCH] fix(lsp_code_actions): previewer when `ff=dos` (closes #1172) --- lua/fzf-lua/previewer/codeaction.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/fzf-lua/previewer/codeaction.lua b/lua/fzf-lua/previewer/codeaction.lua index 5735ec01..62c07acc 100644 --- a/lua/fzf-lua/previewer/codeaction.lua +++ b/lua/fzf-lua/previewer/codeaction.lua @@ -37,7 +37,9 @@ local function diff_text_edits(text_edits, bufnr, offset_encoding, diff_opts) table.concat(orig_lines, eol) .. eol, table.concat(new_lines, eol) .. eol, diff_opts) - return utils.strsplit(vim.trim(diff), eol) + -- Windows: some LSPs use "\n" for EOL (e.g clangd) + -- remove both "\n" and "\r\n" (#1172) + return utils.strsplit(vim.trim(diff), "\r?\n") end -- based on `vim.lsp.util.apply_text_document_edit`