microsoft / microsoft/monaco-editor

[Bug] Expressions using Python's matrix multiplication operator highlighted as decorator

Open
#4,667 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug confirmed editor-highlight
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?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.51.0#XQAAAAIwAQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscqxB-B77H9Q9THIoLKcz1i5d20PZyLmqXXTWKyT1GfrJ3XAwToPtHwWASnqo0pHyQvtl4_6akIQ3DyrzBgpymGnY_jji3P1vsp5emiBptpJw5uXClnzkneYp-sxi3UrdSNu3fScLGvZT045b6hr9M_of4Gfj07xZRrn0PTcn5tL-LywJQ8-Def16L0XlruzwYRf-MajBh2s__wUC-dN0DHuRhFpeS2_WAlUqJUvTbPyE17kYmh2Or1dX5zajRirP64xFE

Monaco Editor Playground Code
x@y
Reproduction Steps

Use the matrix multiplication operator in a Python expression without placing a space after the operator.

Actual (Problematic) Behavior

a@b gets syntax highlighted as if @b were a decorator. It is not.

Expected Behavior

a@b being syntax highlighted the same as a @ b since whitespace does not change meaning there.

Additional Context

https://peps.python.org/pep-0465/ relevant pep
https://python.godbolt.org/z/devGMWf11 actual usage example. Compiler Explorer uses Monaco.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the Monaco Editor Playground using the provided x@y example, then compare it with x @ y. Trace the Python syntax-highlighting rules responsible for decorators and matrix multiplication, and add regression coverage showing both forms receive equivalent highlighting. Done means the compact expression is no longer treated as a decorator.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.