Closed Binaryify closed 2 years ago
This appears to be a bug in the textmate grammar for Python. This grammar is built in to VS Code, not shipped as part of Pylance, which is correctly tokenizing and parsing raw strings. We'll need to work with the VS Code team to get this fixed.
@Binaryify and @erictraut I am not a frequent Python user, so please correct me if I've misunderstood something, but I think this is a feature: https://github.com/MagicStack/MagicPython/issues/114#issuecomment-349115524 (that's the repo that VS Code pulls our Python syntax highlighting grammar from).
@Haoyu-UT
@alexr00 Thank you for your comment. I now come to understand that for vscode (and MagicPython) r and R are interpreted differently. I'm sorry for my ignorance. @Binaryify Thank you for your support. Please kindly close the original issue.
Environment data
Version: 1.68.1 (Universal) Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630 Date: 2022-06-14T12:52:13.188Z Electron: 17.4.7 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin arm64 21.4.0
Code Snippet
r'paper\cell_b.png' == 'paper\\cell_b.png'
is evaluated as True in Python. Raw string has "r" before it, and it means string without backslash escape in Python. It's especially useful for handling paths in Windows.the origin issue: https://github.com/Binaryify/OneDark-Pro/issues/749