Open Shane-XB-Qian opened 8 months ago
- if lspserver.omniCompletePending || !lspserver->has_key('completeItems')
The
lspserver.completeItems
field is set to an empty List in line 488 above, when the omni-completion function is called withfindstart' set to true. Under what conditions, the
completeItemskey will not be present in
lspserver`?
somehow if omniCompletePending is false, then lspserver maybe no completeItems yet.
-- shane.xb.qian
- if lspserver.omniCompletePending || !lspserver->has_key('completeItems') The
lspserver.completeItems
field is set to an empty List in line 488 above, when the omni-completion function is called withfindstart' set to true. Under what conditions, the
completeItemskey will not be present in
lspserver`?somehow if omniCompletePending is false, then lspserver maybe no completeItems yet.
Under what conditions did you see this problem?
- if lspserver.omniCompletePending || !lspserver->has_key('completeItems') The
lspserver.completeItems
field is set to an empty List in line 488 above, when the omni-completion function is called withfindstart' set to true. Under what conditions, the
completeItemskey will not be present in
lspserver`?somehow if omniCompletePending is false, then lspserver maybe no completeItems yet.
Under what conditions did you see this problem?
Under when if omniCompletePending is false, there is no 'lspserver.completeItems = []'
-- shane.xb.qian
- if lspserver.omniCompletePending || !lspserver->has_key('completeItems') The
lspserver.completeItems
field is set to an empty List in line 488 above, when the omni-completion function is called withfindstart' set to true. Under what conditions, the
completeItemskey will not be present in
lspserver`? > > somehow if omniCompletePending is false, then lspserver maybe no completeItems yet. Under what conditions did you see this problem?Under when if omniCompletePending is false, there is no 'lspserver.completeItems = []'
In the two places where omniCompletePending
is set to false, lspserver.completeItems
is initialized.
So I don't see a condition where omniCompletePending
is false but completeItems
is missing
from lspserver
.
Can you use describe the steps to reproduce this problem (e.g. LSP server, plugin configuration and the keys pressed)?
- if lspserver.omniCompletePending || !lspserver->has_key('completeItems') The
lspserver.completeItems
field is set to an empty List in line 488 above, when the omni-completion function is called withfindstart' set to true. Under what conditions, the
completeItemskey will not be present in
lspserver`? > > somehow if omniCompletePending is false, then lspserver maybe no completeItems yet. Under what conditions did you see this problem?Under when if omniCompletePending is false, there is no 'lspserver.completeItems = []'
In the two places where
omniCompletePending
is set to false,lspserver.completeItems
is initialized. So I don't see a condition whereomniCompletePending
is false butcompleteItems
is missing fromlspserver
.
what if 'omniCompletePending' itself was 'false', where did 'lspserver.completeItems = []'?
-- shane.xb.qian
My cursor is between { }
After this fix, error is gone. No completions though. Should I expect completions ?
@Shane-XB-Qian @yegappan
Which language server are you using? Can you include the LSP plugin settings? It will also be useful to include a sample code that reproduces the problem.
After this fix, error is gone. No completions though. Should I expect completions ?
i donot know, to me, it should be "searching", // then later (somehow?) it showed the completions, or "failure", maybe more make sense.
this PR shoud be helping such flow, but i donot know why it is showing "searching" forever... :shrug: // vs #462 which just to cancel the compl.
or it was quickly enough to "cancel"? but later somehow it may get the completions (of/at that) anyway. // so i donot know, it is up to yegappan, and #462
This is a regression caused by the PR https://github.com/yegappan/lsp/pull/418. I have committed https://github.com/yegappan/lsp/commit/0b9bba0ee4eaa84a75d88a0775b3b34dbf42b12d to address this issue.
I have committed 0b9bba0 to address this issue.
i think it became worse, tho logically maybe you were right if -2, but it would be no message about the status? 'cancel' meant you passed [] then no result, or here this PR let it be showing "searching", tho not sure why it was showing forever, vs [] made it be failed directly.
so i donot know your first commit at #462 was better or here mine this one was preferred. // anyway, personally i donot like your second commit for #462, but up to you, i am not going to argue too much.
Which language server are you using? Can you include the LSP plugin settings? It will also be useful to include a sample code that reproduces the problem.
Apologies for the late reply
I am using https://github.com/typescript-language-server/typescript-language-server
My settings
hi Err ctermfg=Red ctermbg=NONE cterm=bold
hi Wrn ctermfg=Yellow ctermbg=NONE cterm=bold
hi Hnt ctermfg=Blue ctermbg=NONE cterm=bold
hi Inf ctermfg=White ctermbg=NONE cterm=bold
au BufWinEnter * sign define LspDiagError text=E texthl=Err numhl=Err linehl=
au BufWinEnter * sign define LspDiagWarning text=W texthl=Wrn numhl=Wrn linehl=
au BufWinEnter * sign define LspDiagHint text=H texthl=Hnt numhl=Hnt linehl=
au BufWinEnter * sign define LspDiagInfo text=I texthl=Inf numhl=Inf linehl=
call LspOptionsSet(
\ {
\ 'showSignature': v:false,
\ 'autoComplete': v:false,
\ 'showDiagOnStatusLine': v:true,
\ 'noNewlineInCompletion': v:true,
\ 'completionMatcher': 'icase',
\ 'keepFocusInReferences': v:true,
\ 'highlightDiagInline': v:false,
\ }
\ )
let lspServers = [
\ {
\ 'name': 'clangd',
\ 'filetype': ['c', 'cpp'],
\ 'path': '/usr/bin/clangd',
\ 'args': ['--background-index']
\ },
\ {
\ 'filetype': ['javascript', 'typescript'],
\ 'path': 'typescript-language-server',
\ 'args': ['--stdio']
\ },
\ {
\ 'filetype': 'python',
\ 'path': '/home/santosh/.local/bin/pylsp',
\ 'args': ['--check-parent-process', '-v']
\ },
\ {
\ 'filetype': 'vim',
\ 'path': 'vim-language-server',
\ 'args': ['--stdio']
\ },
\ ]
call LspAddServer(lspServers)
au FileType c,python,javascript,typescript,vim,sh nnoremap <buffer> <silent> gd :LspGotoDefinition<CR>
au FileType javascriptreact,typescriptreact nnoremap <buffer> <silent> gd :LspGotoDefinition<CR>
au User LspAttached set keywordprg=:LspHover
Which language server are you using? Can you include the LSP plugin settings? It will also be useful to include a sample code that reproduces the problem.
Apologies for the late reply
I am using https://github.com/typescript-language-server/typescript-language-server
Thanks for the details. This problem should be addressed by https://github.com/yegappan/lsp/commit/0b9bba0ee4eaa84a75d88a0775b3b34dbf42b12d. Can you try the latest version of the plugin?
No error anymore.
lspserver may have no completeItems yet, then omnicompl will be 'err'.