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

Commit

Permalink
Use trySetOpenedFileAsSketch() method
Browse files Browse the repository at this point in the history
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
  • Loading branch information
MrSantiaga committed Feb 8, 2020
1 parent 87dfacc commit 7c91379
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/deviceContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
this._sketchStatusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, constants.statusBarPriority.SKETCH);
this._sketchStatusBar.command = "arduino.setSketchFile";
this._sketchStatusBar.tooltip = "Sketch File";
vscode.window.onDidChangeActiveTextEditor(() => {
this.trySetOpenedFileAsSketch();
})
}
}

Expand Down Expand Up @@ -194,6 +197,10 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable {
}

public showStatusBar() {
if (this.trySetOpenedFileAsSketch()) {
return;
}

if (!this._sketch) {
return false;
}
Expand Down

0 comments on commit 7c91379

Please sign in to comment.