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

Handling vscode insiders devcontainers #7111

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

aaronpowell
Copy link
Contributor

Fixes #7110

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 14, 2025
@@ -12,7 +12,9 @@ namespace Aspire.Hosting.Devcontainers;
internal class DevcontainerSettingsWriter(ILogger<DevcontainerSettingsWriter> logger, IOptions<CodespacesOptions> codespaceOptions, IOptions<DevcontainersOptions> devcontainerOptions)
{
private const string CodespaceSettingsPath = "/home/vscode/.vscode-remote/data/Machine/settings.json";
private const string LocalDevcontainerSettingsPath = "/home/vscode/.vscode-server/data/Machine/settings.json";
private const string VSCodeServerPath = "/home/vscode/.vscode-server";
Copy link
Member

Choose a reason for hiding this comment

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

Don't these install side by side? We want to apply these modifications to both right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you switch between VS Code and VS Code Insiders with the same devcontainer, you will end up with both a .vscode-server and .vscode-insiders-server in the /home/vscode directory, which means that there is the possibility of false positives and that you apply changes to the wrong settings file.

Unfortunately, I can't find any way in which you can detect which edition of VS Code you're running in the devcontainer. Here's the Community Toolkit, opened in a devcontainer in both VS Code and VS Code Insiders

image

No environment variables seem useful enough in determining which one to apply beyond "guessing" using the available paths, short of checking the PATH for vscode-server or vscode-server-insiders.

Copy link
Member

Choose a reason for hiding this comment

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

Why can’t we do both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It'd require a bit more invasive a refactor, since the method GetSettingsPath (that used the const) only returned a single path, but if that'd be preferred, I can have it go down that path.

Copy link
Member

Choose a reason for hiding this comment

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

Yes I would do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@aaronpowell aaronpowell requested a review from davidfowl January 15, 2025 02:35
@davidfowl davidfowl merged commit d7e27b1 into dotnet:main Jan 15, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Devcontainer support doesn't work for vscode insiders
2 participants