[Bug] C# scientific-notation literals without a decimal point are split into identifiers
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
Direzione di ricerca
Leggi src/languages/definitions/csharp/csharp.ts e confronta le regole numeriche per i valori letterali con e senza punto decimale. Riproduci il problema con gli esempi C# forniti o con chiamate a monaco.editor.tokenize, poi verifica che tutte le forme dell’esponente siano classificate come un unico token numerico, mentre gli esempi esistenti con il punto decimale continuino a essere tokenizzati correttamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Checked the code below in vscode.dev with C# language mode. Its TextMate grammar recognizes the exponent marker and digits as numeric scopes. In Monaco, the exponent marker instead becomes an identifier when the literal has no decimal point. This report is about token classification, not requiring identical theme colors between the editors.
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Reproduced in Monaco 0.57.0 and 0.58.0-dev-20261111 in the official playground. Also checked the real Monarch tokenizer using the C# definition currently on main.
Monaco Editor Playground Link
Monaco Editor Playground Code
const value = `double a = 1e3;
double b = 1.0e3;
double c = 1E+3;
double d = 1.0E+3;
double e = 1e-3;
double f = 1.0e-3;`;
monaco.editor.create(document.getElementById('container'), {
value, language: 'csharp', theme: 'vs-dark', fontSize: 20,
minimap: { enabled: false }, automaticLayout: true
});
Reproduction Steps
- Open the playground link and click Load/Run to run the example.
- Compare
1e3with1.0e3,1E+3with1.0E+3, and1e-3with1.0e-3. - For token-level confirmation after loading C#, compare
monaco.editor.tokenize('1e3', 'csharp')withmonaco.editor.tokenize('1.0e3', 'csharp').
Actual (Problematic) Behavior
The exponent is not recognized as part of the numeric literal unless a decimal point is present:
| Input | Tokens (offset: type) |
|---|---|
1e3 |
0: number.cs, 1: identifier.cs |
1E+3 |
0: number.cs, 1: identifier.cs, 2: delimiter.cs, 3: number.cs |
1e-3 |
0: number.cs, 1: identifier.cs, 2: delimiter.cs, 3: number.cs |
The controls 1.0e3, 1.0E+3, and 1.0e-3 are each a single number.float.cs token.
Expected Behavior
Recognize the exponent as part of these valid C# real literals, with or without a decimal point. The C# specification explicitly allows a decimal-digit sequence followed by an exponent, without requiring a fractional part:
Additional Context
The numeric rules in src/languages/definitions/csharp/csharp.ts recognize an optional exponent only in the rule that requires a decimal point. An integer-part-plus-exponent form falls through to the integer and identifier rules.
This is separate from the Rust exponent-sign issue #5582. The C# problem occurs with unsigned, explicitly positive and negative exponents, and depends on whether a decimal point is present.
Screenshots
- Lingua principale
- JavaScript
- Stelle
- 47k
- Fork
- 4.2k
- Merge medio
- 3g 13h
- PR unite (30g)
- 13
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/monaco-editor
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
microsoft/monaco-editor#5626 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] package.json `"typings"` points to a file which does not exist in the npm packageForse già presa @whoalin1 l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/monaco-editor#5615 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Rust scientific-notation literals without an exponent sign are split into identifiersForse già presa @Janani-bn l’ha presa 14 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/monaco-editor#5582 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Go numeric literals with underscore separators are split into identifiersForse di nuovo libera @aaronanish-t l’ha presa 25 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
microsoft/monaco-editor#5577 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] JavaScript/TypeScript tokenizer: regex literals with `/` inside `[...]` or with the `v` flag are not recognizedForse già presa @Janani-bn l’ha presa 26 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
microsoft/monaco-editor#5575 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/monaco-editor
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
[Docs] CONTRIBUTING.md links to retired GitHub Learning Lab and Try Git sitesForse già presa @adityamukesh l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
reillywalter/win-dev-doctor#92 ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature] 新增「查看完整听歌设备记录」接口Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100