Skip to content
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

omnicompletion of function after opening parentheses #462

Closed
Konfekt opened this issue Feb 25, 2024 · 7 comments
Closed

omnicompletion of function after opening parentheses #462

Konfekt opened this issue Feb 25, 2024 · 7 comments

Comments

@Konfekt
Copy link
Contributor

Konfekt commented Feb 25, 2024

After having passed autoComplete: v:false to LspOptionsSet(), then in Python (or any other language using functions whose arguments are passed inside parentheses), omni-completing

print(

gives

Error found executing function LspOmniFunc:
line   42:
E716: Key not present in Dictionary: "completeItems"

If instead print is completed to print(, then completing print( completes to print(print

@yegappan
Copy link
Owner

I committed 0f774f9 to address this issue. Can you try the latest plugin?

@Konfekt
Copy link
Contributor Author

Konfekt commented Feb 25, 2024

Thank you! Now we advanced one line as it spits out

Error found executing function LspOmniFunc:
line   43:
E716: Key missing in Dictionary: "omniCompleteKeyword"

@Konfekt
Copy link
Contributor Author

Konfekt commented Feb 25, 2024

# autoload/lsp/completion.vim (line 513)
var prefix = lspserver->get('omniCompleteKeyword', '')

indeed fixes the error

Error found executing function LspOmniFunc:
line   42:
E716: Key not present in Dictionary: "completeItems"

Still, instead of completing print( to print(print rather the popup window of the function arguments could still be shown.

@yegappan
Copy link
Owner

I am not able to reproduce this issue with a python file and the pylsp language server. Can you attach the language server configuration, LSP plugin configuration, a sample python file and the sequence of steps to reproduce this problem?

@Konfekt
Copy link
Contributor Author

Konfekt commented Feb 26, 2024

Calling

vim --clean -u ~/.vim/viminrc

with ~/.vim/viminrc reading

set nocompatible
language messages en_US  " To avoid scrambled non english letters.

let &rtp = '~/.vim/plugged/lsp/' . ',' . &rtp

autocmd VimEnter * source ~/.vim/after/settings/lsp.vim

filetype plugin indent on
syntax on

" options go here
set hidden

with ~/.vim/after/settings/lsp.vim reading

let lspOpts = #{
  \   autoComplete: v:false,
  \ }
call LspOptionsSet(lspOpts)

let lspServers = []
if filereadable($HOME . '/.local/bin/pylsp')
  call add(lspServers, #{name: 'pylsp',
                      \  filetype: 'python',
                      \  path: $HOME . '/.local/bin/pylsp',
                      \  args: ['--check-parent-process', '--verbose']
                      \ })
endif
call LspAddServer(lspServers)

and typing print(<c-x><c-o> inside a *.py file shows the error message

Trovato errore eseguendo function LspOmniFunc:
riga   43:
E716: Chiave assente dal Dizionario: "omniCompleteKeyword"

If instead print<c-x><c-o>(<c-x><c-o> then print( is completed to print(print

@yegappan
Copy link
Owner

Thanks for the detailed steps. I am able to reproduce the problem now. This is a regression caused by the PR #418. I have committed 0b9bba0 to address this issue. Can you try the latest plugin?

@Konfekt
Copy link
Contributor Author

Konfekt commented Feb 26, 2024

Thank you! Now it works without errors and does not insert text when there's nothing to complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants