← 返回首页
Feature: Add open close parentheses for attribute suggestions that are methods by rybarczykj · Pull Request #840 · bpython/bpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

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

Draft
rybarczykj wants to merge 1 commit into
bpython:mainfrom
rybarczykj:complete
Draft

Feature: Add open close parentheses for attribute suggestions that are methods#840
rybarczykj wants to merge 1 commit into
bpython:mainfrom
rybarczykj:complete

Conversation

Copy link
Copy Markdown
Contributor

rybarczykj commented Aug 6, 2020
edited
Loading

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.

My proposal: open AND close parens in suggestion, no parens in autofill. Now typing the open paren shows the method signature.

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.

My proposal: open close parens in suggestion, no parens in autofill. Very clear which attrs are methods.

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.

Copy link
Copy Markdown
Member

I personally like this, and I think at least the second part, attribute completion changes, should be added.

sebastinas added this to the New features milestone Oct 12, 2020
Copy link
Copy Markdown

codecov-commenter commented Jul 15, 2021
edited
Loading

Codecov Report

Merging #840 (0cc3b86) into main (d07a405) will decrease coverage by 0.19%.
The diff coverage is 85.71%.

@@ Coverage Diff @@ ## main #840 +/- ## ========================================== - Coverage 67.95% 67.76% -0.20% ========================================== Files 61 61 Lines 9144 9154 +10 ========================================== - Hits 6214 6203 -11 - Misses 2930 2951 +21
Impacted Files Coverage Δ
bpython/repl.py 72.32% <83.33%> (+0.05%) ⬆️
bpython/autocomplete.py 85.84% <87.50%> (+0.21%) ⬆️
bpython/inspection.py 83.90% <0.00%> (-2.93%) ⬇️
bpython/test/test_repl.py 91.35% <0.00%> (-2.47%) ⬇️
bpython/test/test_importcompletion.py 92.00% <0.00%> (-2.00%) ⬇️
bpython/test/test_interpreter.py 80.35% <0.00%> (-1.79%) ⬇️
bpython/test/test_autocomplete.py 94.44% <0.00%> (-0.40%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d07a405...0cc3b86. Read the comment docs.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.