Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/lib/components/TabBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@

// Delay before showing stop button to avoid flash on fast scripts
let showStopButton = $state(false);


const isMac = /Mac/i.test(navigator.platform);
const runShortcut = isMac ? '⌘↵' : 'Ctrl+↵';

$effect(() => {
if (!$isRunning) {
showStopButton = false;
Expand Down Expand Up @@ -244,12 +247,12 @@
<span class="hidden sm:inline">Check</span>
<span class="sm:hidden"><Icon name="check"size={16} /></span>
</Button>
<Button
size="sm"
variant={showStopButton ? 'secondary' : 'default'}
onclick={handleRun}
class="px-2 sm:px-3"
title={showStopButton ? 'Stop execution' : 'Run code'}
<Button
size="sm"
variant={showStopButton ? 'secondary' : 'default'}
onclick={handleRun}
class="px-2 sm:px-3"
title={showStopButton ? 'Stop execution' : `Run code (${runShortcut})`}
>
<span class="sm:mr-1"><Icon name={showStopButton ? 'stop' : 'play'} size={16} /></span>
<span class="hidden sm:inline">{showStopButton ? 'Stop' : 'Run'}</span>
Expand Down
4 changes: 3 additions & 1 deletion src/lib/editor/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import { luauLspExtensions } from './lspExtensions';
import { luauEnterKeymap, luauIndentation } from './luauBlocks';
import { forceLinting, lintGutter } from '@codemirror/lint';
import { themeMode } from '$lib/utils/theme';
import { cursorLine } from '$lib/stores/playground';
import { cursorLine, isRunning } from '$lib/stores/playground';
import { runCode, stopExecution } from '$lib/luau/wasm';
import { get } from 'svelte/store';

let editorView: EditorView | null = null;
Expand Down Expand Up @@ -66,6 +67,7 @@ function createExtensions(onChange: (content: string) => void): Extension[] {
keymap.of([
...luauEnterKeymap,
...closeBracketsKeymap,
{ key: 'Mod-Enter', run: () => { get(isRunning) ? stopExecution() : runCode(); return true; } },
...defaultKeymap,
...searchKeymap,
...historyKeymap,
Expand Down