Skip to content

Commit b3e9786

Browse files
committed
change autodetect to absolute
1 parent d12c832 commit b3e9786

File tree

5 files changed

+26
-29
lines changed

5 files changed

+26
-29
lines changed

Extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
"source": "gcc",
258258
"owner": "cpptools",
259259
"fileLocation": [
260-
"autoDetect"
260+
"absolute"
261261
],
262262
"pattern": {
263263
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",

Extension/src/Debugger/configurationProvider.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { CppBuildTask, CppBuildTaskDefinition } from '../LanguageServer/cppBuild
1111
import * as util from '../common';
1212
import * as fs from 'fs';
1313
import * as Telemetry from '../telemetry';
14-
import { cppBuildTaskProvider, CppSourceStrPrefix } from '../LanguageServer/extension';
14+
import { cppBuildTaskProvider, configPrefix } from '../LanguageServer/extension';
1515
import * as logger from '../logger';
1616
import * as nls from 'vscode-nls';
1717
import { IConfiguration, IConfigurationSnippet, DebuggerType, DebuggerEvent, MIConfigurations, WindowsConfigurations, WSLConfigurations, PipeTransportConfigurations, TaskConfigStatus } from './configurations';
@@ -99,7 +99,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
9999
}
100100

101101
if (this.isClConfiguration(selection.label)) {
102-
this.showErrorClNotAvailable(selection.label);
102+
this.showErrorIfClNotAvailable(selection.label);
103103
}
104104

105105
return [selection.configuration];
@@ -297,7 +297,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
297297
const compilerName: string = path.basename(compilerPath);
298298
const newConfig: vscode.DebugConfiguration = { ...defaultConfig }; // Copy enumerables and properties
299299

300-
newConfig.name = CppSourceStrPrefix + compilerName + " " + this.buildAndDebugActiveFileStr();
300+
newConfig.name = configPrefix + compilerName + " " + this.buildAndDebugActiveFileStr();
301301
newConfig.preLaunchTask = task.name;
302302
if (newConfig.type === "cppdbg") {
303303
newConfig.externalConsole = false;
@@ -391,18 +391,15 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
391391
}
392392

393393
private isClConfiguration(configurationLabel: string): boolean {
394-
return configurationLabel.startsWith("C/C++: cl.exe") ? true : false;
394+
return configurationLabel.startsWith("C/C++: cl.exe");
395395
}
396396

397-
private showErrorClNotAvailable(configurationLabel: string): boolean {
398-
if (this.isClConfiguration(configurationLabel)) {
399-
if (!process.env.DevEnvDir || process.env.DevEnvDir.length === 0) {
400-
vscode.window.showErrorMessage(localize("cl.exe.not.available", "{0} build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.", "cl.exe"));
401-
return true;
402-
}
403-
return false;
397+
private showErrorIfClNotAvailable(configurationLabel: string): boolean {
398+
if (!process.env.DevEnvDir || process.env.DevEnvDir.length === 0) {
399+
vscode.window.showErrorMessage(localize("cl.exe.not.available", "{0} build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.", "cl.exe"));
400+
return true;
404401
}
405-
throw new Error("Config is not a cl.exe config.");
402+
return false;
406403
}
407404

408405
private getLLDBFrameworkPath(): string | undefined {
@@ -578,7 +575,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
578575
return; // User canceled it.
579576
}
580577

581-
if (this.isClConfiguration(selection.label) && this.showErrorClNotAvailable(selection.label)) {
578+
if (this.isClConfiguration(selection.label) && this.showErrorIfClNotAvailable(selection.label)) {
582579
return;
583580
}
584581

Extension/src/Debugger/configurations.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as os from 'os';
77
import * as nls from 'vscode-nls';
8-
import { CppSourceStrPrefix } from '../LanguageServer/extension';
8+
import { configPrefix } from '../LanguageServer/extension';
99

1010
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
1111
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
@@ -128,7 +128,7 @@ export class MIConfigurations extends Configuration {
128128
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
129129

130130
return {
131-
"label": CppSourceStrPrefix + name,
131+
"label": configPrefix + name,
132132
"description": localize("launch.with", "Launch with {0}.", this.MIMode).replace(/\"/g, "\\\""),
133133
"bodyText": body.trim(),
134134
"isInitialConfiguration": true,
@@ -146,7 +146,7 @@ export class MIConfigurations extends Configuration {
146146
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
147147

148148
return {
149-
"label": CppSourceStrPrefix + name,
149+
"label": configPrefix + name,
150150
"description": localize("attach.with", "Attach with {0}.", this.MIMode).replace(/\"/g, "\\\""),
151151
"bodyText": body.trim(),
152152
"debuggerType": DebuggerType.cppdbg
@@ -168,7 +168,7 @@ export class PipeTransportConfigurations extends Configuration {
168168
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
169169

170170
return {
171-
"label": CppSourceStrPrefix + name,
171+
"label": configPrefix + name,
172172
"description": localize("pipe.launch.with", "Pipe Launch with {0}.", this.MIMode).replace(/\"/g, "\\\""),
173173
"bodyText": body.trim(),
174174
"debuggerType": DebuggerType.cppdbg
@@ -186,7 +186,7 @@ export class PipeTransportConfigurations extends Configuration {
186186
\t"MIMode": "${this.MIMode}"{0}
187187
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
188188
return {
189-
"label": CppSourceStrPrefix + name,
189+
"label": configPrefix + name,
190190
"description": localize("pipe.attach.with", "Pipe Attach with {0}.", this.MIMode).replace(/\"/g, "\\\""),
191191
"bodyText": body.trim(),
192192
"debuggerType": DebuggerType.cppdbg
@@ -206,7 +206,7 @@ export class WindowsConfigurations extends Configuration {
206206
}`;
207207

208208
return {
209-
"label": CppSourceStrPrefix + name,
209+
"label": configPrefix + name,
210210
"description": localize("launch.with.vs.debugger", "Launch with the Visual Studio C/C++ debugger.").replace(/\"/g, "\\\""),
211211
"bodyText": body.trim(),
212212
"isInitialConfiguration": true,
@@ -224,7 +224,7 @@ export class WindowsConfigurations extends Configuration {
224224
}`;
225225

226226
return {
227-
"label": CppSourceStrPrefix + name,
227+
"label": configPrefix + name,
228228
"description": localize("attach.with.vs.debugger", "Attach to a process with the Visual Studio C/C++ debugger.").replace(/\"/g, "\\\""),
229229
"bodyText": body.trim(),
230230
"debuggerType": DebuggerType.cppvsdbg
@@ -247,7 +247,7 @@ export class WSLConfigurations extends Configuration {
247247
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
248248

249249
return {
250-
"label": CppSourceStrPrefix + name,
250+
"label": configPrefix + name,
251251
"description": localize("launch.bash.windows", "Launch in Bash on Windows using {0}.", this.MIMode).replace(/\"/g, "\\\""),
252252
"bodyText": body.trim(),
253253
"debuggerType": DebuggerType.cppdbg
@@ -264,7 +264,7 @@ export class WSLConfigurations extends Configuration {
264264
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
265265

266266
return {
267-
"label": CppSourceStrPrefix + name,
267+
"label": configPrefix + name,
268268
"description": localize("remote.attach.bash.windows", "Attach to a remote process running in Bash on Windows using {0}.", this.MIMode).replace(/\"/g, "\\\""),
269269
"bodyText": body.trim(),
270270
"debuggerType": DebuggerType.cppdbg

Extension/src/LanguageServer/cppBuildTaskProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class CppBuildTaskProvider implements TaskProvider {
5757

5858
public resolveInsiderTask(_task: CppBuildTask): CppBuildTask | undefined {
5959
const definition: CppBuildTaskDefinition = <any>_task.definition;
60-
definition.label = definition.label.replace(ext.CppSourceStrPrefix, "");
60+
definition.label = definition.label.replace(ext.configPrefix, "");
6161
_task = this.getTask(definition.command, false, definition.args ? definition.args : [], definition, _task.detail);
6262
return _task;
6363
}
@@ -171,8 +171,8 @@ export class CppBuildTaskProvider implements TaskProvider {
171171
if (!definition) {
172172
const isWindows: boolean = os.platform() === 'win32';
173173
const isMacARM64: boolean = (os.platform() === 'darwin' && os.arch() === 'arm64');
174-
const taskLabel: string = ((appendSourceToName && !compilerPathBase.startsWith(ext.CppSourceStrPrefix)) ?
175-
ext.CppSourceStrPrefix : "") + compilerPathBase + " " + localize("build_active_file", "build active file");
174+
const taskLabel: string = ((appendSourceToName && !compilerPathBase.startsWith(ext.configPrefix)) ?
175+
ext.configPrefix : "") + compilerPathBase + " " + localize("build_active_file", "build active file");
176176
const filePath: string = path.join('${fileDirname}', '${fileBasenameNoExtension}');
177177
const programName: string = isWindows ? filePath + '.exe' : filePath;
178178
let args: string[] = isCl ? ['/Zi', '/EHsc', '/nologo', '/Fe:', programName, '${file}'] : ['-fdiagnostics-color=always', '-g', '${file}', '-o', programName];

Extension/src/LanguageServer/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFo
3030
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
3131
export const cppBuildTaskProvider: CppBuildTaskProvider = new CppBuildTaskProvider();
3232
export const CppSourceStr: string = "C/C++";
33-
export const CppSourceStrPrefix: string = "C/C++: ";
33+
export const configPrefix: string = "C/C++: ";
3434

3535
let prevCrashFile: string;
3636
let clients: ClientCollection;
@@ -175,15 +175,15 @@ export async function activate(): Promise<void> {
175175
vscode.tasks.onDidStartTask(event => {
176176
getActiveClient().PauseCodeAnalysis();
177177
if (event.execution.task.definition.type === CppBuildTaskProvider.CppBuildScriptType
178-
|| event.execution.task.name.startsWith(CppSourceStrPrefix)) {
178+
|| event.execution.task.name.startsWith(configPrefix)) {
179179
telemetry.logLanguageServerEvent('buildTaskStarted');
180180
}
181181
});
182182

183183
vscode.tasks.onDidEndTask(event => {
184184
getActiveClient().ResumeCodeAnalysis();
185185
if (event.execution.task.definition.type === CppBuildTaskProvider.CppBuildScriptType
186-
|| event.execution.task.name.startsWith(CppSourceStrPrefix)) {
186+
|| event.execution.task.name.startsWith(configPrefix)) {
187187
telemetry.logLanguageServerEvent('buildTaskFinished');
188188
if (event.execution.task.scope !== vscode.TaskScope.Global && event.execution.task.scope !== vscode.TaskScope.Workspace) {
189189
const folder: vscode.WorkspaceFolder | undefined = event.execution.task.scope;

0 commit comments

Comments
 (0)