Repository navigation
fix: restore onLanguage activation so standalone documents still activate - #28
Merged
Merged
Conversation
…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.
2 tasks done
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression from the merged #21 fix (PR #25): replacing
onLanguage:json/jsonc/yaml/tomloutright withworkspaceContainsentries broke activation for a standalone document opened with no workspace at all, sinceworkspaceContainsonly matches files inside an open workspace folder. This is exactly whatcargo-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.onLanguageentries alongside theworkspaceContainsones added in fix: narrow activation and skip scheduling for unrecognized documents #25.Annotator.schedule()queuing a debounce timer for every edit of every document regardless of relevance, which is fixed independently inannotator.ts(already merged, unaffected by this change) —schedule()bails out before touchingdebounceTimers/setTimeoutfor any document no provider recognizes, purely via a cheap URI string check with no I/O. A broaderactivationEventslist only means the extension's one-timeactivate()may run in more workspaces, not that per-keystroke work happens for unrelated files.Test plan
npm run test:integrationpasses locally, including the previously-failing standalone TOML activation testnpm test,npm run check-types,npm run lint,npm run format:checkall pass