Linter fixes plus remove annoying popup when logging is enough

This commit is contained in:
Andreea Isac 2020-03-05 21:52:13 -08:00
Родитель 23a7daf581
Коммит ca82b20be6
3 изменённых файлов: 18 добавлений и 18 удалений

Просмотреть файл

@ -284,7 +284,7 @@ export async function setNewLaunchConfiguration(): Promise<void> {
await util.spawnChildProcess(configurationCommandName, commandArgs, vscode.workspace.rootPath || "", stdout, stderr, closing);
} catch (error) {
vscode.window.showErrorMessage('Failed to launch make command. Make sure it is on the path. ' + error);
logger.message(error);
return;
}
}
@ -325,7 +325,7 @@ export async function setNewTarget(): Promise<void> {
await util.spawnChildProcess(configurationCommandName, commandArgs, vscode.workspace.rootPath || "", stdout, stderr, closing);
} catch (error) {
vscode.window.showErrorMessage('Failed to launch make command. Make sure it is on the path. ' + error);
logger.message(error);
return;
}
}
@ -358,9 +358,9 @@ export async function selectLaunchConfiguration(launchConfigurations: LaunchConf
items.push(launchConfigurationToString(config));
});
items = items.sort().filter(function(elem, index, selef) {
return index === selef.indexOf(elem);
})
items = items.sort().filter(function(elem, index, self) : boolean {
return index === self.indexOf(elem);
});
// TODO: create a quick pick with description and details for items
// to better view the long targets commands

Просмотреть файл

@ -84,7 +84,7 @@ export class MakefileToolsExtension {
this.cppConfigurationProvider.buildCustomConfigurationProvider(defines, includePath, forcedInclude, standard, intelliSenseMode, compilerPath, filesPaths, windowsSdkVersion);
}
public getCompilerFullPath() { return this.compilerFullPath; }
public getCompilerFullPath() : string | undefined { return this.compilerFullPath; }
}
// A change of target or configuration triggered a new dry-run,

Просмотреть файл

@ -75,10 +75,10 @@ function preprocessDryRunOutput(dryRunOutputStr: string): string {
// TODO: figure out how to do this with string replace
//preprocessedDryRunOutputStr = preprocessedDryRunOutputStr.replace(/\\s+\\$/mg, " ");
preprocessedDryRunOutputStr = preprocessedDryRunOutputStr.replace("\r\n", "\n");
let regexp = /\s+\\$/mg;
let match = regexp.exec(preprocessedDryRunOutputStr);
let regexp : RegExp = /\s+\\$/mg;
let match: RegExpExecArray | null = regexp.exec(preprocessedDryRunOutputStr);
while (match) {
let result = match[0];
let result: string = match[0];
result = result.concat("\n");
preprocessedDryRunOutputStr = preprocessedDryRunOutputStr.replace(result, " ");
match = regexp.exec(preprocessedDryRunOutputStr);
@ -87,18 +87,18 @@ function preprocessDryRunOutput(dryRunOutputStr: string): string {
// Process some more makefile output weirdness
let preprocessedDryRunOutputLines : string[] = [];
preprocessedDryRunOutputStr.split("\n").forEach(line => {
let strC = "--mode=compile";
let idxC = line.indexOf(strC);
let strC: string = "--mode=compile";
let idxC: number = line.indexOf(strC);
if (idxC >= 0) {
line = line.replace(line.substring(0, idxC), "");
line = line.replace(strC, "")
line = line.replace(strC, "");
}
let strL = "--mode=link";
let idxL = line.indexOf(strL);
let strL: string = "--mode=link";
let idxL: number = line.indexOf(strL);
if (idxL >= 0) {
line = line.replace(line.substring(0, idxL), "");
line = line.replace(strL, "")
line = line.replace(strL, "");
}
preprocessedDryRunOutputLines.push(line);
@ -106,8 +106,8 @@ function preprocessDryRunOutput(dryRunOutputStr: string): string {
if (idxL >= 0 && idxC >= 0) {
logger.message("Not supporting --mode=compile and --mode=link on the same line");
}
})
});
preprocessedDryRunOutputStr = preprocessedDryRunOutputLines.join("\n");
// Extract the link command
@ -708,7 +708,7 @@ export function parseForLaunchConfiguration(dryRunOutputStr: string): configurat
});
// Target binary launch configuration duplicates may be generated in the following scenarios.
// They will be filtered later when dealing with the UI pick.
// They will be filtered later when dealing with the UI pick.
// - a target binary invoked several times with the same arguments and from the same path
// - a target binary invoked once with no parameters is still a duplicate
// of the entry generated by the linker command which produced the binary