Editor Settings
EktuPy’s editor includes several customizable settings to enhance your coding experience. Access settings by clicking the Settings button in the top navigation bar.
Theme
Switch between light and dark themes for comfortable coding in any environment.
| Theme | Description |
|---|---|
| Light | Bright background with dark text (default) |
| Dark | Dark background with light text, easier on eyes in low-light |
Your theme preference is saved automatically and persists across sessions.
Enable LSP (Language Server Protocol)
The LSP toggle controls syntax checking and code intelligence features.
- Default: Off
- Saved to:
localStorage(key:ektupy-lsp)
When LSP is OFF
- No syntax error markers
- No lint gutter (red/yellow dots)
- No autocomplete suggestions
- Faster initial page load
When LSP is ON
- Real-time syntax checking as you type
- Red underlines for syntax errors
- Error markers in the gutter
- Autocomplete suggestions (Ctrl+Space or as-you-type)
- Hover information on functions and methods
Why OFF by Default?
- Performance: The syntax checker (Pyodide, ~15MB) loads in the background
- Simplicity: Beginners may find error markers distracting while learning
- Choice: Advanced users can enable it when they want syntax feedback
Type Checking (ty)
The type checking toggle enables advanced static type analysis using ty (Astral’s Python type checker).
- Default: Off
- Saved to:
localStorage(key:ektupy-typecheck) - Requires: LSP must be enabled first
When Type Checking is OFF
Uses the basic syntax-worker (Pyodide) which detects:
- Syntax errors (missing colons, parentheses, etc.)
- Invalid sprite/sound names
- Invalid key names in
@on_key_press
When Type Checking is ON
Uses the ty-worker (ty_wasm) which adds:
- Type errors:
a: int = "hello"is flagged - Undefined variables: Using a variable before defining it
- Method existence: Calling non-existent methods on sprites
- Full EktuPy API validation: All Stage/Sprite methods are checked
Example: Type Error Detection
# With Type Checking OFF - no error shown
a: int = "hello"
# With Type Checking ON - error shown:
# "Object of type `str` is not assignable to declared type `int`"
Toggle Dependency
The Type Checking toggle is disabled (grayed out) when LSP is off:
| LSP | Type Checking | Behavior |
|---|---|---|
| OFF | OFF | No checking, toggle disabled |
| OFF | ON | Not allowed (toggle disabled) |
| ON | OFF | Basic syntax checking only |
| ON | ON | Full type checking |
Font Size
Adjust the editor font size for better readability.
- Controls: A- (decrease), current size display, A+ (increase)
- Range: 10px to 24px
- Default: 14px
- Saved to:
localStorage(key:ektupy-font-size)
Settings Summary
| Setting | Default | Storage Key | Effect |
|---|---|---|---|
| Theme | Light | ektupy-theme | Editor color scheme |
| Enable LSP | Off | ektupy-lsp | Syntax checking & autocomplete |
| Type Checking (ty) | Off | ektupy-typecheck | Static type analysis |
| Font Size | 14px | ektupy-font-size | Editor text size |
How the Linting System Works
Architecture Overview
┌─────────────────────────────────────────────────────┐
│ Main Thread │
│ ┌──────────────┐ ┌─────────────────┐ │
│ │ CodeMirror │────▶│ pythonLinter() │ │
│ │ Editor │◀────│ (orchestrator) │ │
│ └──────────────┘ └────────┬────────┘ │
│ │ │
│ ┌─────────────────┼─────────────────┐ │
│ │ ty enabled? │ │ │
│ ▼ ▼ │ │
│ ┌────────┐ ┌────────┐ │ │
│ │ No │ │ Yes │ │ │
│ └────┬───┘ └────┬───┘ │ │
└──────────────┼─────────────────┼────────────────┘
│ │
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ syntax-worker │ │ ty-worker │
│ (Pyodide) │ │ (ty_wasm) │
│ │ │ │
│ • ast.parse() │ │ • Full type checker │
│ • ~15MB download │ │ • EktuPy stubs │
│ • Basic checking │ │ • ~13MB download │
└──────────────────────┘ └──────────────────────┘
Data Flow
- User types code → CodeMirror captures changes
- Debounce (500ms) → Prevents excessive checking
- pythonLinter() → Checks which worker to use based on settings
- Worker receives code → Analyzes for errors
- Results returned → Converted to CodeMirror diagnostics
- UI updated → Error underlines and gutter markers displayed
Error Marker Colors
| Color | Meaning |
|---|---|
| Red underline | Error (syntax error, type error) |
| Yellow underline | Warning (unused import, deprecated usage) |
| Red dot in gutter | Line contains an error |
| Yellow dot in gutter | Line contains a warning |
Hover over an error underline to see the full error message.