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

Fix builtin and keywords highlighting depending on indentation #3590

Merged
merged 3 commits into from
Oct 24, 2016

Conversation

mariacamilarg
Copy link
Contributor

@mariacamilarg mariacamilarg commented Oct 24, 2016

Fixes #2159

@mariacamilarg
Copy link
Contributor Author

This is what used to happen:
image

Now it is corrected:
image

@ccordoba12 ccordoba12 changed the title this fixes issue 2159 (common builtin and keywords colored different depending on indentation) Fix builtin and keywords highlighting depending on indentation Oct 24, 2016
@ccordoba12 ccordoba12 added this to the v3.0.2 milestone Oct 24, 2016
@@ -281,9 +281,13 @@ def any(name, alternates):

def make_python_patterns(additional_keywords=[], additional_builtins=[]):
"Strongly inspired from idlelib.ColorDelegator.make_pat"
kw = r"\b" + any("keyword", keyword.kwlist+additional_keywords) + r"\b"
kwlist = keyword.kwlist+additional_keywords
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add spaces around the + sign here

builtinlist = [str(name) for name in dir(builtins)
if not name.startswith('_')]+additional_builtins
repeated = set(kwlist)&set(builtinlist)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add spaces round &

@ccordoba12
Copy link
Member

Hey, nice improvement @mariacamilaremolinagutierrez!

Does this also fixes the problem with print shown in different colors, as reported on issue #2159?

@ccordoba12
Copy link
Member

Also, could explain what was the problem before? I mean, why coloring was not applied correctly?

@ccordoba12
Copy link
Member

ccordoba12 commented Oct 24, 2016

And more thing: you forgot to branch 3.x in your fork :-)

I mean, you directly pushed your commits on the 3.x branch of your fork, while you should have created a branch after checking out 3.x :-)

@mariacamilarg
Copy link
Contributor Author

The problem was that the words True, False and None were in both lists: keywords and builtins. I left them to be colored as builtins.

The print is not in both lists, so as another member commented on the issue, print was not a problem anymore, at least not in python 3.

Next time I'll create a new branch. My apologies!

@ccordoba12
Copy link
Member

Great, thanks a lot @mariacamilaremolinagutierrez!

@ccordoba12 ccordoba12 merged commit 4f1950b into spyder-ide:3.x Oct 24, 2016
ccordoba12 added a commit that referenced this pull request Oct 25, 2016
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.

2 participants