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

(Python) Wrong highlighting of default arguments #2713

Closed
wjandrea opened this issue Sep 27, 2020 · 1 comment · Fixed by #2715
Closed

(Python) Wrong highlighting of default arguments #2713

wjandrea opened this issue Sep 27, 2020 · 1 comment · Fixed by #2715
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language

Comments

@wjandrea
Copy link

wjandrea commented Sep 27, 2020

Describe the issue
None should be the same colour in the function signature and function body (since it's the same object being referred to), but instead it's plain in in the signature and colored in the body.

Screenshots from this Stack Overflow post (dark and light mode):

dark light

Which language seems to have the issue?
python/py

Are you using highlight or highlightAuto?
I don't know what that means. I assume it's about how highlight.js is deployed, but I'm an end user, not a Stack Exchange dev.

Sample Code to Reproduce

def my_func(working_list=None):
    if working_list is None: 
        working_list = []

    working_list.append("a")
    print(working_list)

Expected behavior
None should be the same colour in the function signature and function body. GitHub gets it right (see snippet above). And FWIW, here are screenshots from Atom, PythonAnywhere, and gedit, which are all using different highlighting schemes to GitHub:

atom PA gedit

Additional context
I originally posted this bug report on Stack Overflow and was directed here by Martijn Pieters.

@wjandrea wjandrea added bug help welcome Could use help from community language labels Sep 27, 2020
@joshgoebel joshgoebel added the good first issue Should be easier for first time contributors label Sep 28, 2020
@joshgoebel
Copy link
Member

Confirm (at a glance). We don't now match keywords inside params... a simple fix for this would involve figuring out which keywords can existing inside params and then adding a keywords option to the inner matcher of PARAMS.

Care to try for a PR? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants