feat(Editor): add Mod+Enter to run code#183
Open
enkr1 wants to merge 1 commit into
Open
Conversation
Cmd+Enter (Mac) / Ctrl+Enter (Windows/Linux) now runs the current file, matching the convention from Jupyter, Colab, and Replit. F5 continues to work as before. The window keydown listener was switched to capture phase + adds stopPropagation because Monaco binds Cmd+Enter to insertLineAfter by default and calls stopPropagation, preventing bubble-phase listeners from ever firing. Capture phase fires before Monaco, so the Run action takes precedence. Hotkey now accepts ReactNode in its key map so Enter can render as a return-arrow SVG on Mac, replacing U+21A9 LEFTWARDS ARROW WITH HOOK which has an emoji presentation variant on some font stacks. Closes NUSSOC#182
✅ Deploy Preview for charming-gumption-9f94be ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Cmd+Enter (Mac) / Ctrl+Enter (Windows/Linux) as an alternative shortcut to run the current file, matching the convention from Jupyter, Colab, and Replit. F5 still works.
Closes #182.
Notes
Capture phase +
stopPropagationMonaco binds Ctrl+Enter / Cmd+Enter to
editor.action.insertLineAfterand callsstopPropagationafter handling it, so the existing bubble-phasewindowkeydown listener never fired when the editor had focus. The listener was switched to capture phase and addsstopPropagationso our handlers run before Monaco and Monaco's default action is suppressed.F5 and Cmd+S share the same listener and are unaffected — F5 has no Monaco binding, and the default Cmd+S action is a no-op without a save provider.
Hotkey rendering
The button hint was changed from
F5toMod+Enter. To render the Enter glyph consistently across systems,Hotkeywas extended to acceptReactNode(not juststring) as values, and an inline SVG return-arrow replaces the↩character. U+21A9 has an emoji presentation variant which renders as an emoji on some macOS font stacks, visually inconsistent with⌘ ⌥ ⇧ ⌃.Test plan
insertLineAftersuppressed)⌘↵on Mac