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
Copy file name to clipboardExpand all lines: .github/instructions/build-and-config.instructions.md
+25-3Lines changed: 25 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,32 @@ This repository uses npm, Rspack, TypeScript, and ESLint to build and lint the F
7
7
When working on the build, config, or tooling files matched by this pattern:
8
8
9
9
- Use `npm install` to install dependencies. Prefer npm scripts in `package.json` over ad-hoc commands.
10
+
11
+
**Build System (Rspack):**
12
+
10
13
- Builds are driven by **Rspack mode** (not `NODE_ENV`):
11
14
-`npm run build` runs `rspack build --mode development`
12
15
-`npm run watch` runs `rspack build --watch --mode development`
13
16
-`npm run prod` runs `rspack build --mode production`
14
-
- Use `npm run lint` to lint the codebase.
15
-
- Use `npm run format` to apply Prettier formatting.
16
-
- Use `npm run typecheck` to run Svelte type checking.
17
+
-`rspack.config.ts` exports a dual configuration: one for the Node.js extension backend (`extensionConfig`) and one for the Svelte webviews (`webviewsConfig`).
18
+
- Rspack uses `builtin:swc-loader` for fast transpilation and `ForkTsCheckerWebpackPlugin` for type checking.
19
+
- Rspack automatically copies the compiled native addons (`.node` files) from `build/Release/` to `dist/` based on the host OS.
20
+
21
+
**TypeScript Configuration:**
22
+
23
+
- The project uses a composite TypeScript setup:
24
+
-`tsconfig.json`: Base configuration with project references.
25
+
-`tsconfig.node.json`: For the extension backend (`src/extension`) and shared code.
26
+
-`tsconfig.app.json`: For the webview frontend (`src/webview`) and shared code.
27
+
28
+
**Linting & Formatting:**
29
+
30
+
- Use `npm run lint` to lint the codebase. ESLint uses the Flat Config format (`eslint.config.mjs`) with `@typescript-eslint` (`projectService: true`) and supports Svelte 5 runes as globals.
31
+
- Use `npm run format` to apply Prettier formatting, or `npm run check` to verify formatting.
32
+
- Use `npm run svelte:check` to run Svelte type checking against `tsconfig.app.json`.
33
+
34
+
**Native Addons & Packaging:**
35
+
36
+
- Use `npm run build:addon` to compile the C++ process monitor addons via `node-gyp`.
37
+
- Use `npm run test` to run the monitor tests.
38
+
- Use `npm run package` to package the extension via `vsce`.
Copy file name to clipboardExpand all lines: .github/instructions/extension-backend.instructions.md
+19-14Lines changed: 19 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,24 +19,29 @@ Both Judge and Stress implement the same file-switching pattern:
19
19
5.`_switchToNoFile()` handles cases where no valid file is open
20
20
6.`_rehydrateWebviewFromState()` sends current in-memory state to the webview
21
21
22
-
When switching files, stop any running processes for the previous file before switching to the new one.
22
+
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
23
24
-
## TextHandler
24
+
## Run Settings
25
25
26
-
Use `TextHandler` from `src/extension/utils/vscode.ts` for all streamed output. It:
26
+
-**`runSettingsCommands.ts`**: Registers commands (`editRunSettings`, `resetRunSettings`) and provides default `languageTemplates`.
27
+
-**`vscode.ts`**: Provides `getFileRunSettings`, `initializeRunSettingsWatcher`, and `resolveVariables` to parse and resolve VS Code variables (like `${fileDirname}`) in commands.
27
28
28
-
- Keeps full data internally for comparisons (answer checking)
29
-
- Truncates display output (max characters/lines)
30
-
- Normalizes CRLF to LF
31
-
- Ensures trailing newline on final writes
29
+
## Extended VS Code Utilities (`vscode.ts`)
32
30
33
-
Write modes:
31
+
-**`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
+
-**`ReadonlyStringProvider`**: Manages the custom `fastolympiccoding` URI scheme for displaying read-only text documents.
33
+
-**`openInNewEditor` / `openInTerminalTab`**: Helpers for displaying output. Terminal tabs support ANSI colors and native clickable file links.
34
+
-**`openOrCreateFile`**: Helper for file management.
34
35
35
-
-`"batch"`: Batched updates, throttled for performance
36
-
-`"force"`: Immediate update, bypasses throttling
37
-
-`"final"`: Final write, applies truncation rules and trailing newline
-**Changelog (`changelog.ts`)**: `showChangelog` handles semver comparison and displays the changelog on extension updates.
40
+
-**Status Bar (`statusBar.ts`)**: `createStatusBarItem` creates the main status bar entry point that triggers the `PanelViewProvider`.
41
+
42
+
## Template Dependency Resolution
43
+
44
+
`getTemplateContent` in `index.ts` handles reading template files and detecting cyclic dependencies via DFS before insertion.
40
45
41
46
## Runnable and runtime.ts
42
47
@@ -63,15 +68,15 @@ Debug support uses **attach mode**:
63
68
3. Start debug-wrapped process via `Runnable`
64
69
4. Call `vscode.debug.startDebugging()` with fully-resolved config
65
70
66
-
Track debug sessions via `onDidStartDebugSession` / `onDidTerminateDebugSession`. Tag configs with `fastolympiccodingTestcaseId` to identify which testcase is being debugged.
71
+
Track debug sessions via `onDidStartDebugSession` / `onDidTerminateDebugSession`. Tag configs with `fastolympiccodingTestcaseUuid` to identify which testcase is being debugged.
67
72
68
73
## Competitive Companion
69
74
70
75
`competitiveCompanion.ts` implements an HTTP server receiving problem data from the browser extension. Problems are queued in `ProblemQueue` and processed sequentially. Users select target files via QuickPick for batch problems.
71
76
72
77
## Logging
73
78
74
-
Use `getLogger(component)` from `src/extension/utils/logging.ts`. Component names: `"runtime"`, `"judge"`, `"stress"`, `"competitive-companion"`.
79
+
Use `getLogger(component)` from `src/extension/utils/logging.ts`. Component names: `"runtime"`, `"judge"`, `"stress"`, `"competitive-companion"`, `"compilation"`, `"vscode"`.
75
80
76
81
Log levels (controlled via VS Code's "Developer: Set Log Level"):
Stdio uses Named Pipes (Windows) or Unix Sockets (Linux/macOS) established before process spawn. The extension's `Runnable` class connects to these pipes.
60
+
Stdio uses Named Pipes (Windows) or Unix Sockets (Linux/macOS). The extension creates the pipes/sockets and passes their paths to the addon's `spawn` function, which then connects to them internally before executing the child process.
Copy file name to clipboardExpand all lines: .github/instructions/shared-contracts.instructions.md
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ applyTo: "src/shared/**/*.ts"
8
8
9
9
## Enums (String Literal Tuples)
10
10
11
-
Enums are `const` string literal tuples validated via `v.picklist()`:
11
+
Enums are `const` string literal tuples validated via `v.picklist()`. All string literal tuples (including `ActionValues`, `InputTypeValues`, `ProviderMessageTypeValues`, `WebviewMessageTypeValues`, etc.) follow the same append-only rule.
When adding a new message schema, its `type` literal **must** also be appended to the corresponding `ProviderMessageTypeValues` or `WebviewMessageTypeValues` array. This prevents the arrays from falling out of sync with the union schemas.
-**Default Values:** Use `v.fallback()` to provide default state values (e.g., `v.fallback(v.string(), "")` or `v.fallback(v.string(), () => crypto.randomUUID())`).
106
+
-**Complex Validation:** Use `v.pipe()`, `v.looseObject()`, and `v.check()` for custom validation logic (e.g., in `RunSettingsSchema`).
107
+
-**Optional & Record Types:** Use `v.optional()` and `v.record()` for flexible configurations.
108
+
109
+
### Type Inference and Utility Types
110
+
111
+
Derive property types from schemas using TypeScript utility types. For example:
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.
0 commit comments