Skip to content

Commit

Permalink
lsp: use getbufoneline when possible
Browse files Browse the repository at this point in the history
use getbufoneline when it's available to get a line instead of getting
all the lines of a buffer and selecting only the line of interest.
  • Loading branch information
bhcleek committed Dec 5, 2023
1 parent 106ad64 commit c5b51a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,11 @@ function! s:lineinfile(fname, line) abort
if l:bufnr == -1 || len(l:bufinfo) == 0 || l:bufinfo[0].loaded == 0
let l:filecontents = readfile(a:fname, '', a:line)
else
let l:filecontents = getbufline(a:fname, a:line)
if exists('*getbufoneline')
let l:filecontents = [getbufoneline(a:fname, a:line)]
else
let l:filecontents = getbufline(a:fname, a:line)
endif
endif

if len(l:filecontents) == 0
Expand Down

0 comments on commit c5b51a0

Please sign in to comment.