microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.69k stars 769 forks source link

Raw f-strings lose raw-string coloring #4746

Open Avasam opened 1 year ago

Avasam commented 1 year ago

Environment data

Code Snippet

image

string = "string"
raw_string = r"raw_string\n"
f_string = f"f-{string}"
raw_f_string = rf"f-{raw_string}\n"
raw_f_string2 = fr"f-{raw_string}\n"

Repro Steps

  1. Type the above code in VSCode

Expected behavior

the strings using rf or fr should have the same coloring as raw_string with the escape sequence \n highlighted as well

Actual behavior

It has regular string color.

Logs

2023-08-22 19:17:50.966 [info] [Info  - 7:17:50 PM] (7056) Pylance language server 2023.8.31 (pyright 03f79a81) starting
2023-08-22 19:17:50.966 [info] [Info  - 7:17:50 PM] (7056) Server root directory: c:\Users\Avasam\.vscode\extensions\ms-python.vscode-pylance-2023.8.31\dist
2023-08-22 19:17:50.975 [info] [Info  - 7:17:50 PM] (7056) Starting service instance "pywin32"
2023-08-22 19:17:51.017 [info] [Info  - 7:17:51 PM] (7056) Setting pythonPath for service "pywin32": "C:\Program Files\Python39\python.exe"
2023-08-22 19:17:51.018 [info] [Warn  - 7:17:51 PM] (7056) stubPath e:\Users\Avasam\Documents\Git\pywin32\typings is not a valid directory.
2023-08-22 19:17:51.223 [info] [Info  - 7:17:51 PM] (7056) Assuming Python version 3.9
2023-08-22 19:17:51.679 [info] [Info  - 7:17:51 PM] (7056) Found 728 source files
Avasam commented 11 months ago

Reproduction is present in issue description

rchiodo commented 11 months ago

I would hazard a guess this is handled by the tmlanguage file that VS code ships for Python.