Skip to content

[Bug] Semantic validation across multiple editor instances #2976

Open

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 Code

monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  noSyntaxValidation: false,
  noSemanticValidation: false
})

monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  allowJs: true,
  checkJs: true,
  allowNonTsExtensions: true
})

monaco.editor.create(document.getElementById('container1'), {
  model: monaco.editor.createModel('const abc = 1', 'javascript', monaco.Uri.parse('file:///a.js'))
})

monaco.editor.create(document.getElementById('container2'), {
  model: monaco.editor.createModel('const abc = 2', 'javascript', monaco.Uri.parse('file:///b.js'))
})

<div id="container1" style="height: 50%"></div>
<div id="container2" style="height: 50%"></div>

Actual Behavior

Both editor instances prompt "Cannot redeclare block-scoped variable 'abc'." error.

Expected Behavior

No error prompt. It should be possible to use variables with the same name in two different files.

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions