-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
gh-138318, PyREPL: builtins should not be highlighted when used as attribute names #138319
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
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.
I would actually say that the current behavior is more useful, since it allows users to see that they are typing in a keyword name and that there will be a syntax error because of that.
I am -1 on this change, sorry :(
not total agree before this patch I tried |
I am not against to stop highlighting |
That's their own choices. But writing the keyword and hitting enter would anyway raise a SyntaxError so I think it's better that users know that they are writing a keyword and that they can't do that. But I agree that the |
ghci
a.set and a.list the list highligt in VS Code is strange, I wonder it is the same in repl |
Nonetheless, while two core devs opposed changing the behavior for keywords, I'm willing to support a change of behavior when it comes to built-ins used as attributes. I think it makes sense not to highlight them. |
thank you |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
now only not highlight the buildin words |
fixed that, thank you. |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Misc/NEWS.d/next/Core_and_Builtins/2025-09-01-16-09-02.gh-issue-138318.t-WEN5.rst
Outdated
Show resolved
Hide resolved
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
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.
This just has one downside, code like:
>>> some. \
... set = 1
will still be highlighted. But, I think it is a minor thing?
LGTM :)
Thank you |
Are we even able to detect those cases in the first place during highlighting? |
you mean the case above? |
Yes, I meant the case where we have continuation lines. Do we actually care about this for the other highlights? |
will try that |
I think we already cover the case can you try? cc @sobolevn |
@picnixz the common pattern here is to follow back until we find meaningful tokens. Ignoring things like |
thank you for confirm |
We remove REPL highlighting when a builtin name is used as an attribute name. Keywords will still be highlighted as they can never be used as valid attribute names.
Previous discussion about keywords
as diff
before the patch:

after the patch:
after the disscuss