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
-**Path alias**: `@cmt/*` maps to `src/*` (see `tsconfig.json`). Always use `import foo from '@cmt/foo'` — never relative paths from outside `src/`.
22
-
-**Error reporting**: Use `rollbar.invokeAsync()` / `rollbar.invoke()` for top-level error boundaries around event handlers, never bare `try/catch` that silently swallows.
21
+
-**Path alias**: `@cmt/*` maps to `src/*` (see `tsconfig.json`). Always use `import foo from '@cmt/foo'` — never relative paths from outside `src/`. `@test/*` maps to `test/*` (defined in both `tsconfig.json` and `test.tsconfig.json`). Use `import ... from '@test/...'` in test files.
22
+
-**Error reporting**: Use `rollbar` wrappers for top-level error boundaries around event handlers, never bare `try/catch` that silently swallows.
23
+
-`rollbar.invoke(what, fn)` — wraps synchronous code; catches, logs, and re-throws.
24
+
-`rollbar.invokeAsync(what, fn)` — wraps async function execution; catches promise rejections.
25
+
-`rollbar.takePromise(what, additional, thenable)` — attaches an error handler to an **already-created** Thenable (e.g., a return value from a VS Code API call). Use this when you have a promise but didn't create it via `invokeAsync`.
23
26
-**Telemetry**: Use helpers in `src/telemetry.ts` (`logEvent`). Never call the VS Code telemetry API directly.
24
27
25
28
## Architecture
@@ -58,14 +61,41 @@ Identify the affected layer(s) from the architecture table above. Read the relev
58
61
| Cache entries |`CMakeDriver.cmakeCacheEntries`|
59
62
| Extension settings |`ConfigurationReader` (`src/config.ts`) — never `vscode.workspace.getConfiguration()` directly |
60
63
64
+
### Reactive configuration subscriptions
65
+
66
+
Use `ConfigurationReader.onChange()` for typed, per-setting change notifications:
// Store disposable in a field or push to a disposables array for cleanup
73
+
```
74
+
75
+
Do **not** use `vscode.workspace.onDidChangeConfiguration` directly — the `onChange()` API is type-safe, fires only for the specific setting, and integrates with the extension's promise tracking.
76
+
61
77
### Always handle both operating modes
62
78
63
79
When a code path touches shared logic (configure, build, test, targets, environment), check `CMakeProject.useCMakePresets` and ensure it works correctly in both presets mode and kits/variants mode. Omitting the check for one mode in shared code is a bug waiting to happen. Features that are inherently mode-specific (e.g., kit scanning, preset expansion) are fine to scope to one mode.
64
80
81
+
### `SpecialKits` sentinel values
82
+
83
+
Kit names may be sentinel values, not real compiler paths. Always check before treating `kit.name` as a file path:
84
+
85
+
-`SpecialKits.Unspecified` (`'__unspec__'`) — no kit selected
-`SpecialKits.ScanSpecificDir` (`'__scan_specific_dir__'`) — scan a specific directory
88
+
89
+
### Kit trust model
90
+
91
+
Kits have an `isTrusted: boolean` property. Auto-scanned kits from untrusted paths are filtered out before selection and use. This prevents untrusted kits from executing `environmentSetupScript`. Do not bypass this trust filtering when adding kit-related code.
92
+
65
93
### Always handle both generator types
66
94
67
95
Single-config uses `CMAKE_BUILD_TYPE`; multi-config uses `--config` at build time. Check the active generator before any build-type logic.
68
96
97
+
Call `util.isMultiConfGeneratorFast(generator)` before any build-type logic. Multi-config generators include Visual Studio, Xcode, and Ninja Multi-Config. Note: the `cmake.setBuildTypeOnMultiConfig` setting can override multi-config behavior — check it before assuming.
98
+
69
99
### Localize all user-visible strings
70
100
71
101
Every file with user-visible text needs the `vscode-nls` boilerplate:
One entry under the current version in `CHANGELOG.md`, in the appropriate section (`Features:`, `Improvements:`, or `Bug Fixes:`), describing user-visible behavior in the repo's existing tense and category style.
In the Copilot agent CI environment, `.npmrc` is renamed to `.npmrc.bak` and `yarn.lock` registry URLs are patched to use the public npm registry. These are environment artifacts:
163
+
-**Never commit**`.npmrc.bak` or the patched `yarn.lock`
164
+
- If `git status` shows these as modified, run `git checkout -- .npmrc yarn.lock` before committing
165
+
105
166
## Testing checklist
106
167
107
168
-[ ]`yarn unitTests` passes
@@ -111,6 +172,20 @@ One entry under the current version in `CHANGELOG.md`, in the appropriate sectio
111
172
-[ ] Behavior verified with **single-config** and **multi-config** generators
1. If the module has **no transitive `vscode` dependency** (e.g., `encodingUtils`, `cmakeValue`) → import directly via `@cmt/*`
186
+
2. If the module **transitively imports `vscode`** and the mock is insufficient → **mirror the pure function logic inline** in the test file. This is the established pattern in `expand.test.ts`, `targetMap.test.ts`, `shell-propagation.test.ts`.
187
+
3.**Heuristic:** Try `@cmt/*` import first. If it fails due to vscode dependency at runtime, fall back to mirroring.
0 commit comments