Add external URI opener for Claude Code VSCode extension support#3
Draft
Add external URI opener for Claude Code VSCode extension support#3
Conversation
- Implement registerExternalUriOpener to intercept vscode.env.openExternal() calls - Add pattern matching for Plannotator URLs (URLs containing "plannotator") - Update mock types to include ExternalUriOpener interfaces - Add comprehensive tests for external URI opener functionality - Update README with documentation for both terminal and extension modes - Add package-lock.json to .gitignore Co-authored-by: 7tg <20913374+7tg@users.noreply.github.com>
- Add detailed comments explaining URL matching strategy and priority value - Restore globalThis.URL in mock for explicit scope reference - Add security note about URL pattern matching scope Co-authored-by: 7tg <20913374+7tg@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Ensure extension works with Claude Code VSCode integration
Add external URI opener for Claude Code VSCode extension support
Feb 12, 2026
7tg
reviewed
Feb 12, 2026
src/extension.ts
Outdated
| // More specific matching (like hostname) isn't feasible since Plannotator can run | ||
| // on any localhost port, and the pattern must match both development and production URLs | ||
| // Note: While this could theoretically match unintended URLs (e.g., http://example.com?q=plannotator), | ||
| // in practice this is only triggered by vscode.env.openExternal() calls from other extensions |
Owner
There was a problem hiding this comment.
@copilot url is just localhost there is not plannator
Author
There was a problem hiding this comment.
Fixed in 863de5b. Changed URL matching from checking for "plannotator" substring to matching localhost URLs specifically:
http://localhost:*andhttps://localhost:*http://127.0.0.1:*andhttps://127.0.0.1:*
This correctly matches actual Plannotator URLs which run on localhost with dynamic ports.
Plannotator URLs don't contain "plannotator" in the path - they're just localhost:PORT URLs. Changed matching logic to: - Match http://localhost:* and https://localhost:* - Match http://127.0.0.1:* and https://127.0.0.1:* - Updated tests to verify localhost matching behavior Co-authored-by: 7tg <20913374+7tg@users.noreply.github.com>
Co-authored-by: 7tg <20913374+7tg@users.noreply.github.com>
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.
Extension only worked when Claude Code ran in integrated terminal via
PLANNOTATOR_BROWSERenv var injection. Failed to intercept URLs when Claude Code ran as a VSCode extension usingvscode.env.openExternal().Changes
External URI opener registration (
src/extension.ts)window.registerExternalUriOpenerforhttp/httpsschemescanOpenExternalUri()returns priority 2 for localhost URLs (Plannotator runs locally on dynamic ports)openExternalUri()routes to existing panel manager@types/vscode@1.85(available since VSCode 1.54)URL pattern matching rationale
localhostand127.0.0.1hostnameslocalhost:PORTURLsMock types (
mocks/vscode.ts)ExternalUriOpenerandExternalUriOpenerMetadatainterfacesregisterExternalUriOpenerto window mockUri.toString()for URI handling in testsTest coverage (
src/extension.test.ts)http://localhost:3000/andhttp://127.0.0.1:8080/reviewhttp://example.com(pass-through)Architecture
Both modes now supported:
PLANNOTATOR_BROWSERenv var → router script → IPC server → webviewvscode.env.openExternal()→ external URI opener (matches localhost URLs) → webviewCookie proxy and panel management shared across both paths.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.