autoload/lsp/outline.vim | 2 +- autoload/lsp/symbol.vim | 4 ++-- autoload/lsp/textedit.vim | 2 +- autoload/lsp/util.vim | 17 ++--------------- diff --git a/autoload/lsp/outline.vim b/autoload/lsp/outline.vim index ad0cc36c023e1e550e2b1e63826929a53196be96..2979d2096427114a882b0e2509223b76b9c60df2 100644 --- a/autoload/lsp/outline.vim +++ b/autoload/lsp/outline.vim @@ -194,7 +194,7 @@ endif # Highlight the selected symbol var col: number = - util.GetBufOneLine(bnr, symbolTable[mid].outlineLine)->match('\S') + 1 + bnr->getbufline(symbolTable[mid].outlineLine)->get(0, '')->match('\S') + 1 prop_add(symbolTable[mid].outlineLine, col, {bufnr: bnr, type: 'LspOutlineHighlight', length: symbolTable[mid].name->len()}) diff --git a/autoload/lsp/symbol.vim b/autoload/lsp/symbol.vim index 136d99a973b7db96a3d2ad5ee47800f661c23c95..5914f92a419bb28112e7efd4be50a321792fd9e1 100644 --- a/autoload/lsp/symbol.vim +++ b/autoload/lsp/symbol.vim @@ -349,7 +349,7 @@ endif bnr->bufload() var lnum = range.start.line + 1 - var text: string = util.GetBufOneLine(bnr, lnum) + var text: string = bnr->getbufline(lnum)->get(0, '') menuItems->add($'{lnum}: {text}') endfor @@ -389,7 +389,7 @@ if bnr == -1 bnr = fname->bufadd() endif bnr->bufload() - var text: string = util.GetBufOneLine(bnr, range.start.line + 1)->trim("\t ", 1) + var text: string = bnr->getbufline(range.start.line + 1)->get(0, '')->trim("\t ", 1) qflist->add({filename: fname, lnum: range.start.line + 1, col: util.GetLineByteFromPos(bnr, range.start) + 1, diff --git a/autoload/lsp/textedit.vim b/autoload/lsp/textedit.vim index 374d9075c6c5edf995e520ac37b66878d7064bcd..00c01727bf39ed3015fbd3600547c5798bf5a689 100644 --- a/autoload/lsp/textedit.vim +++ b/autoload/lsp/textedit.vim @@ -171,7 +171,7 @@ # extra empty line at the end. Delete the empty line after appending the # lines. var dellastline: bool = false if start_line == 0 && bnr->getbufinfo()[0].linecount == 1 && - util.GetBufOneLine(bnr, 1)->empty() + bnr->getbufline(1)->get(0, '')->empty() dellastline = true endif diff --git a/autoload/lsp/util.vim b/autoload/lsp/util.vim index 220d14cb60630f3c7d82f479af7db186c9b01489..708e8b86edc049458e8e6c27ca42cee0e4751a9a 100644 --- a/autoload/lsp/util.vim +++ b/autoload/lsp/util.vim @@ -169,7 +169,7 @@ # Need a loaded buffer to read the line and compute the offset bnr->bufload() - var ltext: string = GetBufOneLine(bnr, pos.line + 1) + var ltext: string = bnr->getbufline(pos.line + 1)->get(0, '') if ltext->empty() return col endif @@ -196,7 +196,7 @@ # Need a loaded buffer to read the line and compute the offset bnr->bufload() - var ltext: string = GetBufOneLine(bnr, pos.line + 1) + var ltext: string = bnr->getbufline(pos.line + 1)->get(0, '') if ltext->empty() return col endif @@ -351,19 +351,6 @@ }) # choose the longest matching path (the nearest directory from 'startDir') return sortedList[0] -enddef - -export def GetBufOneLine(bnr: number, lnum: number): string - if exists_compiled('*getbufoneline') - # getbufoneline() was introduced in patch 9.0.0916 - return bnr->getbufoneline(lnum) - else - var l = bnr->getbufline(lnum) - if l->empty() - return '' - endif - return l[0] - endif enddef # vim: tabstop=8 shiftwidth=2 softtabstop=2