fannheyward/coc-pyright

Erases existing argument when completing function call keyword argument

kasbah opened this issue · 1 comments

kasbah commented

What's the output of :CocCommand pyright.version

[coc.nvim] coc-pyright 1.1.336 with Pyright 1.1.336   

What's the output of :CocCommand workspace.showOutput Pyright

Workspace: /tmp
Using python from /usr/bin/python

[Info  - 10:39:32.660] Pyright language server 1.1.338 starting
[Info  - 10:39:32.660] Server root directory: /usr/lib/node_modules/pyright/dist
[Info  - 10:39:32.665] Starting service instance "tmp"
[Info  - 10:39:32.680] Setting pythonPath for service "tmp": "/usr/bin/python"
[Info  - 10:39:32.707] Assuming Python version 3.11
[Info  - 10:39:32.776] Found 1 source file

Description

Say you have:

def example(argument):
    pass

my_arg = 1

example(my_arg)

and you want to change my_arg to argument=my_arg in the example function call.

  • Put your cursor after the first bracket
example(▉my_arg)
  • Type arg and trigger completion

You end up with:

example(argument=)

But you wanted:

example(argument=my_arg)

P.S. Thank you so much for coc-pyright!

Set "suggest.insertMode": "insert" in your coc-settings.json.

By default, coc.nvim uses replace at accepting completions, check :h coc-config-suggest-insertMode.