Skip to content

Add Status Items when running commands#147

Merged
hyzyla merged 12 commits intosweetpad-dev:mainfrom
BlackWolf:add-command-status-item
May 11, 2025
Merged

Add Status Items when running commands#147
hyzyla merged 12 commits intosweetpad-dev:mainfrom
BlackWolf:add-command-status-item

Conversation

@BlackWolf
Copy link
Copy Markdown
Contributor

The main goal of these changes is to better communicate the current state of sweetpad and especially builds to the user, which can be hard to understand right now. The changes here are twofold:

  1. Each command create a statusBarItem to inform the user about the current task and progress of the command
  2. A new option was added to disable auto reveal of the terminal when running build commands

Two very common scenarios where this PR improves the workflow are:

a) The user runs a build for the first time and we need to fetch the schemes and destinations, which can take considerable time on larger projects. So far, it appeared to the user as if the command doesn't do anything, since this is done silently in the background. Now, the user will get proper progress reports in the status bar
b) You Launch the app and want to know if the pipeline is still building, installing or already running. So far you had to check terminal output, now this can be seen easily on the vs code status bar

The auto-reveal option was added for users (such as me) who do not regularly require to inspect the app logs. For example, a lot of times my workflow is just changing code, then launching the app to check my changes. I do not require the terminal at all here. The new option to prevent auto-reveal of the terminal + the information I get from the statusbar are now enough to support such workflows.

Disclaimer: I am neither very familiar with TypeScript nor the VS Code API. I'm happy for any suggestions for this PR. I mainly wrote this for myself but I think this can really benefit others as well.

await runOniOSSimulator(this.context, terminal, {
scheme: scheme,
simulatorId: destination.udid,
destination: destination,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed from passing primitives to Destination objects in 2-3 places, which allows us to better access the destination name for outputting it in the status bar

pick.onDidHide(() => {
reject(new QuickPickCancelledError());
pick.dispose();
});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far cancelling a QuickPick just left the command "hanging", it would never resolve or reject. Now we count this as rejected, but will catch it in CommandExecution so no error is shown to the user

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a clever, thanks for adding this!

@hyzyla
Copy link
Copy Markdown
Collaborator

hyzyla commented May 7, 2025

Thanks so much for your contribution! I tried running it locally and really like the idea

Disclaimer: I am neither very familiar with TypeScript nor the VS Code API. I'm happy for any suggestions for this PR. I mainly wrote this for myself but I think this can really benefit others as well.

Don't worry about that — at first glance, the your code is already looks good. During the code review, I’ll update any parts where I prefer in different way, so no pressure to make it perfect

@hyzyla
Copy link
Copy Markdown
Collaborator

hyzyla commented May 11, 2025

I've updated the pull request with additional refactoring. I decided that is time to remove CommandExecution class at all and rely on AsyncLocalStorage to pass the current command down the call chain. I was planning to do it, but I decided that now is the right time to do it

@hyzyla hyzyla merged commit 2fdf634 into sweetpad-dev:main May 11, 2025
@hyzyla
Copy link
Copy Markdown
Collaborator

hyzyla commented May 11, 2025

Thanks! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants