Skip to content

Commit e13d6cd

Browse files
committed
docs: Document why activationEvents are necessary
Added comprehensive documentation to CLAUDE.md explaining why the activationEvents array in package.json must be kept. Key clarification: - VS Code 1.74+ made onCommand activation implicit (for commands) - onLanguage activation is DIFFERENT and still required - Our extension activates on file open, not command invocation - Without onLanguage events, extension won't be ready when TS/JS files open This addresses a common misconception and prevents future audit questions about why we don't remove activationEvents. References: - VS Code 1.74 Release Notes (implicit command activation) - StackOverflow discussion (specifically about onCommand, not onLanguage) Closes final audit point - all implementation complete.
1 parent bf3c6a9 commit e13d6cd

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"Bash(npm run check-types)",
1111
"Bash(npm run lint)",
1212
"Bash(npm run)",
13-
"Bash(npm run build)"
13+
"Bash(npm run build)",
14+
"Bash(curl -s \"https://code.visualstudio.com/updates/\")",
15+
"WebFetch(domain:code.visualstudio.com)"
1416
],
1517
"deny": [],
1618
"ask": []

CLAUDE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,36 @@ All tests use REAL VSCode APIs with explicit expected outputs.
218218

219219
---
220220

221+
## 📦 Extension Activation
222+
223+
### Why We Keep `activationEvents` in package.json
224+
225+
The `activationEvents` array is **required and correct**:
226+
227+
```json
228+
"activationEvents": [
229+
"onLanguage:typescript",
230+
"onLanguage:typescriptreact",
231+
"onLanguage:javascript",
232+
"onLanguage:javascriptreact"
233+
],
234+
```
235+
236+
**Common misconception:** VS Code 1.74+ made activation events "implicit"
237+
238+
**Reality:** Only **command** activation (`onCommand`) became implicit. Language-based activation (`onLanguage`) is different - it activates the extension when specific file types are opened.
239+
240+
**Why we need this:**
241+
- Our extension must activate when TS/JS files are opened (not when commands are invoked)
242+
- Without `onLanguage` activation events, the extension won't be ready when users open TypeScript/JavaScript files
243+
- The `contributes.commands` entries only handle command registration, not language-based activation
244+
245+
**References:**
246+
- VS Code 1.74 Release Notes: https://code.visualstudio.com/updates/v1_74
247+
- StackOverflow: https://stackoverflow.com/a/75303487 (about `onCommand`, NOT `onLanguage`)
248+
249+
---
250+
221251
### 2. Test Harness Tests (`comparison-test-harness/`)
222252

223253
**Purpose**: Validate backward compatibility between old and new extension

0 commit comments

Comments
 (0)