Skip to content

1.12 Implement activation and the extension context #13

Description

@goofmint

Part of Phase 1 — Core skeleton (tasks.md Task 1.12).

Summary

Implement lazy extension activation, ExtensionContext, and clean deactivation.

Details

  • Activation events (Req 2.5): onStartup (after first frame), onCommand:<id> (lazy command activates its extension, then re-dispatches), onLanguage:<id> (from DocumentManager open notifications). Lazy views likewise activate on first reveal.
  • activate(ctx) receives ExtensionContext { api, extensionUri, subscriptions: Disposable[], storagePath }.
  • Shutdown/deactivation: dispose subscriptions in reverse order, then call deactivate() if exported (Req 2.6).
  • Failed activation (throw): extension marked failed and quarantined — its contributions stay registered, but invoking its commands reports the failure; no crash.

Completion requirements

  • Fixture extensions verify each activation event fires exactly once at the right trigger
  • Lazy command: first execute activates, then runs the real handler; second execute skips activation
  • Dispose order is reverse of push order; deactivate() called on shutdown
  • Throwing activate quarantines the extension and surfaces the error; other extensions unaffected
  • bun test and lint pass

References

  • requirements.md: Req 2.5, 2.6
  • design.md: §4.2

Dependencies

Blocked by: 1.11 (#12).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions