[Bug] Multiple editor instances only latest created instance is working properly
See original GitHub issueReproducible 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
/* HTML CONTENT
<div id="container" style="height: 50%"></div>
<div id="container2" style="height: 50%"></div>
*/
const model = monaco.editor.createModel("function hello() {\n\talert('Hello world!');\n}", 'javascript');
const model1 = monaco.editor.createModel("function test() {\n\talert('Hello test!');\n}", 'javascript');
const editor = monaco.editor.create(document.getElementById('container'), {
model
});
const editor2 = monaco.editor.create(document.getElementById('container2'), {
model:model1
});
editor.addCommand(monaco.KeyMod.CtrlCmd|monaco.KeyMod.Shift|monaco.KeyCode.KeyF, ()=> {
const pos = editor.getPosition();
console.log('pos', pos)
});
editor2.addCommand(monaco.KeyMod.CtrlCmd|monaco.KeyMod.Shift|monaco.KeyCode.KeyF, ()=> {
const pos = editor2.getPosition();
console.log('pos2', pos)
});
Actual Behavior
Triggering crtl + shift + f in the first instance, the custom command of the second instance will be triggered.
Expected Behavior
Triggering crtl + shift + f in any editor instance should trigger the command of the correct editor instance.
Additional Context
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:13
- Comments:12 (2 by maintainers)
Top Results From Across the Web
multiple instance of visual studio - Unity Forum
First, check that the Visual Studio Editor package is updated. Check in Windows > Package Manager of the Unity Editor to update this....
Read more >CKEditor instance already exists - Stack Overflow
I am using this before my calls to create an instance (ones per page load). Not sure how this affects memory handling and...
Read more >When running multiple instances of Visual Studio at the same ...
When running multiple instances of Visual Studio at the same time, executing a NEW instance of VS can cause in one, or more,...
Read more >Edit main components - Figma Help Center
This will also update any other instances of that component. You can only push overrides if the main component is in the same...
Read more >Open Excel files in separate windows and multiple instances
Create a new Excel instance using the taskbar. The fastest way to open a new instance of Excel is this: Right-click the Excel...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This has also been impacting us for the last few months since updating to a newer release of the editor (we are currently using 0.34.1). In our case a user may have multiple editors open (i.e. editing multiple source file). We use custom key binding CTRL + S to save the model displayed in the “active” editor. In prior versions this worked as expected, now the CTRL + S command is routed to the most-recently-opened editor instance rather than the active/in-focus editor instance, meaning that:
Hello everyone, Several months have passed. How is this problem fixed?