Support displaying hooks by target, compat refactor#298798
Open
Support displaying hooks by target, compat refactor#298798
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors hook-related types to support displaying/configuring hooks per target (VS Code vs GitHub Copilot/Copilot CLI vs Claude), and updates the hook configuration UX and hook discovery plumbing across workbench + ext host.
Changes:
- Introduces
hookTypes.tsas the shared source of truth forHookType, per-target hook name mappings, and localized hook metadata. - Moves
Targetenum topromptTypes.tsand updates imports across prompt parsing, UI, and tests. - Updates hook collection and hook configuration UI to use the new types and enables filtering hook types by target.
Reviewed changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/tools/builtinTools/runSubagentTool.test.ts | Updates Target import location. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts | Updates Target + HookType imports for new module split. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/hookCompatibility.test.ts | Updates HookType import to hookTypes. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/hookClaudeCompat.test.ts | Updates HookType import to hookTypes. |
| src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts | Updates Target import to promptTypes. |
| src/vs/workbench/contrib/chat/test/common/chatModeService.test.ts | Updates Target import to promptTypes. |
| src/vs/workbench/contrib/chat/test/browser/promptSyntax/languageProviders/promptValidator.test.ts | Updates Target import to promptTypes. |
| src/vs/workbench/contrib/chat/test/browser/promptSyntax/languageProviders/promptHovers.test.ts | Adjusts imports for moved Target (but currently misses PromptsType/getLanguageIdForPromptsType). |
| src/vs/workbench/contrib/chat/test/browser/promptSyntax/languageProviders/promptHeaderAutocompletion.test.ts | Adjusts imports for moved Target (but currently misses PromptsType/getLanguageIdForPromptsType). |
| src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.ts | Renames hook type usage to ChatRequestHooks. |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts | Switches hook aggregation to Map and adopts HookType/ChatRequestHooks split. |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts | Removes Target enum from service layer; uses ChatRequestHooks type. |
| src/vs/workbench/contrib/chat/common/promptSyntax/promptTypes.ts | Adds Target enum to prompt type module. |
| src/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookTypes.ts | New: centralizes hook types, per-target maps, and localized metadata. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.ts | Rebuilds hook schema properties from per-target hook maps + metadata; introduces ChatRequestHooks mapped type. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.ts | Derives Copilot CLI hook name mapping from HOOKS_BY_TARGET. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.ts | Updates HookType import source. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.ts | Derives Claude hook name mapping from HOOKS_BY_TARGET. |
| src/vs/workbench/contrib/chat/common/plugins/agentPluginService.ts | Updates HookType import source. |
| src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/common/participants/chatAgents.ts | Updates hook request type to ChatRequestHooks. |
| src/vs/workbench/contrib/chat/common/chatSessionsService.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Updates hook request type to ChatRequestHooks. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Updates HookTypeValue import to hookTypes. |
| src/vs/workbench/contrib/chat/common/chatModes.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts | Updates HookType import source. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.ts | Switches hook label lookup to HOOK_METADATA. |
| src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.ts | Updates HookType import source. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.ts | Switches hook metadata lookup to HOOK_METADATA. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.ts | Adds target filtering for hook types; refactors quick-pick options (but new-file creation currently doesn’t honor Copilot CLI format). |
| src/vs/workbench/contrib/chat/browser/chatSlashCommands.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | Updates Target import source. |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.ts | Uses showConfigureHooksQuickPick with target filtering (VS Code vs GitHub Copilot). |
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts | Switches hook metadata lookup to HOOK_METADATA. |
| src/vs/workbench/api/common/extHostTypes.ts | Updates HookTypeValue import source. |
| src/vs/workbench/api/common/extHostTypeConverters.ts | Updates hook request type to ChatRequestHooks. |
| src/vs/workbench/api/common/extHostChatAgents2.ts | Updates hook request type to ChatRequestHooks. |
.../contrib/chat/test/browser/promptSyntax/languageProviders/promptHeaderAutocompletion.test.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/test/browser/promptSyntax/languageProviders/promptHovers.test.ts
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Yoyokrazy
approved these changes
Mar 2, 2026
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.
Fixes #298769