From 3064f88c435b6e4aedc83cd32b3db465bf92365b Mon Sep 17 00:00:00 2001 From: "Mr.Santiaga" Date: Wed, 19 Feb 2020 16:08:15 +0300 Subject: [PATCH 1/2] Call showStatusBar() to render sketchStatusBar item after successfully sketch selecting. --- src/deviceContext.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/deviceContext.ts b/src/deviceContext.ts index 2e7f18e3..119a3fce 100644 --- a/src/deviceContext.ts +++ b/src/deviceContext.ts @@ -359,6 +359,9 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable { this.sketch = chosen.label; } } + }) + .then(() => { + this.showStatusBar(); }); } } From 728a17a2dc31b63275856bbb8837998f63a95bb8 Mon Sep 17 00:00:00 2001 From: "Mr.Santiaga" Date: Sat, 8 Feb 2020 04:26:45 +0300 Subject: [PATCH 2/2] Use existing resolveMainSketch() method to select sketches from workspace after clicking on sketchStatusBar item. It allows to select existing source file --- src/extension.ts | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 57eae256..9e555f07 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -153,24 +153,7 @@ export async function activate(context: vscode.ExtensionContext) { }); registerArduinoCommand("arduino.setSketchFile", async () => { - const sketchFileName = deviceContext.sketch; - const newSketchFileName = await vscode.window.showInputBox({ - placeHolder: sketchFileName, - validateInput: (value) => { - if (value && /\.((ino)|(cpp)|c)$/.test(value.trim())) { - return null; - } else { - return "Invalid sketch file name. Should be *.ino/*.cpp/*.c"; - } - }, - }); - - if (!newSketchFileName) { - return; - } - - deviceContext.sketch = newSketchFileName; - deviceContext.showStatusBar(); + await deviceContext.resolveMainSketch(); }); registerArduinoCommand("arduino.uploadUsingProgrammer", async () => {