mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2026-06-09 15:37:30 +02:00
Fixes vint errors
This commit is contained in:
committed by
Prabir Shrestha
parent
11d408b38c
commit
218e4e5787
@@ -9,7 +9,7 @@
|
||||
function! lsp#utils#diff#compute(old, new) abort
|
||||
let [l:start_line, l:start_char] = s:FirstDifference(a:old, a:new)
|
||||
let [l:end_line, l:end_char] =
|
||||
\ s:LastDifference(a:old[l:start_line:], a:new[l:start_line:], l:start_char)
|
||||
\ s:LastDifference(a:old[l:start_line :], a:new[l:start_line :], l:start_char)
|
||||
|
||||
let l:text = s:ExtractText(a:new, l:start_line, l:start_char, l:end_line, l:end_char)
|
||||
let l:length = s:Length(a:old, l:start_line, l:start_char, l:end_line, l:end_char)
|
||||
@@ -43,7 +43,7 @@ function! s:FirstDifference(old, new) abort
|
||||
let l:length = min([strlen(l:old_line), strlen(l:new_line)])
|
||||
let l:j = 0
|
||||
while l:j < l:length
|
||||
if l:old_line[l:j:l:j] !=# l:new_line[l:j:l:j] | break | endif
|
||||
if l:old_line[l:j : l:j] !=# l:new_line[l:j : l:j] | break | endif
|
||||
let l:j += 1
|
||||
endwhile
|
||||
return [l:i, l:j]
|
||||
@@ -59,8 +59,8 @@ function! s:LastDifference(old, new, start_char) abort
|
||||
endwhile
|
||||
if l:i <= -1 * l:line_count
|
||||
let l:i = -1 * l:line_count
|
||||
let l:old_line = a:old[l:i][a:start_char:]
|
||||
let l:new_line = a:new[l:i][a:start_char:]
|
||||
let l:old_line = a:old[l:i][a:start_char :]
|
||||
let l:new_line = a:new[l:i][a:start_char :]
|
||||
else
|
||||
let l:old_line = a:old[l:i]
|
||||
let l:new_line = a:new[l:i]
|
||||
@@ -68,7 +68,7 @@ function! s:LastDifference(old, new, start_char) abort
|
||||
let l:length = min([strlen(l:old_line), strlen(l:new_line)])
|
||||
let l:j = -1
|
||||
while l:j >= -1 * l:length
|
||||
if l:old_line[l:j:l:j] !=# l:new_line[l:j:l:j] | break | endif
|
||||
if l:old_line[l:j : l:j] !=# l:new_line[l:j : l:j] | break | endif
|
||||
let l:j -= 1
|
||||
endwhile
|
||||
return [l:i, l:j]
|
||||
@@ -77,12 +77,12 @@ endfunction
|
||||
function! s:ExtractText(lines, start_line, start_char, end_line, end_char) abort
|
||||
if a:start_line == len(a:lines) + a:end_line
|
||||
if a:end_line == 0 | return '' | endif
|
||||
let l:result = a:lines[a:start_line][a:start_char:a:end_char]
|
||||
let l:result = a:lines[a:start_line][a:start_char : a:end_char]
|
||||
" json_encode treats empty string computed this was as 'null'
|
||||
if strlen(l:result) == 0 | let l:result = '' | endif
|
||||
return l:result
|
||||
endif
|
||||
let l:result = a:lines[a:start_line][a:start_char:]."\n"
|
||||
let l:result = a:lines[a:start_line][a:start_char :]."\n"
|
||||
let l:adj_end_line = len(a:lines) + a:end_line
|
||||
for l:line in a:lines[a:start_line + 1:a:end_line - 1]
|
||||
let l:result .= l:line."\n"
|
||||
|
||||
Reference in New Issue
Block a user