srusskih / SublimeJEDI

awesome Python autocompletion with SublimeText
MIT License
938 stars 109 forks source link

Jedi auto-selects an auto-completed parameter suggestion #273

Closed romanovzky closed 5 years ago

romanovzky commented 6 years ago

Hi there,

I've noticed a behaviour that is a huge papercut. When accepting an auto-complete parameter suggestion (as in a function parameter), ST with Jedi automatically selects the suggestion leading to the next keystroke replacing it with whatever you press.

Way to reproduce this in my setup:

def function(par=10):
    return par

function(p)

When typing p, by either pressing tab or enter to accept par as auto-completion suggestion, ST with Jedi correctly auto-completes with par but this comes selected, meaning that pressing for example = will replace par by =:

function(=)
srusskih commented 6 years ago

thanks for feed back.

Sounds like "OK". par inserted as "ST snippet" and an user are able to do what ever she want with this.

srusskih commented 6 years ago

An idea as possible feature,- is add an option that allow complete functions signatures with snippets or not, like:

"signature_completion_as_snippet": true"

but it feels like a try to write own editor or change ST behavior

kkew3 commented 5 years ago

I'm not very clear about how sublime text addresses the snippet, but apparently it doesn't quite make sense for user to do whatever with it when the auto-completed-and-selected parameter is a keyword argument. For example,

def f(par=10, another_par=20):
    ...   # some implementation

When typing f(an it suggests f(another_par with another_par selected. However, the only option the user has for now is to undo the selection and goes on typing = and the intended value. There's no other option that retains the semantics. While the same logic applies to positional arguments, it does not apply to keyword arguments. Thanks.

srusskih commented 5 years ago

it's hard to explain in words, I hope this GIFs helps

"auto_complete_function_params": "all",

ex1-full-complete

ex2-full-replacement

"auto_complete_function_params": "required", ex1-required-replacement

ex2-required-kwargs

ex3-required-replacemt_var

ex4-required-var