You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`_hasState()`: Override to control same-file rehydration (e.g., Judge checks `_runtime.state.length > 0`)
21
30
22
31
When switching files, processes are **not** stopped. Instead, they are moved to the background (e.g., via `_moveCurrentStateToBackground`) and trigger `_onDidChangeBackgroundTasks`. The `PanelViewProvider` monitors and displays these running background tasks.
23
32
24
33
## Run Settings
25
34
26
-
-**`runSettingsCommands.ts`**: Registers commands (`editRunSettings`, `resetRunSettings`) and provides default `languageTemplates`.
35
+
-**`runSettingsCommands.ts`**: Registers commands (`editRunSettings`, `resetRunSettings`) and provides default `languageTemplates` for various languages (C++/GCC, C++/Clang, Python, PyPy, Java, Go, Rust, JavaScript, etc.).
27
36
-**`vscode.ts`**: Provides `getFileRunSettings`, `initializeRunSettingsWatcher`, and `resolveVariables` to parse and resolve VS Code variables (like `${fileDirname}`) in commands.
28
37
38
+
### Hierarchical Run Settings Merging
39
+
40
+
`getFileRunSettings(file)` traverses from the file's directory up to the workspace root, loading and merging `runSettings.json` files along the way via `deepMerge()`. Closer-to-file settings override ancestor settings. The function also:
41
+
42
+
- Applies defaults from the `runSettings.schema.json` schema file
43
+
- Resolves VS Code variables via `resolveVariables()`
44
+
- Validates via `RunSettingsSchema` (Valibot)
45
+
- Caches loaded settings per directory; cache is invalidated by a `FileSystemWatcher`
46
+
- Returns `FileRunSettings` which includes the merged settings plus the resolved `languageSettings` for the file's extension
47
+
29
48
## Extended VS Code Utilities (`vscode.ts`)
30
49
31
50
-**`TextHandler`**: For all streamed output. Keeps full data internally, truncates display output, normalizes CRLF to LF, ensures trailing newline. Write modes: `"batch"`, `"force"`, `"final"`. Always call `.reset()` before a fresh run.
32
51
-**`ReadonlyStringProvider`**: Manages the custom `fastolympiccoding` URI scheme for displaying read-only text documents.
33
52
-**`openInNewEditor` / `openInTerminalTab`**: Helpers for displaying output. Terminal tabs support ANSI colors and native clickable file links.
34
53
-**`openOrCreateFile`**: Helper for file management.
54
+
-**`getFileWorkspace`**: Returns workspace folder or file directory. Used for run settings and CC target resolution.
55
+
-**`getAttachDebugConfiguration`**: Looks up a named debug configuration from workspace `launch.json`.
56
+
-**`showOpenRunSettingsErrorWindow` / `showAddLanguageSettingsError`**: Error UI helpers that offer quick-fix actions.
35
57
36
58
## UI/UX Features
37
59
@@ -59,6 +81,16 @@ Termination mapping helpers:
59
81
60
82
Use `compile()` for compilation (caches by file checksum and compile command).
61
83
84
+
### Debounced Saving
85
+
86
+
JudgeViewProvider uses a debounced save pattern:
87
+
88
+
-`requestSave()`: Schedules a bulk save after 200ms (resets timer on repeated calls)
89
+
-`forceSave()`: Immediately saves all state (used during `onDispose()`)
90
+
-`_saveAllState()`: Writes all contexts to workspaceState in a single bulk update
91
+
92
+
StressViewProvider saves state synchronously via `_saveState(file)` after each operation.
-**`TestcaseSchema`**: Judge testcase with `uuid`, stdio fields, `elapsed`, `memoryBytes`, `status`, `shown`, `toggled`, `skipped`, `mode`, `interactorSecret`. Uses `v.fallback()` for all fields.
122
+
-**`StressDataSchema`**: Stress state snapshot with `stdin`, `stdout`, `stderr`, `status`, `state` (StateId), `shown`.
123
+
-**`RunSettingsSchema`**: Validated via `v.pipe()` with `v.looseObject()` and `v.check()`. Known keys: `interactorFile`, `goodSolutionFile`, `generatorFile`. Additional properties must be file extensions (starting with `.`) and match `LanguageSettingsSchema`.
124
+
-**`LanguageSettingsSchema`**: Per-language config with optional `compileCommand`, `runCommand`, `currentWorkingDirectory`, `debugCommand`, `debugAttachConfig`.
125
+
-**`ProblemSchema`**: Competitive Companion problem data with `name`, `group`, `url`, `tests`, `timeLimit`, `memoryLimit`, `interactive`, `batch`, `input`, `output`.
126
+
-**`TestSchema`**: Simple `{ input, output }` for CC test pairs.
127
+
117
128
## Append-Only Rule
118
129
119
130
When adding new enum values or message types, **append to the end** of arrays. Never rename or reorder existing values—they may be persisted in workspaceState.
-**Testcase.svelte**: Stdio textareas (stdin, stdout, stderr, acceptedStdout, interactorSecret). Exports a `reset()` function called before re-running a testcase.
29
29
30
30
Rendering pattern:
31
31
32
32
```svelte
33
33
{#each testcases as testcase, index (testcase.uuid)}
0 commit comments