@@ -2921,7 +2921,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2921
2921
title : strings . fetching
2922
2922
} ;
2923
2923
const promise = ( async ( ) => {
2924
- let taskGroupTasks : ( Task | ConfiguringTask ) [ ] = [ ] ;
2924
+ let groupTasks : ( Task | ConfiguringTask ) [ ] = [ ] ;
2925
2925
2926
2926
async function runSingleTask ( task : Task | undefined , problemMatcherOptions : IProblemMatcherRunOptions | undefined , that : AbstractTaskService ) {
2927
2927
that . run ( task , problemMatcherOptions , TaskRunSource . User ) . then ( undefined , reason => {
@@ -2949,22 +2949,35 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2949
2949
} ) ;
2950
2950
} ) ;
2951
2951
} ;
2952
-
2952
+ let globTasksDetected = false ;
2953
2953
// First check for globs before checking for the default tasks of the task group
2954
2954
const absoluteURI = EditorResourceAccessor . getOriginalUri ( this . _editorService . activeEditor ) ;
2955
2955
if ( absoluteURI ) {
2956
2956
const workspaceFolder = this . _contextService . getWorkspaceFolder ( absoluteURI ) ;
2957
- // fallback to absolute path of the file if it is not in a workspace or relative path cannot be found
2958
- const relativePath = workspaceFolder ?. uri ? ( resources . relativePath ( workspaceFolder . uri , absoluteURI ) ?? absoluteURI . path ) : absoluteURI . path ;
2957
+ if ( workspaceFolder ) {
2958
+ const configuredTasks = this . _getConfiguration ( workspaceFolder ) ?. config ?. tasks ;
2959
+ if ( configuredTasks ) {
2960
+ globTasksDetected = configuredTasks . filter ( task => task . group && typeof task . group !== 'string' && typeof task . group . isDefault === 'string' ) . length > 0 ;
2961
+ // This will activate extensions, so only do so if necessary #185960
2962
+ if ( globTasksDetected ) {
2963
+ // Fallback to absolute path of the file if it is not in a workspace or relative path cannot be found
2964
+ const relativePath = workspaceFolder ?. uri ? ( resources . relativePath ( workspaceFolder . uri , absoluteURI ) ?? absoluteURI . path ) : absoluteURI . path ;
2965
+
2966
+ groupTasks = await this . _findWorkspaceTasks ( ( task ) => {
2967
+ const currentTaskGroup = task . configurationProperties . group ;
2968
+ if ( currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup . isDefault === 'string' ) {
2969
+ return ( currentTaskGroup . _id === taskGroup . _id && glob . match ( currentTaskGroup . isDefault , relativePath ) ) ;
2970
+ }
2959
2971
2960
- taskGroupTasks = await this . _findWorkspaceTasks ( ( task ) => {
2961
- const currentTaskGroup = task . configurationProperties . group ;
2962
- if ( currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup . isDefault === 'string' ) {
2963
- return ( currentTaskGroup . _id === taskGroup . _id && glob . match ( currentTaskGroup . isDefault , relativePath ) ) ;
2972
+ return false ;
2973
+ } ) ;
2974
+ }
2964
2975
}
2976
+ }
2977
+ }
2965
2978
2966
- return false ;
2967
- } ) ;
2979
+ if ( ! globTasksDetected && groupTasks . length === 0 ) {
2980
+ groupTasks = await this . _findWorkspaceTasksInGroup ( TaskGroup . Build , true ) ;
2968
2981
}
2969
2982
2970
2983
const handleMultipleTasks = ( areGlobTasks : boolean ) => {
@@ -2997,25 +3010,25 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2997
3010
} ;
2998
3011
2999
3012
// A single default glob task was returned, just run it directly
3000
- if ( taskGroupTasks . length === 1 ) {
3001
- return resolveTaskAndRun ( taskGroupTasks [ 0 ] ) ;
3013
+ if ( groupTasks . length === 1 ) {
3014
+ return resolveTaskAndRun ( groupTasks [ 0 ] ) ;
3002
3015
}
3003
3016
3004
3017
// If there's multiple globs that match we want to show the quick picker for those tasks
3005
3018
// We will need to call splitPerGroupType putting globs in defaults and the remaining tasks in none.
3006
3019
// We don't need to carry on after here
3007
- if ( taskGroupTasks . length > 1 ) {
3020
+ if ( globTasksDetected && groupTasks . length > 1 ) {
3008
3021
return handleMultipleTasks ( true ) ;
3009
3022
}
3010
3023
3011
3024
// If no globs are found or matched fallback to checking for default tasks of the task group
3012
- if ( ! taskGroupTasks . length ) {
3013
- taskGroupTasks = await this . _findWorkspaceTasksInGroup ( taskGroup , false ) ;
3025
+ if ( ! groupTasks . length ) {
3026
+ groupTasks = await this . _findWorkspaceTasksInGroup ( taskGroup , false ) ;
3014
3027
}
3015
3028
3016
3029
// A single default task was returned, just run it directly
3017
- if ( taskGroupTasks . length === 1 ) {
3018
- return resolveTaskAndRun ( taskGroupTasks [ 0 ] ) ;
3030
+ if ( groupTasks . length === 1 ) {
3031
+ return resolveTaskAndRun ( groupTasks [ 0 ] ) ;
3019
3032
}
3020
3033
3021
3034
// Multiple default tasks returned, show the quickPicker
0 commit comments