Skip to content

Commit 963ee02

Browse files
authored
Merge pull request #2572 from Microsoft/master
Merge latest changes
2 parents da86264 + 45a1804 commit 963ee02

File tree

2 files changed

+39
-36
lines changed

2 files changed

+39
-36
lines changed

Extension/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# C/C++ for Visual Studio Code Change Log
22

3-
## Version 0.19.0: September 26, 2018
3+
## Version 0.19.0: September 27, 2018
44
* Change the symbol database to update without needing to save. [#202](https://github.com/Microsoft/vscode-cpptools/issues/202)
55
* Enable IntelliSense-based `Go to Definition` for the current translation unit, including local variables and overloaded operators. [#255](https://github.com/Microsoft/vscode-cpptools/issues/255), [#979](https://github.com/Microsoft/vscode-cpptools/issues/979)
66
* Improved the `Go to Definition` performance with large workspaces and files with lots of `#include`s. [#273](https://github.com/Microsoft/vscode-cpptools/issues/273)
@@ -15,6 +15,7 @@
1515
* Gabriel Arjones (@g-arjones) [PR #2495](https://github.com/Microsoft/vscode-cpptools/pull/2495), [PR #2503](https://github.com/Microsoft/vscode-cpptools/pull/2503)
1616
* Fix bug with variable resolution. [#2532](https://github.com/Microsoft/vscode-cpptools/issues/2532)
1717
* Fix off-by-one bug with hover and `Go to Definition`. [#2535](https://github.com/Microsoft/vscode-cpptools/issues/2535)
18+
* Fix for [Microsoft/vscode#54213](https://github.com/Microsoft/vscode/issues/54213)
1819

1920
## Version 0.18.1: August 17, 2018
2021
* Fix 0.18.0 regression causing non-MinGW compilers to use `-fms-extensions` on Windows. [#2424](https://github.com/Microsoft/vscode-cpptools/issues/2424), [#2425](https://github.com/Microsoft/vscode-cpptools/issues/2425)

Extension/src/Debugger/configurationProvider.ts

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,39 @@ abstract class CppConfigurationProvider implements vscode.DebugConfigurationProv
3131
* Try to add all missing attributes to the debug configuration being launched.
3232
*/
3333
resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
34-
// Fail if cppvsdbg type is running on non-Windows
35-
if (config.type === 'cppvsdbg' && os.platform() !== 'win32') {
36-
vscode.window.showErrorMessage("Debugger of type: 'cppvsdbg' is only available on Windows. Use type: 'cppdbg' on the current OS platform.");
37-
return undefined;
38-
}
39-
40-
// Modify WSL config for OpenDebugAD7
41-
if (os.platform() === 'win32' &&
42-
config.pipeTransport &&
43-
config.pipeTransport.pipeProgram) {
44-
let replacedPipeProgram: string = null;
45-
const pipeProgramStr: string = config.pipeTransport.pipeProgram.toLowerCase().trim();
46-
47-
// OpenDebugAD7 is a 32-bit process. Make sure the WSL pipe transport is using the correct program.
48-
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(pipeProgramStr, debugUtils.ArchType.ia32);
49-
50-
// If pipeProgram does not get replaced and there is a pipeCwd, concatenate with pipeProgramStr and attempt to replace.
51-
if (!replacedPipeProgram && !path.isAbsolute(pipeProgramStr) && config.pipeTransport.pipeCwd) {
52-
const pipeCwdStr: string = config.pipeTransport.pipeCwd.toLowerCase().trim();
53-
const newPipeProgramStr: string = path.join(pipeCwdStr, pipeProgramStr);
54-
55-
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(newPipeProgramStr, debugUtils.ArchType.ia32);
34+
if (config) {
35+
// Fail if cppvsdbg type is running on non-Windows
36+
if (config.type === 'cppvsdbg' && os.platform() !== 'win32') {
37+
vscode.window.showErrorMessage("Debugger of type: 'cppvsdbg' is only available on Windows. Use type: 'cppdbg' on the current OS platform.");
38+
return undefined;
5639
}
5740

58-
if (replacedPipeProgram) {
59-
config.pipeTransport.pipeProgram = replacedPipeProgram;
41+
// Modify WSL config for OpenDebugAD7
42+
if (os.platform() === 'win32' &&
43+
config.pipeTransport &&
44+
config.pipeTransport.pipeProgram) {
45+
let replacedPipeProgram: string = null;
46+
const pipeProgramStr: string = config.pipeTransport.pipeProgram.toLowerCase().trim();
47+
48+
// OpenDebugAD7 is a 32-bit process. Make sure the WSL pipe transport is using the correct program.
49+
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(pipeProgramStr, debugUtils.ArchType.ia32);
50+
51+
// If pipeProgram does not get replaced and there is a pipeCwd, concatenate with pipeProgramStr and attempt to replace.
52+
if (!replacedPipeProgram && !path.isAbsolute(pipeProgramStr) && config.pipeTransport.pipeCwd) {
53+
const pipeCwdStr: string = config.pipeTransport.pipeCwd.toLowerCase().trim();
54+
const newPipeProgramStr: string = path.join(pipeCwdStr, pipeProgramStr);
55+
56+
replacedPipeProgram = debugUtils.ArchitectureReplacer.checkAndReplaceWSLPipeProgram(newPipeProgramStr, debugUtils.ArchType.ia32);
57+
}
58+
59+
if (replacedPipeProgram) {
60+
config.pipeTransport.pipeProgram = replacedPipeProgram;
61+
}
6062
}
6163
}
62-
63-
return config;
64-
}
64+
// if config or type is not specified, return null to trigger VS Code to open a configuration file https://github.com/Microsoft/vscode/issues/54213
65+
return config && config.type ? config : null;
66+
}
6567
}
6668

6769
export class CppVsDbgConfigurationProvider extends CppConfigurationProvider {
@@ -71,7 +73,7 @@ export class CppVsDbgConfigurationProvider extends CppConfigurationProvider {
7173
}
7274

7375
export class CppDbgConfigurationProvider extends CppConfigurationProvider {
74-
public constructor(provider: IConfigurationAssetProvider) {
76+
public constructor(provider: IConfigurationAssetProvider) {
7577
super(provider, DebuggerType.cppdbg);
7678
}
7779
}
@@ -101,12 +103,12 @@ abstract class DefaultConfigurationProvider implements IConfigurationAssetProvid
101103

102104
public getInitialConfigurations(debuggerType: DebuggerType): any {
103105
let configurationSnippet: IConfigurationSnippet[] = [];
104-
106+
105107
// Only launch configurations are initial configurations
106108
this.configurations.forEach(configuration => {
107-
configurationSnippet.push(configuration.GetLaunchConfiguration());
109+
configurationSnippet.push(configuration.GetLaunchConfiguration());
108110
});
109-
111+
110112
let initialConfigurations: any = configurationSnippet.filter(snippet => snippet.debuggerType === debuggerType && snippet.isInitialConfiguration)
111113
.map(snippet => JSON.parse(snippet.bodyText));
112114

@@ -141,7 +143,7 @@ class WindowsConfigurationProvider extends DefaultConfigurationProvider {
141143
constructor() {
142144
super();
143145
this.configurations = [
144-
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
146+
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
145147
new PipeTransportConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
146148
new WindowsConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
147149
new WSLConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
@@ -157,7 +159,7 @@ class OSXConfigurationProvider extends DefaultConfigurationProvider {
157159
constructor() {
158160
super();
159161
this.configurations = [
160-
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram),
162+
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram),
161163
];
162164
}
163165
}
@@ -177,7 +179,7 @@ class LinuxConfigurationProvider extends DefaultConfigurationProvider {
177179
constructor() {
178180
super();
179181
this.configurations = [
180-
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
182+
new MIConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock),
181183
new PipeTransportConfigurations(this.MIMode, this.executable, this.pipeProgram, this.setupCommandsBlock)
182184
];
183185
}
@@ -220,7 +222,7 @@ export class ConfigurationSnippetProvider implements vscode.CompletionItemProvid
220222

221223
items.map((item) => {
222224
item.insertText = item.insertText + ','; // Add comma
223-
});
225+
});
224226
}
225227

226228
return Promise.resolve(new vscode.CompletionList(items, true));

0 commit comments

Comments
 (0)