prabirshrestha / vim-lsp

async language server protocol plugin for vim and neovim
MIT License
3.07k stars 303 forks source link

E117: Unknown function: getbufoneline #1512

Closed Jsbjr closed 8 months ago

Jsbjr commented 8 months ago

hello, I did an update today (master -> ee2bb88833766ed184a77d4caa1e43d0821eaeb2) and now i get the following error:

Error detected while processing function <SNR>56_debounceTimeTimerCallback[1]..<SNR>56_tapSourceCallback[4]..<SNR>56_tapSourceCallback[1]..<lambda>26[1]..<SNR>76_set_highlights[10]..<SNR>76_place_highlights:
line   59:
E117: Unknown function: getbufoneline
Error detected while processing function <SNR>56_debounceTimeTimerCallback[1]..<SNR>56_tapSourceCallback[4]..<SNR>56_tapSourceCallback[1]..<lambda>26[1]..<SNR>76_set_highlights[10]..<SNR>76_place_highlights:
line   59:
E116: Invalid arguments for function strlen(getbufoneline(a:bufnr, l:line)) + 1

Apparently in vim-lsp/autoload/lsp/internal/diagnostics/highlights.vim on line 189 the function getbufoneline is used but not defined.

prabirshrestha commented 8 months ago

It is probably older version of vim where we need to check if it exists before using it.

Jsbjr commented 8 months ago

That is possible, i am using vim in WSL with Ubuntu 22.04

vim --version 
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 06 2023 07:49:43)
Included patches: 1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919, 213
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     -perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          -ruby              +wildignore
+cursorbind        -lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary
-farsi             -mouse_sysmouse    -tag_old_static

It looks like adding the following solve the issue:

if exists('?getbufoneline')
    let l:highlight_end_col = strlen(getbufoneline(a:bufnr, l:line)) + 1
else
    let l:highlight_end_col = strlen(getbufline(a:bufnr, l:line)[0]) + 1
endif
prabirshrestha commented 8 months ago

Feel free to send the PR with those changes.

Jsbjr commented 8 months ago

1514 Solve the issue thanks.