srusskih / SublimeJEDI

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

Autocomplete Problem. #224

Closed Jackmrzhou closed 6 years ago

Jackmrzhou commented 7 years ago

It seems that there is a problem in auto completion. When I set "auto_complete_function_params": "required", the result is same as "auto_complete_function_params": "all". My Sublime Version is Sublime Text 3 Build 3143 and The Jedi Version is 0.10.1, and Python Version 3.6.1. Hope you fix it. :)

Jackmrzhou commented 6 years ago

I may not describe the issue clearly. The auto completion fails when it comes to some functions like print(),max(),id(), it complete all parameters,or complete total wrong parameters. However, when it comes to the function with simple parameters, it works. default

srusskih commented 6 years ago

ouch. looks not good (= will look on it.

srusskih commented 6 years ago

Have found an open issue https://github.com/davidhalter/jedi/issues/909

For now it looks like a know issues. Will try to do something with this, but can not guarantee that it will be fixed. :(

kevinlong206 commented 6 years ago

@srusskih I'm no expert, but that bug doesn't necessarily look related?

Wish I could help somehow.. not being able to even use print() without having to delete a bunch of autocomplete stuff kinda is a bummer though! Doh

Found this because I was trying to figure out which package was always putting:

print(value, sep, end, file, flush)

whenever I got as far as typing: print(

gtalarico commented 6 years ago

Same issue here Sublime 3.0 Build 3143 Jedi v0.10.1

pe224 commented 6 years ago

Same here, Jedi 0.11.0, ST3 3143 This is quite annoying.

Looks like it currently checks the param.description of all parameters of the Jedi CallSignature for a =. If it's in, the rest is the default value. https://github.com/srusskih/SublimeJEDI/blob/d59a3704ee4325425f7bba09c4d0378d2a6ec566/sublime_jedi/daemon.py#L99-L103 Later, if default_value is None it's not a keyword argument, so it has to be added to the completion.

For some builtins, e.g. print, max, str.split, ... Jedi does not show a param.description containing a =

signature = jedi.Script("print(").call_signatures()[0]
print([param.description for param in signature.params])
> ['param value', 'param ...', 'param sep', 'param end', 'param file', 'param flush']

so the above algorithm fails.

This should definitely be reported to Jedi as well. Only way that comes to my mind right now is additionally parsing the docstring which is certainly not ideal...