Closed
Description
openedon Aug 18, 2022
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 Code
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: true,
noSyntaxValidation: false
});
// compiler options
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ESNext,
allowNonTsExtensions: true
});
// extra libraries
var libSource = [
'declare class Facts {',
' /**',
' * Returns the next fact',
' */',
' static next():string',
'}'
].join('\n');
var libUri = 'ts:filename/facts.d.ts';
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
// When resolving definitions and references, the editor will try to use created models.
// Creating a model for the library allows "peek definition/references" commands to work with the library.
monaco.editor.createModel(libSource, 'typescript', monaco.Uri.parse(libUri));
var jsCode = [
'"use strict";',
'',
'class Chuck {',
' static #callCount = 1',
' greet() {',
' Chuck.#callCount++;',
' return `${Chuck.#callCount}: ${Facts.next()}`();',
' }',
'}'
].join('\n');
monaco.editor.create(document.getElementById('container'), {
value: jsCode,
language: 'javascript'
});
Reproduction Steps
in a javascript
code editor, write a class
with #
private fields & inspect the token
Actual (Problematic) Behavior
private class fields are tokenised as invalid
in monaoc
In VSCode desktop it is tokenised as part of the variable...
Expected Behavior
Private token to be tokenised as part of variable or keywork or other (just not invalid
)
Additional Context
No response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment