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

[Bug] Python syntax highlighting does not support underscores in numeric literals #4745

Open
1 of 2 tasks
berryde opened this issue Nov 11, 2024 · 0 comments
Open
1 of 2 tasks

Comments

@berryde
Copy link

berryde commented Nov 11, 2024

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.52.0#XQAAAAKnAQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscwzyNqXz8HGcRM7llq60Xf2dFVQaKGLkRsRu_z2ZE0NWgzCg62BuIVYtanb18eMNBNJsjVjyiYVHIbaAyf-nA4BerZWoQmUlMw-vMw3l1KEgsDwXUkFxkTWBpnTf4yO_qcZeejWbg2ck2NXeVHUfoPmtoeVUkxzH0S2hd6vksr2ua8lr3VCFo3Yjoss8fLIqw0VMhVOL7PYm9fvVPtU3Kp0tpUzhjV_E85CtmMO5xILERoMbp6yNzxyCG8Ko0RhRkKQXkyVZetsnXkCKUU3yPbfu2U53W0MZbSao9Fwac1gbpMNNwYku2aST_QKM_P5J7WkQlWVUDY5ErzL3oG58Eu_Jz-gOHa2geOwo_Mop__-LpYMQ

Monaco Editor Playground Code

const value = /* set from `myEditor.getModel()`: */ `# '100_000' should be formatted as a single value per https://peps.python.org/pep-0515/
numeric_literal_example = 100_000`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "python",
	automaticLayout: true,
});

Reproduction Steps

Open the playground link. Verify that 100_000 is formatted inconsistently.

Actual (Problematic) Behavior

Numeric literals with underscores are not highlighted as a single value by the syntax highlighter.

Image

Expected Behavior

Numeric literals with underscores should be highlighted as a single value, as is done in VS Code.

Image

Additional Context

Numeric literals with underscores were proposed in https://peps.python.org/pep-0515/ and have been supported since Python 3.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant