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

Commit 1b3f16f

Browse files
committed
Use trySetOpenedFileAsSketch() method
Here is 2 changes: - Subscrube to event onDidChangeActiveTextEditor to set "sketch" value into arduino.json when useActiveSketch option is true - Don't show sketch name in Status Bar when "sketch" value is atomatically setted in arduino.json
1 parent eb2ac71 commit 1b3f16f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/deviceContext.ts

+7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
115115
this._sketchStatusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, constants.statusBarPriority.SKETCH);
116116
this._sketchStatusBar.command = "arduino.setSketchFile";
117117
this._sketchStatusBar.tooltip = "Sketch File";
118+
vscode.window.onDidChangeActiveTextEditor(()=>{
119+
this.trySetOpenedFileAsSketch();
120+
})
118121
}
119122
}
120123

@@ -194,6 +197,10 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
194197
}
195198

196199
public showStatusBar() {
200+
if(this.trySetOpenedFileAsSketch()){
201+
return;
202+
}
203+
197204
if (!this._sketch) {
198205
return false;
199206
}

0 commit comments

Comments
 (0)