Skip to content

Integrate DTS emulator with workspace view #4405

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

Open
wants to merge 62 commits into
base: main
Choose a base branch
from

Conversation

philliphoff
Copy link
Member

Adds a DTS emulator node to the Workspace view of the Azure Resources explorer, which will show running DTS emulator instances. This node offers the ability to start new emulator instances. Emulator nodes, like in the Azure Resources view, offers the abilities:

  • Copy connections strings
  • Open the corresponding task hub dashboard
  • Shutdown the emulator

The DTS settings have been updated to allow customization (i.e. registry, image, tag) of the emulator container image. Emulators started by the VS Code instance will be shutdown when the instance is closed. (Emulators started outside of the VS Code instance will not be shutdown.)

Note: the emulator features are not hidden behind the "preview features" toggle as they are (as of now) available to all.

Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Phillip Hoff <[email protected]>
@philliphoff philliphoff requested a review from a team as a code owner March 9, 2025 00:29
@nturinski
Copy link
Member

nturinski commented Mar 11, 2025

Phil, would it be possible to add a command to install/uninstall the emulator similar to Azure Functions Core Tools?

{1FAB6A97-BC9B-42E3-B73C-E4FE55246B3A}

When you activate the extension, it immediately throws an error as well:
{CAD31C57-8815-4A54-8B32-B93B55B2782A}

I think that it may be a jarring experience for users that do not have the DTS emulator installed or are not engaging with it.

@philliphoff
Copy link
Member Author

@nturinski Thanks for taking a look.

Phil, would it be possible to add a command to install/uninstall the emulator similar to Azure Functions Core Tools?

The emulator is just a Docker container; there's nothing to install or uninstall really (save pulling/removing an image). I'll think about whether we can show/hide the workspace node based on the existence of the image (and then have a command that just pulls it). I feel that's not terribly discoverable, though.

When you activate the extension, it immediately throws an error as well:

Well that's not good; I'll try to repro and resolve that.

@nturinski
Copy link
Member

The emulator is just a Docker container; there's nothing to install or uninstall really (save pulling/removing an image). I'll think about whether we can show/hide the workspace node based on the existence of the image (and then have a command that just pulls it). I feel that's not terribly discoverable, though.

I think if the node could instruct users on where/how to get the image, that could be helpful. Like a disabled/enabled state? That way we could still have the discoverability regardless.

@philliphoff
Copy link
Member Author

I think if the node could instruct users on where/how to get the image, that could be helpful. Like a disabled/enabled state? That way we could still have the discoverability regardless.

@nturinski The image will be auto-pulled if/when the user attempts to start the container, so there's nothing they need to do (aside from Docker being running).

That said, I've added some robustness to the Docker management logic, and on errors the DTS Emulators node will show a warning node with the error (e.g. "is Docker installed and running?"). I've also updated the root node to auto-expand only if emulators are already running. This should make the feature a little less "in your face" if you're not actually using it.

@alexweininger
Copy link
Member

Would you want to try to start the Docker runtime for the user if it's not already running? I know there are other runtimes, but I think most devs still use Docker. Mostly suggesting it because I was using the dev containers feature in VS Code today and it auto started Docker desktop for me so it's fresh in my mind.

@alexweininger
Copy link
Member

Non-blocking feedback here:

image image

Since there aren't that many actions available on the emulator tree item and the task hub item, I think it makes sense to expose the "big" ones as buttons on the tree item itself. Similar to the buttons we have on the Functions local project tree item:
Screenshot 2025-03-19 at 5 13 23 PM

I think at least a stop/start button on the emulator item would make a lot of sense. And an open in dashboard button on the task hub. I figure we might as well make these things as discoverable as possible.

@philliphoff
Copy link
Member Author

Would you want to try to start the Docker runtime for the user if it's not already running? I know there are other runtimes, but I think most devs still use Docker. Mostly suggesting it because I was using the dev containers feature in VS Code today and it auto started Docker desktop for me so it's fresh in my mind.

@alexweininger I talked to the Docker extension team and they, themselves, do not automatically start the container runtime so I'm hesitant to try to do that in this case. (Just trying to understand which runtime is in use and how to start it would be a significant concern--I'm using the Docker extension client library to abstract away the runtime being used, so the extension doesn't actually know.)

@philliphoff
Copy link
Member Author

I think at least a stop/start button on the emulator item would make a lot of sense. And an open in dashboard button on the task hub. I figure we might as well make these things as discoverable as possible.

@alexweininger Those are good ideas and I've added inline commands for opening the taskhub dashboard, as well as for starting and stopping emulator instances.

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