microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
40.61k stars 3.61k forks source link

[Bug] new support for Python f-strings breaks with multi-line f-strings #4601

Open dylanscott opened 4 months ago

dylanscott commented 4 months ago

Reproducible in vscode.dev or in VS Code Desktop?

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

Link

CleanShot 2024-07-12 at 11 08 38@2x

Monaco Editor Playground Code

single_line_f_string f'''nothing {'to see'} here'''

multi_line_f_string = f"""first line looks fine
{'uh oh'}
now the highlighting is broken down here :(
"""

also = "it's broken highlighting for everything after"
four = 2 + 2

Reproduction Steps

  1. Configure an editor using the built-in python language
  2. Enter a multi-line f-string which has an expression after the 1st line

Actual (Problematic) Behavior

The portion of the f-string after the expression is highlighted as python code instead of a string, and then the closing f-string delimiter causes code after that to be highlighted as if it were a string

Expected Behavior

Self evident

Additional Context

I believe this was added with #4401, which notably does not have multi-line f-strings in its test coverage.

ivanksh commented 3 months ago

It is reproducible for me too

rubenfiszel commented 2 months ago

Reproducible for us too at windmill.dev, it seems a pretty severe bug for the editing experience

PaGrom commented 1 month ago

Affects me too.