Support ${taskVar:name} variables from problem matcher named capture groups#303362
Open
Support ${taskVar:name} variables from problem matcher named capture groups#303362
${taskVar:name} variables from problem matcher named capture groups#303362Conversation
Fixes #303361 Introduces \\\ variables that extract named capture groups from a task problem matcher's endsPattern and make them available for substitution in launch configurations and other variable-resolved contexts. Changes: - WatchingProblemCollector.tryFinish() extracts matches.groups from endsPattern - IProblemCollectorEvent carries capturedVariables in BackgroundProcessingEnds - TerminalTaskSystem registers captured variables via contributeVariable() - VariableKind.TaskVar added to the enum - Test added for taskVar variable resolution - .vscode/launch.json updated to use \
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for ${taskVar:name} variables that surface named capture groups from a background task problem matcher’s endsPattern, enabling downstream variable substitution (e.g. in launch configurations) based on values emitted in task output.
Changes:
- Extend problem collector end events to optionally carry named regex capture groups (
matches.groups) as acapturedVariablesmap. - Register captured variables in
TerminalTaskSystemas contributed configuration resolver variables under thetaskVar:prefix. - Add
VariableKind.TaskVarand a configuration resolver test validating${taskVar:...}substitution, plus update workspace.vscodetask/launch configs to use the new variable.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/tasks/common/problemCollectors.ts | Extracts named capture groups from endsPattern matches and propagates them via the problem collector state change event. |
| src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts | Consumes capturedVariables and contributes taskVar:<name> variables to the configuration resolver. |
| src/vs/workbench/services/configurationResolver/common/configurationResolver.ts | Adds TaskVar to VariableKind for taskVar recognition. |
| src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts | Adds test coverage for resolving a contributed taskVar:<name> variable in a configuration object. |
| .vscode/tasks.json | Updates the Component Explorer task endsPattern to include a named capture group for the URL. |
| .vscode/launch.json | Switches Component Explorer launch URLs to ${taskVar:componentExplorerUrl}. |
meganrogge
approved these changes
Mar 20, 2026
connor4312
approved these changes
Mar 20, 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 #303361
What
Introduces
${taskVar:name}variables that extract named capture groups from a task problem matcher'sendsPatternand make them available for variable substitution in launch configurations and other resolved contexts.How
WatchingProblemCollector.tryFinish()— When theendsPatternmatches,matches.groupsis extracted into aMap<string, string>and attached to theBackgroundProcessingEndsevent.IProblemCollectorEvent— Extended with an optionalcapturedVariablesfield.TerminalTaskSystem— Listens forcapturedVariablesin the state change event and registers them viaIConfigurationResolverService.contributeVariable()using thetaskVar:prefix.VariableKind.TaskVar— Added to the enum for completeness.Example
Files changed
src/vs/workbench/contrib/tasks/common/problemCollectors.tssrc/vs/workbench/contrib/tasks/browser/terminalTaskSystem.tssrc/vs/workbench/services/configurationResolver/common/configurationResolver.tsTaskVartoVariableKindsrc/vs/workbench/services/configurationResolver/test/.../configurationResolverService.test.tstaskVarresolution.vscode/launch.json${taskVar:componentExplorerUrl}for Component Explorer.vscode/tasks.jsonendsPatternwith named capture group