+ {/* ------------------------------------------------------------------ */}
+ {/* Top toolbar */}
+ {/* ------------------------------------------------------------------ */}
+
+ {/* Left: language selector + language badge */}
+
+
+
+
+
+ {/* Centre: action buttons */}
+
+ {/* Run */}
+
+
+ {/* Format */}
+
+
+ {/* Reset */}
+
+
+ {/* Font size */}
+
+
+
+ {fontSize}
+
+
+
+
+ {/* Theme toggle */}
+
+
+
+ {/* Right: auto-completion + collaborators */}
+
+
+
+ {/* ------------------------------------------------------------------ */}
+ {/* Monaco editor */}
+ {/* ------------------------------------------------------------------ */}
+
+ }>
+ setCode(val ?? '')}
+ onMount={handleEditorMount}
+ options={{
+ fontSize,
+ minimap: { enabled: true },
+ wordWrap: 'on',
+ lineNumbers: 'on',
+ renderLineHighlight: 'all',
+ scrollBeyondLastLine: false,
+ automaticLayout: true,
+ padding: { top: 12, bottom: 12 },
+ suggestOnTriggerCharacters: autoCompleteEnabled,
+ quickSuggestions: autoCompleteEnabled,
+ tabSize: languageConfig.id === 'python' ? 4 : 2,
+ detectIndentation: false,
+ formatOnPaste: true,
+ smoothScrolling: true,
+ cursorBlinking: 'expand',
+ cursorSmoothCaretAnimation: 'on',
+ bracketPairColorization: { enabled: true },
+ fontFamily: '"Fira Code", "Cascadia Code", "Consolas", monospace',
+ fontLigatures: true,
+ }}
+ height="100%"
+ width="100%"
+ />
+
+
+
+ {/* ------------------------------------------------------------------ */}
+ {/* Status bar */}
+ {/* ------------------------------------------------------------------ */}
+
+
+ .{languageConfig.extension}
+ {validationErrors.length > 0 ? (
+
+
+ {validationErrors.length} issue{validationErrors.length > 1 ? 's' : ''}
+
+ ) : (
+
+ OK
+
+ )}
+
+
+ Ln {1} · UTF-8 · {theme === 'vs-dark' ? 'Dark' : 'Light'}
+
+
+
+ {/* ------------------------------------------------------------------ */}
+ {/* Output panel */}
+ {/* ------------------------------------------------------------------ */}
+ {output && (
+
+ {/* Output header */}
+
+
+
+
+ Output
+
+ {/* Exit code badge */}
+
+ exit {output.exitCode}
+
+ {output.executionTimeMs}ms
+
+
+
+
+ {/* stdout */}
+ {output.stdout && (
+
+ {output.stdout}
+
+ )}
+
+ {/* stderr */}
+ {output.stderr && (
+
+ {output.stderr}
+
+ )}
+
+ )}
+
+ );
+};
diff --git a/src/components/code/AutoCompletion.tsx b/src/components/code/AutoCompletion.tsx
new file mode 100644
index 0000000..ad478d2
--- /dev/null
+++ b/src/components/code/AutoCompletion.tsx
@@ -0,0 +1,91 @@
+import React from 'react';
+import { Zap, ZapOff } from 'lucide-react';
+import { getAutoCompletionSuggestions, type CompletionSuggestion } from '@/utils/codeUtils';
+
+interface AutoCompletionProps {
+ language: string;
+ word: string;
+ enabled: boolean;
+ onToggle: () => void;
+ onSelect?: (suggestion: CompletionSuggestion) => void;
+}
+
+const KIND_COLORS: Record