-
Notifications
You must be signed in to change notification settings - Fork 288
Completion detail using module name, function parameters #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completion detail using module name, function parameters #170
Conversation
|
@tomv564 thanks for this, I like it! Much more useful IMO. Happy to merge once tests pass. |
|
@tomv564 think you need [edit] ahh, it's a py2 vs py3 thing |
pyls/plugins/completion.py
Outdated
|
|
||
| def _label(definition): | ||
| if definition.type in ('function', 'method'): | ||
| params = ", ".join(map(lambda definition: definition.name, definition.params)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could you use a list comprehension instead of the map builtin.
test/plugins/test_completion.py
Outdated
|
|
||
| assert len(items) > 0 | ||
| assert items[0]['label'] == 'read' | ||
| assert items[0]['label'] == 'read()' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make sense to try and deal with 2vs3 (I believe python 3 lets you "inspect" the python * and ** parameters to a function), so you may want to just pick another builtin to test against instead of sys.stdin.read !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried sys.exit which also differed, for now I added the version check inline.
I can try a few more later, agree it is clumsy logic to have in the tests.
Here are some explorations for #149 for testing / discussion. Likely to conflict with the Rope integration, but this is far from decided anyways.
Performance is okay for me in a small codebase, anyone working with a large code base who can do a quick comparison?
References to Jedi implementations:
Signature params: https://github.com/davidhalter/jedi/blob/752b7d8d495689a38076f20475a870f8aa139a28/jedi/api/classes.py#L314
Full_name:
https://github.com/davidhalter/jedi/blob/752b7d8d495689a38076f20475a870f8aa139a28/jedi/api/classes.py#L265