@@ -113,7 +113,6 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
113
113
* resolveDebugConfigurationWithSubstitutedVariables will be automatically called after this function.
114
114
*/
115
115
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" ;
117
116
if ( ! config || ! config . type ) {
118
117
// When DebugConfigurationProviderTriggerKind is Dynamic, this function will be called with an empty config.
119
118
// Hence, providing debug configs, and start debugging should be done manually.
@@ -148,6 +147,18 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
148
147
149
148
if ( config . preLaunchTask ) {
150
149
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
+ }
151
162
let resolveByVsCode : boolean = false ;
152
163
const isDebugPanel : boolean = ! config . debuggerEvent || ( config . debuggerEvent && config . debuggerEvent === DebuggerEvent . debugPanel ) ;
153
164
const singleFile : boolean = config . configSource === ConfigSource . singleFile ;
@@ -172,8 +183,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
172
183
Telemetry . logDebuggerEvent ( config . debuggerEvent || DebuggerEvent . debugPanel , { "debugType" : config . debugType || DebugType . debug , "configSource" : config . configSource || ConfigSource . unknown , "configMode" : configMode , "cancelled" : "false" , "success" : "true" } ) ;
173
184
174
185
if ( ! resolveByVsCode ) {
175
- if ( ( singleFile || isIntelliSenseDisabled ||
176
- ( isDebugPanel && ! folder && isExistingTask ) ) ) {
186
+ if ( ( singleFile || ( isDebugPanel && ! folder && isExistingTask ) ) ) {
177
187
await this . resolvePreLaunchTask ( config , configMode ) ;
178
188
config . preLaunchTask = undefined ;
179
189
} else {
0 commit comments