Skip to content

fix: stop server and clean up ports on extension deactivate#19

Merged
TPreece101 merged 1 commit intomainfrom
fix/server-cleanup-on-deactivate
Feb 13, 2026
Merged

fix: stop server and clean up ports on extension deactivate#19
TPreece101 merged 1 commit intomainfrom
fix/server-cleanup-on-deactivate

Conversation

@TPreece101
Copy link
Copy Markdown
Contributor

Summary

  • When the extension was uninstalled/reinstalled, the old HTTP server kept running, causing the new instance to fall back to a different port
  • Root cause: deactivate() had no reference to the DebugServer instance (local variable inside activate())
  • Added module-level refs, a disposable safety net in context.subscriptions, and a proper deactivate() implementation

Test plan

  • npm run compile — no errors
  • npm test — all 72 tests pass
  • Manual: start extension, note port, uninstall, reinstall — server starts on the same port without a port conflict notification

🤖 Generated with Claude Code

When the extension was uninstalled and reinstalled, the old HTTP server
kept running on the original port. The new instance would detect the
port conflict, fall back to a different port, and VS Code would show a
port notification. The root cause was that deactivate() had no reference
to the DebugServer instance (it was a local variable inside activate()).

- Add module-level refs for the server instance and port cleanup
- Push a disposable into context.subscriptions as a safety net
- Implement deactivate() to await server.stop() and clean up ports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.70%. Comparing base (73f4b29) to head (7d726aa).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   74.30%   75.70%   +1.39%     
==========================================
  Files           7        7              
  Lines        1195     1210      +15     
  Branches      151      153       +2     
==========================================
+ Hits          888      916      +28     
+ Misses        306      292      -14     
- Partials        1        2       +1     
Flag Coverage Δ
extension 75.70% <100.00%> (+1.39%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TPreece101 TPreece101 merged commit faaca68 into main Feb 13, 2026
6 checks passed
@TPreece101 TPreece101 deleted the fix/server-cleanup-on-deactivate branch February 13, 2026 14: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