Docs: a step-by-step migration guide from 2.x - #53
Merged
Conversation
`docs/migration-from-2x.md` gives the order to do the work in. Inventory the existing `activate`; classify what it registers; move all of it into one module as raw registrations first, so the host owns activation and cleanup from the first commit; then turn each entry into the declaration it is — hosted services for initialisation and loops, owned scopes for subscriptions, settings and storage declarations, the escape hatch for what has no model. It ends with the Test Host, the manifest check and an Extension Host lane. The two code samples — the starting `activate`, and the same extension declared — compile under the consumer's compiler options and are checked against the page by the same test that covers the README and the guide. Also fixes the changelog's link to the 3.0.0-alpha.1 section, which pointed at the wrong date. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merged
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
The README has said for a while that there is "no step-by-step migration guide from 2.x". This adds one:
docs/migration-from-2x.md.2.x is a utility library called from the extension's own
activate; 4.x is a framework that owns activation and hands the extension modules. The old-to-new table for every removed helper already exists in the 3.0.0-alpha.1 changelog and is linked rather than repeated. What was missing is the order to do the work in, and the guide is that:activate— one line per registration, module-levellet, timer, configuration read and awaited initialisation.activate/deactivateto the framework's. From that commit on the host owns activation, rollback and cleanup, and every later step is a small commit that turns one raw registration into a declaration while the extension keeps working.start,backgroundwithcontext.delay).defineSettings; mementos →defineStorage(the 2.x envelope is kept, so no data migration).raw.registerin its own module file, so the modules a unit test loads never importvscode.It closes with what can be deleted afterwards.
Samples
Two new files under
docs/samples/, compiled with the consumer's compiler options and checked byte-for-byte against the page bytests/readme-samples.test.ts, which now covers the new page as well as the README and the guide:migration-before.ts— a typical startingactivate: an awaited index build, a command reading a setting at call time, a watcher with three callbacks, asetIntervaldisposed by hand, and a hover provider.migration-after.ts— the same extension declared: a service, a settings declaration, a command contract, one watcher batch handler, a background hosted service, and the framework'sactivate/deactivate. It imports nothing fromvscode; the hover provider is deliberately absent and the guide says where it goes.Also
Verification
npm run quality(1076 tests, including the 21 sample checks) andnpm run verify:package(18 samples type-check against the packed.d.ts) pass.🤖 Generated with Claude Code