Skip to content

Commit c5b51a0

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 106ad64 commit c5b51a0

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
@@ -2049,7 +2049,11 @@ function! s:lineinfile(fname, line) abort
20492049
if l:bufnr == -1 || len(l:bufinfo) == 0 || l:bufinfo[0].loaded == 0
20502050
let l:filecontents = readfile(a:fname, '', a:line)
20512051
else
2052-
let l:filecontents = getbufline(a:fname, a:line)
2052+
if exists('*getbufoneline')
2053+
let l:filecontents = [getbufoneline(a:fname, a:line)]
2054+
else
2055+
let l:filecontents = getbufline(a:fname, a:line)
2056+
endif
20532057
endif
20542058

20552059
if len(l:filecontents) == 0

0 commit comments

Comments
 (0)