From c5b51a08301d25632674b2b12ab6d80b97a77951 Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Tue, 5 Dec 2023 14:55:28 -0800 Subject: [PATCH] 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. --- autoload/go/lsp.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/go/lsp.vim b/autoload/go/lsp.vim index 4fab5a5574..55761391f5 100644 --- a/autoload/go/lsp.vim +++ b/autoload/go/lsp.vim @@ -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