Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit e03dc38

Browse files
hlovdaladiazulay
authored andcommitted
Move arg buildup earlier in functions
1 parent 88bed5e commit e03dc38

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

src/arduino/arduino.ts

+20-23
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,6 @@ export class ArduinoApp {
138138
return;
139139
}
140140

141-
arduinoChannel.show();
142-
arduinoChannel.start(`Upload sketch - ${dc.sketch}`);
143-
144-
await vscode.workspace.saveAll(false);
145-
146-
if (!await this.runPreBuildCommand(dc)) {
147-
return;
148-
}
149-
150141
if (!compile && !this.useArduinoCli()) {
151142
arduinoChannel.error("This command is only availble when using the Arduino CLI");
152143
return;
@@ -176,14 +167,20 @@ export class ArduinoApp {
176167
args.push("--port", dc.port);
177168
}
178169

179-
if (!await this.runPreBuildCommand(dc)) {
180-
return;
181-
}
182-
183170
const verbose = VscodeSettings.getInstance().logLevel === "verbose";
184171
if (verbose) {
185172
args.push("--verbose");
186173
}
174+
175+
await vscode.workspace.saveAll(false);
176+
177+
arduinoChannel.show();
178+
arduinoChannel.start(`Upload sketch - ${dc.sketch}`);
179+
180+
if (!await this.runPreBuildCommand(dc)) {
181+
return;
182+
}
183+
187184
if (dc.output && compile) {
188185
const outputPath = path.resolve(ArduinoWorkspace.rootPath, dc.output);
189186
const dirPath = path.dirname(outputPath);
@@ -258,14 +255,6 @@ export class ArduinoApp {
258255
await this.getMainSketch(dc);
259256
}
260257

261-
await vscode.workspace.saveAll(false);
262-
263-
arduinoChannel.start(`Verify sketch - ${dc.sketch}`);
264-
265-
if (!await this.runPreBuildCommand(dc)) {
266-
return false;
267-
}
268-
269258
if (!this.useArduinoCli()) {
270259
args.push("--verify");
271260
} else {
@@ -276,6 +265,16 @@ export class ArduinoApp {
276265
if (verbose) {
277266
args.push("--verbose");
278267
}
268+
269+
await vscode.workspace.saveAll(false);
270+
271+
arduinoChannel.show();
272+
arduinoChannel.start(`Verify sketch - ${dc.sketch}`);
273+
274+
if (!await this.runPreBuildCommand(dc)) {
275+
return false;
276+
}
277+
279278
if (output || dc.output) {
280279
const outputPath = path.resolve(ArduinoWorkspace.rootPath, output || dc.output);
281280
const dirPath = path.dirname(outputPath);
@@ -297,8 +296,6 @@ export class ArduinoApp {
297296
arduinoChannel.warning(msg);
298297
}
299298

300-
arduinoChannel.show();
301-
302299
let success = false;
303300
const compilerParserContext = makeCompilerParserContext(dc);
304301

0 commit comments

Comments
 (0)