One more round of code review feedback

This commit is contained in:
Andreea Isac 2020-07-14 04:05:58 -07:00
Родитель ffc34b4a42
Коммит 9736ab43d2
11 изменённых файлов: 18 добавлений и 18 удалений

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

@ -98,6 +98,7 @@
},
"makefilePath": {
"type": "string",
"default": "makefile",
"description": "File path to the makefile"
},
"makePath": {

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

@ -283,8 +283,7 @@ export function getCommandForConfiguration(configuration: string | undefined): v
// Make sure to copy from makefile.configurations.makeArgs because we are going to append more switches,
// which shouldn't be identified as read from settings.
// Make sure we start from a fresh empty configurationMakeArgs because there may be old arguments that don't apply anymore.
configurationMakeArgs = [];
configurationMakeArgs = configurationMakeArgs.concat(makefileConfiguration?.makeArgs || []);
configurationMakeArgs = makefileConfiguration?.makeArgs?.concat() || [];
// Name of the make tool can be defined as makePath in makefile.configurations or as makefile.makePath.
// When none defined, default to "make".

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

@ -147,8 +147,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
return launcher.launchTargetPath();
}));
context.subscriptions.push(vscode.commands.registerCommand('makefile.launchCurrentDir', () => {
return launcher.launchCurrentDir();
context.subscriptions.push(vscode.commands.registerCommand('makefile.launchTargetDirectory', () => {
return launcher.launchTargetDirectory();
}));
context.subscriptions.push(vscode.commands.registerCommand('makefile.launchTargetArgs', () => {

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

@ -24,7 +24,7 @@ export class Launcher implements vscode.Disposable {
// Command property accessible from launch.json:
// the full path from where the target binary is to be launched
public launchCurrentDir(): string {
public launchTargetDirectory(): string {
let launchConfiguration: configuration.LaunchConfiguration | undefined = configuration.getCurrentLaunchConfiguration();
if (launchConfiguration) {
return launchConfiguration.cwd;
@ -83,7 +83,7 @@ export class Launcher implements vscode.Disposable {
if (!configuration.getCurrentLaunchConfiguration()) {
vscode.window.showErrorMessage("Currently there is no launch configuration set.");
logger.message("Cannot start debugging because there is no launch configuration set. " +
"Define one in the settings file or use the makefile.setLaunchConfigurationCommand");
"Define one in the settings file or use the makefile.setLaunchConfiguration");
return undefined;
}
@ -133,7 +133,7 @@ export class Launcher implements vscode.Disposable {
type: dbg,
name: `Debug My Program`,
request: 'launch',
cwd: '${command:makefile.launchCurrentDir}',
cwd: '${command:makefile.launchTargetDirectory}',
args,
program: '${command:makefile.launchTargetPath}',
miMode: miMode,
@ -141,7 +141,7 @@ export class Launcher implements vscode.Disposable {
};
logger.message("Created the following debug config:\n type = " + debugConfig.type +
"\n cwd = " + debugConfig.cwd + " (= " + this.launchCurrentDir() + ")" +
"\n cwd = " + debugConfig.cwd + " (= " + this.launchTargetDirectory() + ")" +
"\n args = " + args.join(" ") +
"\n program = " + debugConfig.program + " (= " + this.launchTargetPath() + ")" +
"\n miMode = " + debugConfig.miMode +
@ -180,7 +180,7 @@ export class Launcher implements vscode.Disposable {
if (!configuration.getCurrentLaunchConfiguration()) {
vscode.window.showErrorMessage("Currently there is no launch configuration set.");
logger.message("Cannot run binary because there is no launch configuration set. " +
"Define one in the settings file or use the makefile.setLaunchConfigurationCommand");
"Define one in the settings file or use the makefile.setLaunchConfiguration");
return undefined;
}
@ -188,7 +188,7 @@ export class Launcher implements vscode.Disposable {
// Add a pair of quotes just in case there is a space in the binary path
let terminalCommand: string = '"' + this.launchTargetPath() + '" ';
terminalCommand += this.launchTargetArgs().join(" ");
logger.message("Running command '" + terminalCommand + "' in the terminal from location '" + this.launchCurrentDir() + "'");
logger.message("Running command '" + terminalCommand + "' in the terminal from location '" + this.launchTargetDirectory() + "'");
return terminalCommand;
}
@ -202,7 +202,7 @@ export class Launcher implements vscode.Disposable {
terminalOptions.shellPath = 'C:\\Windows\\System32\\cmd.exe';
}
terminalOptions.cwd = this.launchCurrentDir();
terminalOptions.cwd = this.launchTargetDirectory();
if (!this.launchTerminal) {
this.launchTerminal = vscode.window.createTerminal(terminalOptions);

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

@ -281,7 +281,7 @@ Found the following launch targets defined in the makefile: {REPO:VSCODE-MAKEFIL
Setting launch target "{REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros>8cc()"
Created the following debug config:
type = cppdbg
cwd = ${command:makefile.launchCurrentDir} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros)
cwd = ${command:makefile.launchTargetDirectory} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros)
args =
program = ${command:makefile.launchTargetPath} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros/8cc)
miMode = gdb

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

@ -281,7 +281,7 @@ Found the following launch targets defined in the makefile: {REPO:VSCODE-MAKEFIL
Setting launch target "{REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros>8cc()"
Created the following debug config:
type = cppdbg
cwd = ${command:makefile.launchCurrentDir} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
cwd = ${command:makefile.launchTargetDirectory} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
args =
program = ${command:makefile.launchTargetPath} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros\8cc)
miMode = gdb

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

@ -299,7 +299,7 @@ Found the following launch targets defined in the makefile: {REPO:VSCODE-MAKEFIL
Setting launch target "{REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros>bin/foo.o()"
Created the following debug config:
type = cppdbg
cwd = ${command:makefile.launchCurrentDir} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros)
cwd = ${command:makefile.launchTargetDirectory} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros)
args =
program = ${command:makefile.launchTargetPath} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros/bin/foo.o)
miMode = gdb

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

@ -299,7 +299,7 @@ Found the following launch targets defined in the makefile: {REPO:VSCODE-MAKEFIL
Setting launch target "{REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros>bin/foo.o()"
Created the following debug config:
type = cppdbg
cwd = ${command:makefile.launchCurrentDir} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
cwd = ${command:makefile.launchTargetDirectory} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
args =
program = ${command:makefile.launchTargetPath} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros\bin\foo.o)
miMode = gdb

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

@ -97,7 +97,7 @@ Found the following launch targets defined in the makefile: {REPO:VSCODE-MAKEFIL
Setting launch target "{REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros>bin/InterestingSmallMakefile/ARC H3/Debug/main.exe(str3a,str3b,str3c)"
Created the following debug config:
type = cppvsdbg
cwd = ${command:makefile.launchCurrentDir} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
cwd = ${command:makefile.launchTargetDirectory} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
args = str3a str3b str3c
program = ${command:makefile.launchTargetPath} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros\bin\InterestingSmallMakefile\ARC H3\Debug\main.exe)
miMode = undefined

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

@ -204,7 +204,7 @@ Found the following launch targets defined in the makefile: {REPO:VSCODE-MAKEFIL
Setting launch target "{REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros>bin/tvmi()"
Created the following debug config:
type = cppdbg
cwd = ${command:makefile.launchCurrentDir} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros)
cwd = ${command:makefile.launchTargetDirectory} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros)
args =
program = ${command:makefile.launchTargetPath} (= {REPO:VSCODE-MAKEFILE-TOOLS}/src/test/fakeSuite/Repros/bin/tvmi)
miMode = gdb

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

@ -204,7 +204,7 @@ Found the following launch targets defined in the makefile: {REPO:VSCODE-MAKEFIL
Setting launch target "{REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros>bin/tvmi()"
Created the following debug config:
type = cppdbg
cwd = ${command:makefile.launchCurrentDir} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
cwd = ${command:makefile.launchTargetDirectory} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros)
args =
program = ${command:makefile.launchTargetPath} (= {REPO:VSCODE-MAKEFILE-TOOLS}\src\test\fakeSuite\Repros\bin\tvmi)
miMode = lldb