Skip to content

fix: restore onLanguage activation so standalone documents still activate - #28

Merged
otnc merged 2 commits into
mainfrom
fix/restore-standalone-toml-activation
Sep 27, 2026
Merged

otnc merged 2 commits into
mainfrom
fix/restore-standalone-toml-activation

Conversation

@otnc

@otnc otnc commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes a regression from the merged #21 fix (PR #25): replacing onLanguage:json/jsonc/yaml/toml outright with workspaceContains entries broke activation for a standalone document opened with no workspace at all, since workspaceContains only matches files inside an open workspace folder. This is exactly what cargo-language.test.ts's "opening a TOML document activates the bundle without a workspace" integration test exercises, and it started failing on main/PR #27's CI.

  • Restored the four onLanguage entries alongside the workspaceContains ones added in fix: narrow activation and skip scheduling for unrecognized documents #25.
  • This does not reopen the performance concern activationEvents / ドキュメント変更リスナーの対象範囲が広すぎる #21 raised: that was about Annotator.schedule() queuing a debounce timer for every edit of every document regardless of relevance, which is fixed independently in annotator.ts (already merged, unaffected by this change) — schedule() bails out before touching debounceTimers/setTimeout for any document no provider recognizes, purely via a cheap URI string check with no I/O. A broader activationEvents list only means the extension's one-time activate() may run in more workspaces, not that per-keystroke work happens for unrelated files.

Test plan

  • npm run test:integration passes locally, including the previously-failing standalone TOML activation test
  • npm test, npm run check-types, npm run lint, npm run format:check all pass

…vate

#21's activationEvents change (merged) replaced onLanguage:json/jsonc/
yaml/toml outright with workspaceContains entries, which only match files
inside an open workspace folder. Opening a standalone TOML/JSON document
with no workspace open at all - exactly what
cargo-language.test.ts's "opening a TOML document activates the bundle
without a workspace" integration test exercises - stopped activating the
extension at all, since there is no workspace for workspaceContains to
search.

Restored the four onLanguage entries alongside the workspaceContains ones.
The runtime cost issue #21 actually cared about (a debounce timer for
every edit of every document, regardless of whether any provider
recognizes it) is unaffected by this: annotator.ts's schedule() already
bails out before touching debounceTimers/setTimeout for a document no
provider claims, so a broader activationEvents list only means the
extension''s one-time activate() may run more often, not that any
per-keystroke work happens for unrelated files.

Verified locally: `npm run test:integration` now passes, including the
previously-failing standalone TOML activation test.
isDenoManifest() in jsr/parse.ts recognizes both import_map.json and the
camelCase importMap.json some tools write, but the workspaceContains list
only had the snake_case one. onLanguage:json still covers a standalone
importMap.json opened without a workspace, but a workspace containing only
importMap.json (and no other recognized manifest) would not otherwise be
guaranteed to activate before some other json file happened to be opened.
@otnc
otnc merged commit c66a3ef into main Sep 27, 2026
7 checks passed
@otnc
otnc deleted the fix/restore-standalone-toml-activation branch September 27, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant