I'm probably being stupid, but I can't figure out how to show the find/replace widget in the Azure editor.
It definitely exists:

…and pressing F3 or Ctrl+F does show the find widget.
In your playground, there is a little â–· to show the replace box from the find view:

But this isn't the case in Azure:

Pressing all kinds of keyboard shortcuts is doing different things (by trial-and-error); but I can't seem to find the one for find/replace.
PS: Ran a grep -R for editor.addCommand; keybinding & replace; findController; closeFindWidget on this repo, but couldn't find anything relevant.
AFAIK the button is disabled if the editor is read-only. i.e. replace is disabled in a read-only editor
The Azure one I'm working with is read/write.
@SamuelMarks Are you able to edit text in that editor component? It also looks to me like the editor is in readOnly mode, in which case it will hide the little expand arrow.
Yes I am able to edit the text. I am not able to find/replace though.
@SamuelMarks
Here is the code that disables/enables that find/replace toggle:
https://github.com/Microsoft/vscode/blob/09f3922283dfad507e1f13eb92803e5e17d5189c/src/vs/editor/contrib/find/findWidget.ts#L363:L365
Given you have not forked the editor, it should be built from those sources, and the find/replace toggle should be disabled only when the editor is read-only.
Hopefully there's a better way to do this that I wasn't able to find, but in order to get the list of all registered commands one could add the following lines:
console.log ( this.id );
const { primary, secondary, win, linux, mac } = this._kbOpts;
console.log ( JSON.stringify ({ primary, secondary, win, linux, mac, when: kbWhen }) );
Right before the KeybindingsRegistry.registerCommandAndKeybindingRule call in node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js.
If you're only loading the following files, which define shortcuts, like I am:
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
import 'monaco-editor/esm/vs/editor/contrib/dnd/dnd.js';
import 'monaco-editor/esm/vs/editor/contrib/linesOperations/linesOperations.js';
import 'monaco-editor/esm/vs/editor/contrib/multicursor/multicursor.js';
import 'monaco-editor/esm/vs/editor/contrib/wordOperations/wordOperations.js';
Then with a bit of cleaning up you get the following object, which doesn't look pretty but we can work with it:
const CMD = {
'actions.find': { primary: 2084, when: null },
'actions.findWithSelection': { primary: 0, mac: { primary: 2083 }, when: null },
'cancelSelection': { primary: 9, secondary: [1033], when: { expr: [{ key: 'editorHasSelection' , _defaultValue: false }, { key: 'textInputFocus' , _defaultValue: false }] } },
'closeFindWidget': { primary: 9, secondary: [1033], when: { expr: [{ key: 'editorFocus' , _defaultValue: false }, { key: 'findWidgetVisible' , _defaultValue: false }] } },
'cursorBottom': { primary: 2061, mac: { primary: 2066 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorBottomSelect': { primary: 3085, mac: { primary: 3090 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorColumnSelectDown': { primary: 3602, linux: { primary: 0 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorColumnSelectLeft': { primary: 3599, linux: { primary: 0 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorColumnSelectPageDown': { primary: 3596, linux: { primary: 0 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorColumnSelectPageUp': { primary: 3595, linux: { primary: 0 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorColumnSelectRight': { primary: 3601, linux: { primary: 0 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorColumnSelectUp': { primary: 3600, linux: { primary: 0 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorDown': { primary: 18, mac: { primary: 18, secondary: [300] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorDownSelect': { primary: 1042, secondary: [3090], linux: { primary: 1042 }, mac: { primary: 1042 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorEnd': { primary: 13, mac: { primary: 13, secondary: [2065] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorEndSelect': { primary: 1037, mac: { primary: 1037, secondary: [3089] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorHome': { primary: 14, mac: { primary: 14, secondary: [2063] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorHomeSelect': { primary: 1038, mac: { primary: 1038, secondary: [3087] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorLeft': { primary: 15, mac: { primary: 15, secondary: [288] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorLeftSelect': { primary: 1039, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorLineEnd': { primary: 0, mac: { primary: 291 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorLineStart': { primary: 0, mac: { primary: 287 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorPageDown': { primary: 12, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorPageDownSelect': { primary: 1036, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorPageUp': { primary: 11, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorPageUpSelect': { primary: 1035, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorRight': { primary: 17, mac: { primary: 17, secondary: [292] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorRightSelect': { primary: 1041, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorTop': { primary: 2062, mac: { primary: 2064 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorTopSelect': { primary: 3086, mac: { primary: 3088 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorUp': { primary: 16, mac: { primary: 16, secondary: [302] }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorUpSelect': { primary: 1040, secondary: [3088], linux: { primary: 1040 }, mac: { primary: 1040 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorWordEndRight': { primary: 2065, mac: { primary: 529 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorWordEndRightSelect': { primary: 3089, mac: { primary: 1553 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorWordStartLeft': { primary: 2063, mac: { primary: 527 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'cursorWordStartLeftSelect': { primary: 3087, mac: { primary: 1551 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'deleteAllLeft': { primary: 0, mac: { primary: 2049 }, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'deleteAllRight': { primary: 0, mac: { primary: 297, secondary: [2068] }, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'deleteLeft': { primary: 1, secondary: [1025], mac: { primary: 1, secondary: [1025,294,257] }, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'deleteRight': { primary: 20, mac: { primary: 20, secondary: [290,276] }, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'deleteWordLeft': { primary: 2049, mac: { primary: 513 }, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.addSelectionToNextFindMatch': { primary: 2082, when: { key: 'editorFocus' , _defaultValue: false } },
'editor.action.changeAll': { primary: 2108, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.copyLinesDownAction': { primary: 1554, linux: { primary: 3602 }, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.copyLinesUpAction': { primary: 1552, linux: { primary: 3600 }, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.deleteLines': { primary: 3113, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.diffReview.next': { primary: 65, when: { key: 'isInDiffEditor' } },
'editor.action.diffReview.prev': { primary: 1089, when: { key: 'isInDiffEditor' } },
'editor.action.indentLines': { primary: 2137, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.insertCursorAbove': { primary: 2576, linux: { primary: 1552, secondary: [3088] }, when: { key: 'editorTextFocus' , _defaultValue: false } },
'editor.action.insertCursorAtEndOfEachLineSelected': { primary: 1575, when: { key: 'editorTextFocus' , _defaultValue: false } },
'editor.action.insertCursorBelow': { primary: 2578, linux: { primary: 1554, secondary: [3090] }, when: { key: 'editorTextFocus' , _defaultValue: false } },
'editor.action.insertLineAfter': { primary: 2051, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.insertLineBefore': { primary: 3075, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.joinLines': { primary: 0, mac: { primary: 296 }, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.moveLinesDownAction': { primary: 530, linux: { primary: 530 }, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.moveLinesUpAction': { primary: 528, linux: { primary: 528 }, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.moveSelectionToNextFindMatch': { primary: 136448041, when: { key: 'editorFocus' , _defaultValue: false } },
'editor.action.nextMatchFindAction': { primary: 61, mac: { primary: 2085, secondary: [61] }, when: { key: 'editorFocus' , _defaultValue: false } },
'editor.action.nextSelectionMatchFindAction': { primary: 2109, when: { key: 'editorFocus' , _defaultValue: false } },
'editor.action.outdentLines': { primary: 2135, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'editor.action.previousMatchFindAction': { primary: 1085, mac: { primary: 3109, secondary: [1085] }, when: { key: 'editorFocus' , _defaultValue: false } },
'editor.action.previousSelectionMatchFindAction': { primary: 3133, when: { key: 'editorFocus' , _defaultValue: false } },
'editor.action.replaceAll': { primary: 2563, when: { expr: [{ key: 'editorFocus' , _defaultValue: false }, { key: 'findWidgetVisible' , _defaultValue: false }] } },
'editor.action.replaceOne': { primary: 3094, when: { expr: [{ key: 'editorFocus' , _defaultValue: false }, { key: 'findWidgetVisible' , _defaultValue: false }] } },
'editor.action.selectAll': { primary: 2079, when: { key: 'textInputFocus' , _defaultValue: false } },
'editor.action.selectAllMatches': { primary: 515, when: { expr: [{ key: 'editorFocus' , _defaultValue: false }, { key: 'findWidgetVisible' , _defaultValue: false }] } },
'editor.action.selectHighlights': { primary: 3114, when: { key: 'editorFocus' , _defaultValue: false } },
'editor.action.startFindReplaceAction': { primary: 2086, mac: { primary: 2596 }, when: null },
'editor.action.trimTrailingWhitespace': { primary: 137758761, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'expandLineSelection': { primary: 2090, when: { key: 'textInputFocus' , _defaultValue: false } },
'lineBreakInsert': { primary: 0, mac: { primary: 301 }, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'outdent': { primary: 1026, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }, { key: 'editorTabMovesFocus' }] } },
'redo': { primary: 2103, secondary: [3128], mac: { primary: 3128 }, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } },
'removeSecondaryCursors': { primary: 9, secondary: [1033], when: { expr: [{ key: 'editorHasMultipleSelections' , _defaultValue: false }, { key: 'textInputFocus' , _defaultValue: false }] } },
'scrollLineDown': { primary: 2066, mac: { primary: 268 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'scrollLineUp': { primary: 2064, mac: { primary: 267 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'scrollPageDown': { primary: 2060, win: { primary: 524 }, linux: { primary: 524 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'scrollPageUp': { primary: 2059, win: { primary: 523 }, linux: { primary: 523 }, when: { key: 'textInputFocus' , _defaultValue: false } },
'tab': { primary: 2, when: { expr: [{ key: 'editorTextFocus' , _defaultValue: false }, { key: 'editorReadonly' }, { key: 'editorTabMovesFocus' }] } },
'toggleFindCaseSensitive': { primary: 545, mac: { primary: 2593 }, when: { key: 'editorFocus' , _defaultValue: false } },
'toggleFindInSelection': { primary: 554, mac: { primary: 2602 }, when: { key: 'editorFocus' , _defaultValue: false } },
'toggleFindRegex': { primary: 560, mac: { primary: 2608 }, when: { key: 'editorFocus' , _defaultValue: false } },
'toggleFindWholeWord': { primary: 565, mac: { primary: 2613 }, when: { key: 'editorFocus' , _defaultValue: false } },
'undo': { primary: 2104, when: { expr: [{ key: 'textInputFocus' , _defaultValue: false }, { key: 'editorReadonly' }] } }
};
Is there a way to turn those primarys into the KeyMod/KeyCode combo?
Most helpful comment
Hopefully there's a better way to do this that I wasn't able to find, but in order to get the list of all registered commands one could add the following lines:
Right before the
KeybindingsRegistry.registerCommandAndKeybindingRulecall innode_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js.If you're only loading the following files, which define shortcuts, like I am:
Then with a bit of cleaning up you get the following object, which doesn't look pretty but we can work with it: