microsoft / microsoft/monaco-editor
[Bug] Highlight exception in multi line string text of python code
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `a = f'''
line1
line2
print('error')
'''`;
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
value,
language: 'python',
automaticLayout: true,
});
Reproduction Steps
If f'''xxxxxx''' is used to represent a multi line string, only the first line is recognized as a string
Actual (Problematic) Behavior
The second to fourth lines should be highlighted as strings, but in reality, only the second line is highlighted as a string
Expected Behavior
Highlight multiple lines of string normally
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Monaco Editor Playground and its TypeScript reproduction using the Python language mode. Confirm that the multiline f-string highlights only its first line, then trace the Python syntax-highlighting behavior involved. Done means all lines inside the multiline string, including the line containing print('error'), are highlighted as string text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- developer-experience, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100