Skip to content

Commit 58eda61

Browse files
committed
lsp: use getbufoneline when possible
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.
1 parent 48201c5 commit 58eda61

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

autoload/go/lsp.vim

+5-1
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,11 @@ function! s:lineinfile(fname, line) abort
20482048
if l:bufnr == -1 || len(l:bufinfo) == 0 || l:bufinfo[0].loaded == 0
20492049
let l:filecontents = readfile(a:fname, '', a:line)
20502050
else
2051-
let l:filecontents = getbufline(a:fname, a:line)
2051+
if exists('*getbufoneline')
2052+
let l:filecontents = [getbufoneline(a:fname, a:line)]
2053+
else
2054+
let l:filecontents = getbufline(a:fname, a:line)
2055+
endif
20522056
endif
20532057

20542058
if len(l:filecontents) == 0

0 commit comments

Comments
 (0)