monaco-editor
monaco-editor copied to clipboard
[Bug] Language C highlights "class" as token
Reproducible in vscode.dev or in VS Code Desktop?
- [X] Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- [x] Reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
const value = `typedef struct {
xchar class;
} foo;`;
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
value,
language: "cpp",
});
Reproduction Steps
- Go to https://microsoft.github.io/monaco-editor/
- Select Language
c - Write
typedef struct {
int class;
}
Actual (Problematic) Behavior
See that class is highlighted as keyword
Expected Behavior
class is no keyword in C, it should be highlighted like any other variable
Additional Context
No response
It seems like not just "class" but all the keywords which where added in C++ but not present in C are highlighted as keyword. I looked into it and it seems there is no special file made for C language in basic languages folder. The keywords returned for .c extension is same as the ones returned for .cpp Take a look at this
What we can do is make a new folder for C language in basic languages.
Created PR to address this issue