The Wayback Machine - https://web.archive.org/web/20200905014532/https://github.com/bpython/bpython/pull/840
Skip to content
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

Feature: Add open close parentheses for attribute suggestions that are methods #840

Draft
wants to merge 1 commit into
base: master
from

Conversation

@rybarczykj
Copy link
Contributor

rybarczykj commented Aug 6, 2020

TLDR:

  • Parenthesis on attribute suggestions so it's clear which attributes are methods
  • Slight modification to how parentheses are autofilled

Sorry for the bad quality gifs. I should stop using GIPHY for this.

Native function completion
Current behavior: open parenthesis in suggestion and autofill. You have to type something after the paren before you can see the method signature.
now
My proposal: open AND close parens in suggestion, no parens in autofill. Now typing the open paren shows the method signature.
new
This might mess with some people's muscle memory since it changes what's autofilled.

Attributute completion
Current behavior: no parens in suggestion or autofill. You can't tell what is a method or otherwise.
old
My proposal: open close parens in suggestion, no parens in autofill. Very clear which attrs are methods.
old
Since this only changes the infobox, it shouldn't mess with anyone's muscle memory.

If this seems worth implementing, I'll need to fix some tests. Right now, tests expect matches that look like "math.cos" or "any(", but they'll be getting matches that look like "math.cos()" and "any()".

Also I'm not sure if I implemented this the best way. The way I did it, the actual match string is altered to have parens. Maybe it's better to leave the match as-is, but add parenthesis only on the front end. This would require some passing around of information. Feedback appreciated.

- Add parens to attribute suggestions for methods
- Methods now appear as suggestions with "()" but drop the
parens when selected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.