From 2ba9a7db296a91ce3f32412ef7a9f5954cb6864e Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Wed, 15 Dec 2021 20:21:50 +0100 Subject: [PATCH] Update LSP sync patch. --- 16669.patch | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/16669.patch b/16669.patch index 08c2d84..cb033a6 100644 --- a/16669.patch +++ b/16669.patch @@ -1,19 +1,8 @@ -From 0500ace6e138c3fcbd15b951f6af76a45e80f0ab Mon Sep 17 00:00:00 2001 -From: Rishikesh Vaishnav -Date: Wed, 15 Dec 2021 18:08:10 +0000 -Subject: [PATCH] fix(lsp): general fix/simplification of incremental sync - ---- - runtime/lua/vim/lsp/sync.lua | 125 ++++---- - src/nvim/lua/stdlib.c | 4 +- - .../plugin/lsp/incremental_sync_spec.lua | 275 +++++++++++++++++- - 3 files changed, 332 insertions(+), 72 deletions(-) - diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua -index 5df2a4d144d2..ce3c8c1b2e5d 100644 +index 5df2a4d144d2..8d08d2763bdc 100644 --- a/runtime/lua/vim/lsp/sync.lua +++ b/runtime/lua/vim/lsp/sync.lua -@@ -93,30 +93,35 @@ end +@@ -93,30 +93,38 @@ end -- utf-8 index and either the utf-16, or utf-32 index. ---@param line string the line to index into ---@param byte integer the byte idx @@ -43,9 +32,11 @@ index 5df2a4d144d2..ce3c8c1b2e5d 100644 - if byte == 1 or #line == 0 then - char = byte + ++ -- optimize for first byte case ++ if byte == 1 then ++ char = 1 -- Called in the case of extending an empty line "" -> "a" -- elseif byte == #line + 1 then -+ if byte == #line + 1 then + elseif byte == #line + 1 then char = compute_line_length(line, offset_encoding) + 1 else - -- Modifying line, find the nearest utf codepoint @@ -66,7 +57,7 @@ index 5df2a4d144d2..ce3c8c1b2e5d 100644 return byte, char end -@@ -157,18 +162,7 @@ local function compute_start_range(prev_lines, curr_lines, firstline, lastline, +@@ -157,18 +165,7 @@ local function compute_start_range(prev_lines, curr_lines, firstline, lastline, end -- Convert byte to codepoint if applicable @@ -86,7 +77,7 @@ index 5df2a4d144d2..ce3c8c1b2e5d 100644 -- Return the start difference (shared for new and prev lines) return { line_idx = firstline, byte_idx = byte_idx, char_idx = char_idx } -@@ -209,51 +203,48 @@ local function compute_end_range(prev_lines, curr_lines, start_range, firstline, +@@ -209,51 +206,48 @@ local function compute_end_range(prev_lines, curr_lines, start_range, firstline, local prev_line_length = #prev_line local curr_line_length = #curr_line