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

various version manager improvements #389

Merged
merged 7 commits into from
Jan 26, 2025
Merged

Conversation

Techatrix
Copy link
Collaborator

This PR applies three changes to the version manager. The changes correspond the first three commits.

offer to update workspace config files when selecting Zig version

fixes #247

Using the "Select and Install" popup to switch to a different Zig version will no longer be saved permanently. It will revert to the previous version after restarting VS Code. To make the change permanent, the version should be saved in a .zigversion, build.zig.zon or settings.json file. The extension will automatically suggest this change with a message. If not workspace config has been found, a .zigversion file will be created.

I am open to any better wording suggestions for the message. This is what I went for:

Screenshot From 2025-01-23 18-30-30

lookup Zig in the $PATH if no workspace version has been specified.

If the workspace specified no Zig version, the extension would automatically install the latest tagged release. This commit will try to lookup Zig in the $PATH before falling back to the latest tagged release. This is meant to avoid confusing users why their already installed Zig version is not being used.

override the $PATH in the integrated terminal

Previously, if the $PATH has a zig version, the integrated terminal would prefer it over the version that is used by the version manager. Thanks to the previous commit, it now makes more sense to override the $PATH. This means that the integrated terminal will use the Zig version requested by the workspace even if the user added Zig to the $PATH.

Copy link
Member

@Vexu Vexu left a comment

Choose a reason for hiding this comment

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

LGTM!

I don't have a better idea for the message but asking to "save Zig version in this workspace" when not in a workspace seems strange. Maybe it should have a more specific message or just save the version in settings without asking since workspaces can override it.

When sourcing the zig version from the build.zig.zon and then manually
changing the zig to a version below the specified minimum, the
following two messages will be shown:

- "Your Zig version ... does not satify the minimum Zig version"
- "Would you like to save Zig ... in this workspace?"

Showing the dialog before changing the zig version will make sure that
only the second message will be shown.
@Techatrix
Copy link
Collaborator Author

Maybe it should have a more specific message or just save the version in settings without asking since workspaces can override it.

I went ahead and removed the dialog when outside of a workspace. The version will be saved in the global vscode settings which has lower priority over versions that are specified in a workspace.

@Vexu Vexu merged commit 30a1672 into master Jan 26, 2025
2 checks passed
@Techatrix Techatrix deleted the techatrix/version-manager2 branch January 26, 2025 18:29
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.

selecting a Zig version should offer to update .zigversion or build.zig.zon
2 participants