Skip to content

Commit a803997

Browse files
committed
chore: update vim-vital-vs
1 parent 0a4b841 commit a803997

File tree

7 files changed

+19
-24
lines changed

7 files changed

+19
-24
lines changed

autoload/vital/_vsnip/VS/LSP/Diff.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,4 @@ if has('nvim')
161161
catch /.*/
162162
endtry
163163
endif
164+

autoload/vital/_vsnip/VS/LSP/Position.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ function! s:_get_buffer_line(expr, lnum) abort
5959
endif
6060
return v:null
6161
endfunction
62+

autoload/vital/_vsnip/VS/LSP/Text.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ endfunction
2020
function! s:split_by_eol(text) abort
2121
return split(a:text, "\r\n\\|\r\\|\n", v:true)
2222
endfunction
23+

autoload/vital/_vsnip/VS/LSP/TextEdit.vim

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,21 @@ endfunction
2828
" apply
2929
"
3030
function! s:apply(path, text_edits) abort
31-
let l:current_bufname = bufname('%')
32-
let l:current_position = s:Position.cursor()
31+
let l:current_bufnr = bufnr('%')
32+
for l:bufnr in range(1, bufnr('$'))
33+
if index([fnamemodify(a:path, ':p'),fnameescape(fnamemodify(a:path, ':p'))], bufname(l:bufnr)) != -1
34+
let l:target_bufnr = l:bufnr
35+
break
36+
endif
37+
endfor
38+
if !exists('l:target_bufnr')
39+
let l:target_bufnr = s:Buffer.ensure(a:path)
40+
endif
3341

34-
let l:target_bufnr = s:_switch(a:path)
35-
call s:_substitute(l:target_bufnr, a:text_edits, l:current_position)
36-
let l:current_bufnr = s:_switch(l:current_bufname)
42+
let l:current_position = s:Position.cursor()
43+
call s:Buffer.do(l:target_bufnr, { -> s:_substitute(l:target_bufnr, a:text_edits, l:current_position) })
3744

38-
if l:current_bufnr == l:target_bufnr
39-
call cursor(s:Position.lsp_to_vim('%', l:current_position))
40-
endif
45+
call cursor(s:Position.lsp_to_vim('%', l:current_position))
4146
endfunction
4247

4348
"
@@ -167,18 +172,3 @@ function! s:_fix_text_edits(bufnr, text_edits) abort
167172
return [l:fixeol, l:text_edits]
168173
endfunction
169174

170-
"
171-
" _switch
172-
"
173-
function! s:_switch(path) abort
174-
let l:curr = bufnr('%')
175-
let l:next = filereadable(a:path) ? bufnr(fnameescape(a:path)) : bufnr(a:path)
176-
if l:next >= 0
177-
if l:curr != l:next
178-
execute printf('noautocmd keepalt keepjumps %sbuffer!', l:next)
179-
endif
180-
else
181-
execute printf('noautocmd keepalt keepjumps edit! %s', fnameescape(a:path))
182-
endif
183-
return bufnr('%')
184-
endfunction

autoload/vital/_vsnip/VS/Vim/Buffer.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ function! s:pseudo(filepath) abort
137137
augroup END
138138
return l:bufnr
139139
endfunction
140+

autoload/vital/_vsnip/VS/Vim/Option.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ function! s:define(map) abort
1818
endfor
1919
return { -> s:define(l:old) }
2020
endfunction
21+

autoload/vital/vsnip.vital

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
vsnip
2-
f28b0d147b702686817da56eef47e0736f425233
2+
4d4bb61bb1f9b3ac6cd679e3551de88ad3682cc3
33

44
VS.LSP.TextEdit
55
VS.LSP.Diff

0 commit comments

Comments
 (0)