question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Raw string highlighting

See original GitHub issue

Environment data

VS Code version: 1.18.1 Python Extension version: 0.80.0 Python Version: CPython 3.5.4 32b OS and version: Windows 7 Pro SP1 x64

Actual behavior

I have the following line

fops.save_txt(environ['SystemRoot'] + r'\explorer.exe '
                      + bdexp.EXPORTS_DIR,
                      bpl.PROGS_TO_LAUNCH_PN)

and the r and \e shows in blue with the first ’ and xplorer.exe ’ shows in brown(?). My point is that it isn’t recognizing it as a string (raw in this case) like it does with the previous ‘SystemRoot’ which shows all brown(?) and the Intellisense recognizes as a string.

Expected behavior

It should show r’\explorer.exe ’ all brown(?) and recognize it as a string.

I reported this first in VS Code Python at https://github.com/Microsoft/vscode-python/issues/337#issuecomment-349069613 but Brett Cannon told me to open it here because their syntax highlighting depends on MagicPython.

Thanks,

JM

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
elpranscommented, Dec 4, 2017

This is a feature.

foo = r'\nregexp'  # this is parsed as a "regexp-string"
bar = R'\nregexp'  # this is parsed as a raw string
1reaction
jcrmatoscommented, Dec 4, 2017

Hello,

I understand. Can I ask you please to add a Settings option to disable that behavior?

Thanks,

JM

Read more comments on GitHub >

github_iconTop Results From Across the Web

Literal raw string/bytes backslashes are highlighted as escapes
Backslashes (and the characters that follow them) in raw string literals and raw byte literals should not be highlighted.
Read more >
How would you go about highlighting C++ raw string literals ...
I have managed to make all raw string literals to be highlighted as sqlite , by defining this in my after/queries/cpp/injections.scm :
Read more >
Go syntax highlighting misparses backslashes in raw string ...
Issue 3499: Go syntax highlighting misparses backslashes in raw string literals (e.g., `\`). Reported by schedule mdempsky@google.com ...
Read more >
The escape backslash highlighting fails on python raw strings ...
Look at this screen shot: Expected the raw string to have highlighting as well. image.png. Be sure to fix it for all types...
Read more >
Broken Python syntax highlighting when raw strings ... - GitLab
Summary Syntax highlighting fails after a Python raw string is encountered. All the subsequent code is wrongly displayed as a string....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found