@@ -2908,7 +2908,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2908
2908
title : strings . fetching
2909
2909
} ;
2910
2910
const promise = ( async ( ) => {
2911
- let taskGroupTasks : ( Task | ConfiguringTask ) [ ] = [ ] ;
2911
+ let groupTasks : ( Task | ConfiguringTask ) [ ] = [ ] ;
2912
2912
2913
2913
async function runSingleTask ( task : Task | undefined , problemMatcherOptions : IProblemMatcherRunOptions | undefined , that : AbstractTaskService ) {
2914
2914
that . run ( task , problemMatcherOptions , TaskRunSource . User ) . then ( undefined , reason => {
@@ -2942,27 +2942,29 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2942
2942
if ( absoluteURI ) {
2943
2943
const workspaceFolder = this . _contextService . getWorkspaceFolder ( absoluteURI ) ;
2944
2944
if ( workspaceFolder ) {
2945
- const config = this . _getConfiguration ( workspaceFolder ) ;
2946
- globTasksDetected = ( ( config ?. config ?. tasks ) || [ ] ) . filter ( task => task . group && typeof task . group !== 'string' && typeof task . group . isDefault === 'string' ) . length > 0 ;
2947
-
2948
- if ( globTasksDetected ) {
2949
- // fallback to absolute path of the file if it is not in a workspace or relative path cannot be found
2950
- const relativePath = workspaceFolder ?. uri ? ( resources . relativePath ( workspaceFolder . uri , absoluteURI ) ?? absoluteURI . path ) : absoluteURI . path ;
2951
-
2952
- taskGroupTasks = await this . _findWorkspaceTasks ( ( task ) => {
2953
- const currentTaskGroup = task . configurationProperties . group ;
2954
- if ( currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup . isDefault === 'string' ) {
2955
- return ( currentTaskGroup . _id === taskGroup . _id && glob . match ( currentTaskGroup . isDefault , relativePath ) ) ;
2956
- }
2945
+ const configuredTasks = this . _getConfiguration ( workspaceFolder ) ?. config ?. tasks ;
2946
+ if ( configuredTasks ) {
2947
+ globTasksDetected = configuredTasks . filter ( task => task . group && typeof task . group !== 'string' && typeof task . group . isDefault === 'string' ) . length > 0 ;
2948
+ // This will activate extensions, so only do so if necessary #185960
2949
+ if ( globTasksDetected ) {
2950
+ // Fallback to absolute path of the file if it is not in a workspace or relative path cannot be found
2951
+ const relativePath = workspaceFolder ?. uri ? ( resources . relativePath ( workspaceFolder . uri , absoluteURI ) ?? absoluteURI . path ) : absoluteURI . path ;
2952
+
2953
+ groupTasks = await this . _findWorkspaceTasks ( ( task ) => {
2954
+ const currentTaskGroup = task . configurationProperties . group ;
2955
+ if ( currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup . isDefault === 'string' ) {
2956
+ return ( currentTaskGroup . _id === taskGroup . _id && glob . match ( currentTaskGroup . isDefault , relativePath ) ) ;
2957
+ }
2957
2958
2958
- return false ;
2959
- } ) ;
2959
+ return false ;
2960
+ } ) ;
2961
+ }
2960
2962
}
2961
2963
}
2962
2964
}
2963
2965
2964
- if ( ! globTasksDetected && taskGroupTasks . length === 0 ) {
2965
- taskGroupTasks = await this . _findWorkspaceTasksInGroup ( TaskGroup . Build , true ) ;
2966
+ if ( ! globTasksDetected && groupTasks . length === 0 ) {
2967
+ groupTasks = await this . _findWorkspaceTasksInGroup ( TaskGroup . Build , true ) ;
2966
2968
}
2967
2969
2968
2970
const handleMultipleTasks = ( areGlobTasks : boolean ) => {
@@ -2995,25 +2997,25 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2995
2997
} ;
2996
2998
2997
2999
// A single default glob task was returned, just run it directly
2998
- if ( taskGroupTasks . length === 1 ) {
2999
- return resolveTaskAndRun ( taskGroupTasks [ 0 ] ) ;
3000
+ if ( groupTasks . length === 1 ) {
3001
+ return resolveTaskAndRun ( groupTasks [ 0 ] ) ;
3000
3002
}
3001
3003
3002
3004
// If there's multiple globs that match we want to show the quick picker for those tasks
3003
3005
// We will need to call splitPerGroupType putting globs in defaults and the remaining tasks in none.
3004
3006
// We don't need to carry on after here
3005
- if ( globTasksDetected && taskGroupTasks . length > 1 ) {
3007
+ if ( globTasksDetected && groupTasks . length > 1 ) {
3006
3008
return handleMultipleTasks ( true ) ;
3007
3009
}
3008
3010
3009
3011
// If no globs are found or matched fallback to checking for default tasks of the task group
3010
- if ( ! taskGroupTasks . length ) {
3011
- taskGroupTasks = await this . _findWorkspaceTasksInGroup ( taskGroup , false ) ;
3012
+ if ( ! groupTasks . length ) {
3013
+ groupTasks = await this . _findWorkspaceTasksInGroup ( taskGroup , false ) ;
3012
3014
}
3013
3015
3014
3016
// A single default task was returned, just run it directly
3015
- if ( taskGroupTasks . length === 1 ) {
3016
- return resolveTaskAndRun ( taskGroupTasks [ 0 ] ) ;
3017
+ if ( groupTasks . length === 1 ) {
3018
+ return resolveTaskAndRun ( groupTasks [ 0 ] ) ;
3017
3019
}
3018
3020
3019
3021
// Multiple default tasks returned, show the quickPicker
0 commit comments