-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: omnicompl may no completeItems yet #438
base: main
Are you sure you want to change the base?
fix: omnicompl may no completeItems yet #438
Conversation
Signed-off-by: shane.xb.qian <[email protected]>
@@ -506,7 +505,7 @@ def g:LspOmniFunc(findstart: number, base: string): any | |||
count += 1 | |||
endwhile | |||
|
|||
if lspserver.omniCompletePending | |||
if lspserver.omniCompletePending || !lspserver->has_key('completeItems') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lspserver.completeItems
field is set to an empty List in line 488 above, when the omni-completion function
is called with findstart' set to true. Under what conditions, the
completeItemskey will not be present in
lspserver`?
+ 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 with `findstart' set to true. Under what conditions, the `completeItems` key will not be present
in `lspserver`?
somehow if omniCompletePending is false, then lspserver maybe no completeItems yet.
…--
shane.xb.qian
|
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 with `findstart' set to true. Under what conditions, the `completeItems` key 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
|
In the two places where Can you use describe the steps to reproduce this problem (e.g. LSP server, plugin configuration |
> > + 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 with `findstart' set to true. Under what conditions, the `completeItems` key 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`.
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 ? |
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. |
i donot know, |
this PR shoud be helping such flow, but i donot know why it is showing "searching" forever... 🤷 |
or it was quickly enough to "cancel"? |
i think it became worse, tho logically maybe you were right if -2, but it would be no message about the status? so i donot know your first commit at #462 was better or here mine this one was preferred. |
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
|
Thanks for the details. This problem should be addressed by 0b9bba0. Can you try the latest version of the plugin? |
No error anymore. |
lspserver may have no completeItems yet, then omnicompl will be 'err'.