Skip to content

Commit

Permalink
update status label with new selected version
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 committed Apr 11, 2024
1 parent 9f2e665 commit 8f7a93d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,11 @@ export async function activate(context: vscode.ExtensionContext) {

registerIDFCommand("espIdf.selectCurrentIdfVersion", () => {
PreCheck.perform([webIdeCheck, openFolderCheck], async () => {
const curWorkspaceFolder = vscode.workspace.workspaceFolders.find(
(w) => w.uri === workspaceRoot
);
await selectIdfSetup(curWorkspaceFolder);
const currentIdfSetup = await selectIdfSetup(workspaceRoot);
if (currentIdfSetup) {
statusBarItems["currentIdfVersion"].text =
"$(octoface) ESP-IDF v" + currentIdfSetup.version;
}
});
});

Expand Down
8 changes: 5 additions & 3 deletions src/versionSwitcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import { ConfigurationTarget, Uri, window, WorkspaceFolder } from "vscode";
import { ConfigurationTarget, Uri, window } from "vscode";
import { getPreviousIdfSetups } from "../setup/existingIdfSetups";
import {
checkIdfSetup,
Expand All @@ -27,7 +27,7 @@ import { getIdfMd5sum } from "../setup/espIdfJson";
import { getEspIdfFromCMake } from "../utils";
import { IdfSetup } from "../views/setup/types";

export async function selectIdfSetup(workspaceFolder: WorkspaceFolder) {
export async function selectIdfSetup(workspaceFolder: Uri) {
const idfSetups = await getPreviousIdfSetups(true);
if (idfSetups.length === 0) {
await window.showInformationMessage("No ESP-IDF Setups found");
Expand All @@ -50,8 +50,10 @@ export async function selectIdfSetup(workspaceFolder: WorkspaceFolder) {
}
await useIdfSetupSettings(
selectedIdfSetupOption.target,
ConfigurationTarget.WorkspaceFolder
ConfigurationTarget.WorkspaceFolder,
workspaceFolder
);
return selectedIdfSetupOption.target;
}

export async function getCurrentIdfSetup(workspaceFolder: Uri) {
Expand Down

0 comments on commit 8f7a93d

Please sign in to comment.