Command palette discoverability: copilot commands + Run Script Command - #9
Merged
Merged
Conversation
… Command
- contributes.commands: swiftCopilot.generate/explain/refactor with
'Swift Copilot' category, gated on 'swiftCopilot.loaded' context so they
surface in the palette only when the userscript is actually running.
Static contribution declares title/category; dynamic registerCommand
still binds the handler — no duplicate registration.
- swiftUserscripts.runCommand: QuickPick over CommandRegistry's live
registrations with manifest titles + owning script name.
- CommandRegistry.list() exposes {id, owner} snapshot; SwiftScriptHost
captures contributedCommands from the initialize manifest; pure
toPickItems() helper builds QuickPick items.
- extension.ts sets 'swiftCopilot.loaded' after each loadAll().
- tests: +9 checks (manifest contributions, list() metadata, pick-item
mapping, post-cleanup listings).
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@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.
Summary
Makes userscript commands discoverable in the Command Palette:
swiftCopilot.generate/explain/refactorwithSwift Copilotcategory — they get polished palette titles and are hidden until the copilot userscript is loaded via aswiftCopilot.loadedcontext key (set after eachloadAll). Staticcontributes.commandsdeclares title/visibility only; the handler is still the script's dynamicregisterCommand, so no duplicate-registration conflict (that path is covered by Fix duplicate command registration crash on .vswift load/reload #7'sCommandRegistry).swiftUserscripts.runCommand("Swift Userscripts: Run Script Command...") — QuickPick listing every live dynamically-registered userscript command with its manifest title, command id, and owning script; selecting executes it viavscode.commands.executeCommand.Supporting changes:
CommandRegistry.list()returns a{id, owner}snapshot;SwiftScriptHost.contributedCommandscaptures the initialize manifest; new vscode-freecommandPalette.ts#toPickItemsbuilds items (tested in node).Tests: commands.test.mjs extended to 21 checks (contributions,
list()metadata, pick-item mapping, cleanup-visible-in-listings).tsc, swift test (6+5), smoke, vswift all green.