File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1919
2020 // Delay before showing stop button to avoid flash on fast scripts
2121 let showStopButton = $state (false );
22-
22+
23+ const isMac = / Mac/ i .test (navigator .platform );
24+ const runShortcut = isMac ? ' ⌘↵' : ' Ctrl+↵' ;
25+
2326 $effect (() => {
2427 if (! $isRunning ) {
2528 showStopButton = false ;
244247 <span class =" hidden sm:inline" >Check</span >
245248 <span class ="sm:hidden" ><Icon name ="check" size ={16 } /></span >
246249 </Button >
247- <Button
248- size =" sm"
249- variant ={showStopButton ? ' secondary' : ' default' }
250- onclick ={handleRun }
251- class =" px-2 sm:px-3"
252- title ={showStopButton ? ' Stop execution' : ' Run code' }
250+ <Button
251+ size =" sm"
252+ variant ={showStopButton ? ' secondary' : ' default' }
253+ onclick ={handleRun }
254+ class =" px-2 sm:px-3"
255+ title ={showStopButton ? ' Stop execution' : ` Run code (${ runShortcut }) ` }
253256 >
254257 <span class ="sm:mr-1" ><Icon name ={showStopButton ? ' stop' : ' play' } size ={16 } /></span >
255258 <span class ="hidden sm:inline" >{showStopButton ? ' Stop' : ' Run' }</span >
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ import { luauLspExtensions } from './lspExtensions';
1919import { luauEnterKeymap , luauIndentation } from './luauBlocks' ;
2020import { forceLinting , lintGutter } from '@codemirror/lint' ;
2121import { themeMode } from '$lib/utils/theme' ;
22- import { cursorLine } from '$lib/stores/playground' ;
22+ import { cursorLine , isRunning } from '$lib/stores/playground' ;
23+ import { runCode , stopExecution } from '$lib/luau/wasm' ;
2324import { get } from 'svelte/store' ;
2425
2526let editorView : EditorView | null = null ;
@@ -66,6 +67,7 @@ function createExtensions(onChange: (content: string) => void): Extension[] {
6667 keymap . of ( [
6768 ...luauEnterKeymap ,
6869 ...closeBracketsKeymap ,
70+ { key : 'Mod-Enter' , run : ( ) => { get ( isRunning ) ? stopExecution ( ) : runCode ( ) ; return true ; } } ,
6971 ...defaultKeymap ,
7072 ...searchKeymap ,
7173 ...historyKeymap ,
You can’t perform that action at this time.
0 commit comments