Skip to content

Commit 7ad30da

Browse files
authored
Merge pull request #7766 from microsoft/main
Merge for 1.5.0-insiders3 (2nd time)
2 parents 2ab63a4 + 3967429 commit 7ad30da

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Extension/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
### Bug Fixes
2121
* Fix code folding causing `} else if` lines to be hidden. [#5521](https://github.com/microsoft/vscode-cpptools/issues/5521)
22+
* Fix empty `launch.json` being created when debug configuration selection is canceled. [#7517](https://github.com/microsoft/vscode-cpptools/issues/7517)
2223
* Fix Find All References on a global variable giving incorrect references to local variables. [#7702](https://github.com/microsoft/vscode-cpptools/issues/7702)
2324
* Fix `vcFormat` not working near the end of the file with UTF-8 characters > 1 byte. [#7704](https://github.com/microsoft/vscode-cpptools/issues/7704)
2425
* Fix configuration squiggle on a recursively resolved `forcedInclude`. [PR #7722](https://github.com/microsoft/vscode-cpptools/pull/7722)

Extension/src/Debugger/configurationProvider.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class QuickPickConfigurationProvider implements vscode.DebugConfiguration
7171

7272
const selection: MenuItem | undefined = await vscode.window.showQuickPick(items, {placeHolder: localize("select.configuration", "Select a configuration")});
7373
if (!selection) {
74-
return []; // User canceled it.
74+
throw Error(localize("debug.configuration.selection.canceled", "Debug configuration selection canceled")); // User canceled it.
7575
}
7676
if (selection.label.startsWith("cl.exe")) {
7777
if (!process.env.DevEnvDir) {
@@ -161,11 +161,11 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
161161
return false;
162162
}
163163
if (defaultConfig.name.startsWith("(Windows) ")) {
164-
if (command.includes("cl.exe")) {
164+
if (command.startsWith("cl.exe")) {
165165
return true;
166166
}
167167
} else {
168-
if (!command.includes("cl.exe")) {
168+
if (!command.startsWith("cl.exe")) {
169169
return true;
170170
}
171171
}
@@ -203,21 +203,26 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
203203
let debuggerName: string;
204204
if (compilerName.startsWith("clang")) {
205205
newConfig.MIMode = "lldb";
206-
const suffixIndex: number = compilerName.indexOf("-");
207-
const suffix: string = suffixIndex === -1 ? "" : compilerName.substr(suffixIndex);
208-
debuggerName = "lldb-mi" + suffix;
206+
debuggerName = "lldb-mi";
207+
// Search for clang-8, clang-10, etc.
208+
if ((compilerName !== "clang-cl.exe") && (compilerName !== "clang-cpp.exe")) {
209+
const suffixIndex: number = compilerName.indexOf("-");
210+
if (suffixIndex !== -1) {
211+
const suffix: string = compilerName.substr(suffixIndex);
212+
debuggerName += suffix;
213+
}
214+
}
215+
newConfig.type = "cppdbg";
209216
} else if (compilerName === "cl.exe") {
210217
newConfig.miDebuggerPath = undefined;
211218
newConfig.type = "cppvsdbg";
212219
return resolve(newConfig);
213220
} else {
214221
debuggerName = "gdb";
215222
}
216-
217223
if (isWindows) {
218-
debuggerName += ".exe";
224+
debuggerName = debuggerName.endsWith(".exe") ? debuggerName : (debuggerName + ".exe");
219225
}
220-
221226
const compilerDirname: string = path.dirname(compilerPath);
222227
const debuggerPath: string = path.join(compilerDirname, debuggerName);
223228
if (isWindows) {

0 commit comments

Comments
 (0)