introduce a fully featured version manager
Installing Zig or ZLS with the extension doesn't properly handle switching between different Zig project. You have to manually figure out which version to get and install it every time your switch to a project that requires a different Zig version. Same goes for ZLS. The vscode configuration for Zig also can't handle switching between devices (see #111) Let's stop giving developer the ability to misconfigure their editor.
- No initial setup for Zig
- initial setup for ZLS is only 'yes' or 'no'
- Done!
Version Manager
This is how the extension selects which version of Zig to install:
- set the
zig.versionconfig option (can be global or per-workspace) - manually set the version through the 'Select and Install' popup (per-workspace)
- set
minimum_zig_versionin thebuild.zigof your workspace - add a
.zigversionto your workspace which stores the desired Zig version
If none of the above apply, the latest tagged release of Zig is installed. Installs are automatically uninstalled to not fill up disk storage too much. Installs are verified with minisign The version of ZLS is inferred from the Zig version.
Status Bar
Hovering over the "Editor Language Status" will show whether Zig and ZLS are installed + their versions. The Status Bar Item for Zig will turn red if is not installed. Clicking on it will open the 'Select and Install' popup.
Updated 'Select and Install' popup
- added an option to manually specify the path to Zig
- added an option to select Zig from PATH (if available)
- display the exact version of nightly
- display which versions are already installed on the host machine
- if no network connection is available, only versions that are already installed are displayed
Remaining issues
- [ ] The version lookup for nightly builds that are specified through the
build.zig.zonis not working properly. see this TODO.- This is the main blocker for this PR. I still need to figure out how to solve it.
- [ ] The
zig.checkForUpdateconfig option and update command have been removed. It should be added back but with some adjustments. - [ ] add some documentation around these new features so that users know how to use them
I wanted to keep these changes as small as possible but I couldn't stop myself. :disappointed: Any feedback would be greatly appreciated.
@Vexu Any thoughts on these changes?
I allowed myself to mention your PR here ! #232
I can remove it from the list if you desire
I'm guessing there is precedence for extensions downloading additional binaries unprompted when installed so I guess that is fine especially since it is from the official source. As long as overriding the path to the Zig binary still works these all seem like good changes. And sorry for taking so long to get to this.
Ready for Review :rocket: I tried to keep the individual commits as readable as possible. Please let me know if there is anything I can do to make it easier to review.
Also, I think that publishing a pre-release can make sense here. I can ask in some of the Zig communities to see if there are people who would like to try this out before it gets published to everyone.
{} zig Zig 0.13.0 seems a little redundant.
How about the following changes:
- Capitalize the first
zig - Remove the second
Zig
The result would be {} Zig 0.13.0.
{} zig Zig 0.13.0seems a little redundant.
You are referring to the status bar items, right?
The reason why I had it this way was because they were made up of two independent items, the {} zig specifies the language of the current document and Zig 0.13.0 specifies the version of compiler. It is possible to hide one of them and keep the other. But I have to agree that having "Zig" appear twice is redundant, I updated it like you suggested.
I did find some minor issues that have been resolved. Otherwise, this is ready to go. I can open some new issues about the follow-up tasks.