endwhile
return start
else
+ # Wait for the list of matches from the LSP server
var count: number = 0
- while !complete_check() && lspserver.completePending
- && count < 1000
+ while lspserver.completePending && count < 1000
+ if complete_check()
+ return v:none
+ endif
sleep 2m
count += 1
endwhile
var wid = fname->bufwinid()
if wid != -1
wid->win_gotoid()
- normal! m`
else
var bnr: number = fname->bufnr()
if bnr != -1
exe 'edit ' .. fname
endif
endif
- setpos("'`", getcurpos())
endif
- # Set the previous cursor location mark
+ # Set the previous cursor location mark. Instead of using setpos(), m' is
+ # used so that the current location is added to the jump list.
+ normal m'
setcursorcharpos(location.range.start.line + 1,
location.range.start.character + 1)
endif
# Script to run the unit-tests for the LSP Vim plugin
-VIMPRG=${VIMPRG:=/usr/bin/vim}
+#VIMPRG=${VIMPRG:=/usr/bin/vim}
+export VIMRUNTIME=/home/yega/Documents/vim/opfunc/vim/runtime
+VIMPRG=/home/yega/Documents/vim/opfunc/vim/src/vim
VIM_CMD="$VIMPRG -u NONE -U NONE -i NONE --noplugin -N --not-a-term"
$VIM_CMD -S unit_tests.vim
:%bw!
enddef
+# Test for LSP omni completion
+def Test_omnicomplete()
+ lsp#setOptions({'autoComplete': v:false})
+ silent! edit Xtest.c
+ var lines: list<string> =<< trim END
+ void MyFunc1(void)
+ {
+ }
+
+ void MyFunc2(void)
+ {
+ }
+
+ void f1(void)
+ {
+ }
+ END
+ setline(1, lines)
+ :sleep 1
+ cursor(10, 1)
+ feedkeys("oMy\<C-X>\<C-O>\<C-N>();", "xt")
+ assert_equal("\tMyFunc2();", getline('.'))
+ :%bw!
+ lsp#setOptions({'autoComplete': v:true})
+enddef
+
def LspRunTests()
:set nomore
:set debug=beep