@@ -113,7 +113,6 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
113113 * resolveDebugConfigurationWithSubstitutedVariables will be automatically called after this function.
114114 */
115115 async resolveDebugConfiguration ( folder : vscode . WorkspaceFolder | undefined , config : CppDebugConfiguration , token ?: vscode . CancellationToken ) : Promise < CppDebugConfiguration | null | undefined > {
116- const isIntelliSenseDisabled : boolean = new CppSettings ( ( vscode . workspace . workspaceFolders && vscode . workspace . workspaceFolders . length > 0 ) ? vscode . workspace . workspaceFolders [ 0 ] ?. uri : undefined ) . intelliSenseEngine === "Disabled" ;
117116 if ( ! config || ! config . type ) {
118117 // When DebugConfigurationProviderTriggerKind is Dynamic, this function will be called with an empty config.
119118 // Hence, providing debug configs, and start debugging should be done manually.
@@ -148,6 +147,18 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
148147
149148 if ( config . preLaunchTask ) {
150149 config . configSource = this . getDebugConfigSource ( config , folder ) ;
150+ const isIntelliSenseDisabled : boolean = new CppSettings ( ( vscode . workspace . workspaceFolders && vscode . workspace . workspaceFolders . length > 0 ) ? vscode . workspace . workspaceFolders [ 0 ] ?. uri : undefined ) . intelliSenseEngine === "Disabled" ;
151+ // Run the build task if IntelliSense is disabled.
152+ if ( isIntelliSenseDisabled ) {
153+ try {
154+ await cppBuildTaskProvider . runBuildTask ( config . preLaunchTask ) ;
155+ config . preLaunchTask = undefined ;
156+ Telemetry . logDebuggerEvent ( DebuggerEvent . debugPanel , { "debugType" : DebugType . debug , "configSource" : config . configSource || ConfigSource . unknown , "configMode" : ConfigMode . launchConfig , "cancelled" : "false" , "success" : "true" } ) ;
157+ } catch ( err ) {
158+ Telemetry . logDebuggerEvent ( DebuggerEvent . debugPanel , { "debugType" : DebugType . debug , "configSource" : config . configSource || ConfigSource . unknown , "configMode" : ConfigMode . launchConfig , "cancelled" : "false" , "success" : "false" } ) ;
159+ }
160+ return config ;
161+ }
151162 let resolveByVsCode : boolean = false ;
152163 const isDebugPanel : boolean = ! config . debuggerEvent || ( config . debuggerEvent && config . debuggerEvent === DebuggerEvent . debugPanel ) ;
153164 const singleFile : boolean = config . configSource === ConfigSource . singleFile ;
@@ -172,8 +183,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
172183 Telemetry . logDebuggerEvent ( config . debuggerEvent || DebuggerEvent . debugPanel , { "debugType" : config . debugType || DebugType . debug , "configSource" : config . configSource || ConfigSource . unknown , "configMode" : configMode , "cancelled" : "false" , "success" : "true" } ) ;
173184
174185 if ( ! resolveByVsCode ) {
175- if ( ( singleFile || isIntelliSenseDisabled ||
176- ( isDebugPanel && ! folder && isExistingTask ) ) ) {
186+ if ( ( singleFile || ( isDebugPanel && ! folder && isExistingTask ) ) ) {
177187 await this . resolvePreLaunchTask ( config , configMode ) ;
178188 config . preLaunchTask = undefined ;
179189 } else {
0 commit comments