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

Error in coloring of raw python strings #34

Open
Grokzen opened this Issue Mar 11, 2015 · 14 comments

Comments

Projects
None yet
4 participants
@Grokzen

Grokzen commented Mar 11, 2015

I loaded this piece of code into ST3 and when the following text was parsed as a raw string it caused a major coloring error. I guess it fails out because when [ ] is used inside a string it tries to match them and color the content.

image

Solutions that solves the problem temporarily is to remove the r before the string and then escape all special characters inside the string. This is not a desired solution tho.

@MattDMo

This comment has been minimized.

Show comment
Hide comment
@MattDMo

MattDMo Mar 11, 2015

Owner

Thanks for the feedback. Could you please post the plain text of the code you're using so I can test it?

Owner

MattDMo commented Mar 11, 2015

Thanks for the feedback. Could you please post the plain text of the code you're using so I can test it?

@MattDMo MattDMo added the bug label Mar 11, 2015

@MattDMo MattDMo self-assigned this Mar 11, 2015

@Grokzen

This comment has been minimized.

Show comment
Hide comment
@Grokzen

Grokzen Mar 11, 2015

This might not help anything but i am running the following theme and scheme

"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"theme": "Flatland Dark.sublime-theme",

Grokzen commented Mar 11, 2015

This might not help anything but i am running the following theme and scheme

"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"theme": "Flatland Dark.sublime-theme",
@MattDMo

This comment has been minimized.

Show comment
Hide comment
@MattDMo

MattDMo Mar 11, 2015

Owner

Strange. Using the Neon Color Scheme, ST3 Build 3075 (just released yesterday), and the latest version of Python Improved, your code looks fine to me:

issue_34_neon

Are you sure you're running the latest version of Python Improved?

Owner

MattDMo commented Mar 11, 2015

Strange. Using the Neon Color Scheme, ST3 Build 3075 (just released yesterday), and the latest version of Python Improved, your code looks fine to me:

issue_34_neon

Are you sure you're running the latest version of Python Improved?

@MattDMo

This comment has been minimized.

Show comment
Hide comment
@MattDMo

MattDMo Mar 11, 2015

Owner

It also doesn't seem to be an issue with Monokai:

issue_34_monokai

Owner

MattDMo commented Mar 11, 2015

It also doesn't seem to be an issue with Monokai:

issue_34_monokai

@Grokzen

This comment has been minimized.

Show comment
Hide comment
@Grokzen

Grokzen Mar 11, 2015

I tried neon color scheme and i am running on the latest ST3 (3075) release and it bugs out anyway

Grokzen commented Mar 11, 2015

I tried neon color scheme and i am running on the latest ST3 (3075) release and it bugs out anyway

@Grokzen

This comment has been minimized.

Show comment
Hide comment
@Grokzen

Grokzen Mar 11, 2015

Mkay, it apeared to be some random bug or something because i started to disable and enable packages and when i disabled all python related, then PyImproved then Python and renable them in the reverse order everything cleared out and now it renders correctly O.o

Closing this because there is no point of having it open now :] Thanks for the help anyway

Grokzen commented Mar 11, 2015

Mkay, it apeared to be some random bug or something because i started to disable and enable packages and when i disabled all python related, then PyImproved then Python and renable them in the reverse order everything cleared out and now it renders correctly O.o

Closing this because there is no point of having it open now :] Thanks for the help anyway

@Grokzen Grokzen closed this Mar 11, 2015

@MattDMo

This comment has been minimized.

Show comment
Hide comment
@MattDMo

MattDMo Mar 11, 2015

Owner

No problem. Glad you got it fixed!

Owner

MattDMo commented Mar 11, 2015

No problem. Glad you got it fixed!

@vaultah

This comment has been minimized.

Show comment
Hide comment
@vaultah

vaultah Oct 11, 2015

I don't know if the below highlighting bug (is it?) is in any way related to the issue, but this seemed to be the right place to post it.

From the source code of http.cookies:

MCVE:

Removing the r suffix solves the problem. The default Python syntax definition for ST3 gives the same result.

vaultah commented Oct 11, 2015

I don't know if the below highlighting bug (is it?) is in any way related to the issue, but this seemed to be the right place to post it.

From the source code of http.cookies:

MCVE:

Removing the r suffix solves the problem. The default Python syntax definition for ST3 gives the same result.

@MattDMo

This comment has been minimized.

Show comment
Hide comment
@MattDMo

MattDMo Oct 18, 2015

Owner

So this is either a problem with Sublime itself and bracket matching, or with the regex syntax definition. Just to be sure, I've cloned the regex syntax def from the original Python package and added it to PI with a few initial changes, unfortunately none that will address this issue. Feel free to hack at it and see what you think.

Owner

MattDMo commented Oct 18, 2015

So this is either a problem with Sublime itself and bracket matching, or with the regex syntax definition. Just to be sure, I've cloned the regex syntax def from the original Python package and added it to PI with a few initial changes, unfortunately none that will address this issue. Feel free to hack at it and see what you think.

@MattDMo

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Nov 3, 2015

The referenced issue is fixed in 3095 (and will be very hard to fix with tmLanguage syntax because of how it's structured).

In the default Python syntax def, you can use an upper case R before the string to still get a raw string but not automatic regexp syntax highlighting.

The referenced issue is fixed in 3095 (and will be very hard to fix with tmLanguage syntax because of how it's structured).

In the default Python syntax def, you can use an upper case R before the string to still get a raw string but not automatic regexp syntax highlighting.

@MattDMo

This comment has been minimized.

Show comment
Hide comment
@MattDMo

MattDMo Dec 4, 2015

Owner

This should be semi-fixed in the new 2.1 release I'm about to push - see #25. Here's how it looks using raw-regex (lowercase r):

screen shot 2015-12-04 at 12 55 14 pm

and here's how it looks using raw (uppercase R):

screen shot 2015-12-04 at 12 56 19 pm

I'm going to leave this issue open for now, just on the off chance that someone can figure out how to tweak either the main syntax or the regex syntax to make everything work with raw-regex. If you have any thoughts, please share!

Owner

MattDMo commented Dec 4, 2015

This should be semi-fixed in the new 2.1 release I'm about to push - see #25. Here's how it looks using raw-regex (lowercase r):

screen shot 2015-12-04 at 12 55 14 pm

and here's how it looks using raw (uppercase R):

screen shot 2015-12-04 at 12 56 19 pm

I'm going to leave this issue open for now, just on the off chance that someone can figure out how to tweak either the main syntax or the regex syntax to make everything work with raw-regex. If you have any thoughts, please share!

@MattDMo

This comment has been minimized.

Show comment
Hide comment
@MattDMo

MattDMo Feb 9, 2016

Owner

See also SublimeTextIssues/DefaultPackages#173 and probably others

Owner

MattDMo commented Feb 9, 2016

See also SublimeTextIssues/DefaultPackages#173 and probably others

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment