0

I'm using vim with coc.nvim and the coc-python plugin.
In Pycharm for example, when I write a contextmanager class like:

class Foo:
  def __init__(self) -> None:
    pass  # some code
  
  def __enter__(self):
    pass  # some code 

  def __exit__(self, exc_type, exc_val, exc_tb):
    pass  # some code

Then during typing the __exit__() method I get the exc_* common args autocompleted for me (I know that these names don't have to be these exactly, but it's a convention). Can I get a similar behaviour with coc.nvim? Currently it doesn't do that. Same goes for autocompleting self at each method which is not a class or a static method.

Corel
  • 581
  • 3
  • 21

1 Answers1

1

It's called signatureHelp in LSP. It's not recommend to use coc-python now because Microsoft Python Language Server will be deprecated in future. You can use coc-pyright if you're using Python 3.

enter image description here

fannheyward
  • 18,599
  • 12
  • 71
  • 109
  • How do I disable `coc-python` and move to use `coc-pyright` (other than just doing `CocInstall coc-pyright`? Also, when I enter a new class I get the `__init__()` autocompletion but not the `__enter__()` and `__exit__()`... – Corel Jun 20 '21 at 08:34
  • `CocUninstall coc-python` and `:CocInstall coc-pyright`. – fannheyward Jun 21 '21 at 01:32
  • The `__enter__()` and `__exit__()` methods still don't get autocompleted – Corel Jun 21 '21 at 10:56
  • @Corel can't reproduce, the two methods will be listed in completions list. – fannheyward Jun 24 '21 at 03:25