Change:
}; } <ins> beforeRender(): IDimension | null { const [accept, preview] = this._acceptKeybindings; this._label!.innerText = localize({ key: 'label', comment: ['placeholders are keybindings, e.g "F2 to Rename, Shift+F2 to Preview"'] }, "{0} to Rename, {1} to Preview", this._keybindingService.lookupKeybinding(accept)?.getLabel(), this._keybindingService.lookupKeybinding(preview)?.getLabel()); return null; } </ins> afterRender(position: ContentWidgetPositionPreference | null): void { if (!position) { // cancel rename when input widget isn't rendered anymore

Discussion:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes VS Code Version: trunk commit OS Version: Win 11 Steps to Reproduce: using Monaco standalone inside an Excel add-in (Advanced Formula Environment, developed by Microsoft Research) have a page in our add-in where we create ~hundred Monaco editors at once, in a scrollable pane (one per cell - with the editor showing the contents of the cell as a "file"). have a nasty performance issue where we would like to call to register keybindings on each editor. However - we instead have to do that lazily when the editor first receives focus. This is because it takes ~10ms just to register the actions on the editor (and if you have 100+ Monaco editors, that's prohibitive). is the call stack that accounts for 75% of the cost of instantiating a Monaco editor!! StandaloneCodeEditor.addAction StandaloneKeybindingService.addDynamicKeybinding onDidUpdateKeybindings notification RenameInputField, updateLabel method (registered for the update-keybindings event in getDomNode) real issue here, is that even when you're not doing any renaming at all, the RenameInputField is always inserted into the DOM, and is registered to keep that DOM up-to-date via keybinding notifications. Clearly, this is wasteful: we should only be keeping the DOM updated with the keybindings when the rename widget is visible. There should be no DOM manipulation at all in a callback like onDidUpdateKeybindings! I have a PR to fix this issue (subject to approval). This cuts the cost of addActions dramatically, enabling us to instantiate many Monaco editors an order of magnitude more quickly. Inside StandaloneCodeEditor.addAction, there is a direct call to Later within the same method however, inside , there is an identical call to . This results in duplicate registration of the command - the LinkedList holding the commands ends up with multiple identical nodes.

Is this a bug in ? It seems to be harmless but surely unintentional.
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.75.1. Please try upgrading to the latest version and checking whether this issue remains. Happy Coding!