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

Raw string syntax highlighting is misleading #6939

Closed
pwilkin opened this issue Feb 10, 2025 · 1 comment
Closed

Raw string syntax highlighting is misleading #6939

pwilkin opened this issue Feb 10, 2025 · 1 comment
Assignees
Labels
duplicate This issue or pull request already exists textmate bug

Comments

@pwilkin
Copy link

pwilkin commented Feb 10, 2025

Type: Bug

If you use a raw string literal that contains backslashes, the syntax highlighting will be changed to red, but letters after the backslashes and the backslashes themselves will be still marked as yellow, suggesting they are escape characters, i.e.:

dest = r'M:\Updated files'

the "\U" part is colored yellow. As per raw string specification, the only thing that should actually get this treatment is the enclosing quote character when prefixed by a backslash, so in r'foo\'s' the "'" should be recognized as an escape sequence, but otherwise the backspace functions as a normal character (and one of the common uses of raw strings is to provide Windows path literals, so the misleading case will happen often).

Extension version: 2025.1.2025021001
VS Code version: Code 1.97.0 (33fc5a94a3f99ebe7087e8fe79fbe1d37a251016, 2025-02-04T22:41:26.688Z)
OS version: Windows_NT x64 10.0.26100
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.6
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
bun-vscode ove 0.0.26
continue Con 0.8.68
debugpy ms- 2025.0.0
dscodegpt Dan 3.8.42
githistory don 0.6.20
intellicode-api-usage-examples Vis 0.2.9
js-debug ms- 1.97.0
js-debug-companion ms- 1.1.3
npm-intellisense chr 1.4.5
python ms- 2025.1.2025021001
reflow-markdown mar 3.1.0
remote-containers ms- 0.397.0
remote-wsl ms- 0.88.5
rest-client hum 0.25.1
ts-debug kak 0.0.6
vsc-python-indent Kev 1.19.0
vscode-docker ms- 1.29.4
vscode-js-profile-table ms- 1.0.10
vscode-pylance ms- 2025.2.1
vscode-python-envs ms- 0.3.10411011
vscodeintellicode Vis 1.3.2
System Info
Item Value
CPUs Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 x 3600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 23.92GB (10.64GB free)
Process Argv --crash-reporter-id 24798850-605b-416d-a0f8-7431e116d62e
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
a9j8j154:30646983
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31233690
9064b325:31222308
copilot_t_ci:31222730
jda6j935:31233686

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Feb 12, 2025
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Feb 12, 2025
@debonte
Copy link
Contributor

debonte commented Feb 12, 2025

This is a dupe of #6114. Specifically, see this comment: #6114 (comment)

@debonte debonte closed this as completed Feb 12, 2025
@debonte debonte added duplicate This issue or pull request already exists textmate bug and removed needs repro Issue has not been reproduced yet labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists textmate bug
Projects
None yet
Development

No branches or pull requests

3 participants