pappasam / coc-jedi

coc.nvim wrapper for https://github.com/pappasam/jedi-language-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add parenthesis to completions of methods and functions

noib3 opened this issue · comments

Basically title. It'd be nice to complete object. with object.method() instead of object.method. Sometimes the parenthesis won't be needed, but pressing backspace once in a while is better than manually inputing parenthesis almost every time.

Thanks for the issue. Note: this is already implemented using snippets. If you have the following mapping in your vimrc:

imap     <silent> <expr> <C-l> coc#expandable() ? "<Plug>(coc-snippets-expand)" : "\<C-y>"

And you've installed coc-snippets, pressing <C-l> while you've selected a callable should expand both the parentheses and the non-keyword arguments. See:

snippet_example

Given the fact that adding a parenthesis for all callables creates unexpected problems (see here), I've opted to keep this functionality within snippets instead of causing unexpected behavior for end users during imports, snippet expansion, etc.

Actually, I might have an idea for how to implement this without creating problems elsewhere. I'll keep this issue open until I've figured that out 1 way or another. The solution will involve both https://jedi.readthedocs.io/en/latest/docs/settings.html#jedi.settings.add_bracket_after_function and making sure that doesn't create weird behavior on imports and snippet expansion.

Ok second thought, since this is handled by snippets, and because I can't think of a good way to include this without creating weird edge cases, I'll close this issue.