Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make run local always present #8024

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Make run local always present #8024

wants to merge 6 commits into from

Conversation

hlshen
Copy link
Contributor

@hlshen hlshen commented Dec 4, 2024

Run local will start the emulator if user agrees.

Follow up feature needed is executing the original request once emulator is fully started.

@hlshen hlshen marked this pull request as draft December 4, 2024 23:40
@hlshen hlshen force-pushed the hlshen/alwayslocal branch from bca7b5a to c86499c Compare January 30, 2025 21:33
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.13%. Comparing base (c0226eb) to head (c86499c).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8024   +/-   ##
=======================================
  Coverage   51.12%   51.13%           
=======================================
  Files         423      423           
  Lines       29722    29722           
  Branches     6083     6083           
=======================================
+ Hits        15196    15198    +2     
+ Misses      13160    13159    -1     
+ Partials     1366     1365    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hlshen hlshen marked this pull request as ready for review January 31, 2025 19:26
@hlshen hlshen requested a review from fredzqm January 31, 2025 19:26
Copy link
Contributor

@fredzqm fredzqm left a comment

Choose a reason for hiding this comment

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

Thank you! Great step to improve discoverability of "run local"!

[Not blocking] Would leave it up to you~
I see this PR adds a warning to ask if user wants to start the emulator.
I personally prefer to skip this question. The intent of "run local" is to run against the emulator, already super clear. Starting local emulator won't break anything. This question will add some frictions and increase drop-off from init local workspace to execute first operation.

I think we can show a warning that says "Automatically started the emulator. Please retry "run local" after it's started."

const startEmulatorsCommand = vscode.commands.registerCommand(
"firebase.emulators.start",
startEmulatorsTask,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity while I try to understand this code.
Excuse my ignorance. Very new to VS Code codebase.

What's the difference between broker and vscode.commands?

My guess is broker communicated any events between UI and extension process, so UI is never blocking. vscode.commands seem like something that can be triggered asynchronously from code, but so can broken.send

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you said, broker is used specifically for communicating between Webviews and the extension process. The Webviews have no concept of "VSCode", so they would not be able to call vscode.comamnds directly.

runTerminalTask(
"firebase emulators",
cmd,
{ focus: true },
);
};
const startEmulatorsTaskBroker = broker.on("runStartEmulators", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw broker.on("runStartEmulators") twice in the code base.

Here and in emulator.ts. Would it make sense to dedup them?

Move to emulator.ts and re-use startEmulators method?


// If the user selects "always", we update User settings.
if (result === always) {
configs.update(alwaysStartEmulator, true, ConfigurationTarget.Global);
Copy link
Contributor

Choose a reason for hiding this comment

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

If customer choose alwaysStartEmulator option, it sounds like we shouldn't show the above prompt again.

Shall we add a branch to skip it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I should add a test for that too. I somehow missed that logic.

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.

3 participants