tristanisham / zvm

zvm (Zig Version Manager) lets you easily install/upgrade between different versions of Zig.
https://www.zvm.app
MIT License
488 stars 33 forks source link

Option to Install ZLS #26

Closed SigSeg-V closed 1 year ago

SigSeg-V commented 1 year ago

Added a flag to install ZLS along with zig, this is useful for users not using vscode who have to install zls manually to have language server functionality in their editor. Limitations of this change: cannot install ZLS prior to 0.11.0 by default on Windows as it is packaged as a tarball, which can't be untarred by default.

Tested on: Linux x86_64 Windows x86_64 MacOS aarch64

tristanisham commented 1 year ago

Regarding unbundling the tarball on Windows, is the limitation that older versions of ZLS on Windows are encoded as tarballs, or is it that before 0.11, only Unix builds were available?

I think in the last version of ZVM I included some Go functions to extract tarballs. Could we use these on Windows to support the older releases?

SigSeg-V commented 1 year ago
The problem is they changed formats in 0.10.0 which is packaged as a zstd on all platforms, and Windows and MacOS doesn't have zstd out of the box so would have to list as a dependency. zstd is much more of a hassle to install on windows than linux/mac so I don't like the solution, but if installed it will work though. I pushed a small commit that changes the extract command to check the extension for the extract method instead of looking at OS and works on all platforms I can test. A summary of the new test results: OS Arch Versions Tested Deps Outcome
Linux amd64 0.1 - master zstd
MacOS aarch64 0.1 - master zstd
Windows amd64 0.1 - master zstd
Joen-UnLogick commented 1 year ago

If the zls install fails gracefully on windows on pre 0.11 then I'd say +1 on merging it... of course I would prefer if it worked, but zls is exactly the same hazzle as zig.

tristanisham commented 1 year ago

I've changed my mind on this issue. It might be worth supporting it for the more recent versions, then as something we can tackle later on for earlier versions.

I've just gotten back from my vacation and am suffering from some severe jet lag. I'll be taking today to recover, then I should be able to give this issue my full attention tomorrow.

I should reintroduce that I'll probably change the flags for this download to work, but overall I'm on board with the feature. More notes to follow tomorrow night.

tristanisham commented 1 year ago

Pushed my changes https://github.com/tristanisham/zvm/tree/SigSeg-V-master

tristanisham commented 1 year ago

So right now the only issue is that downloading Zig or ZLS will wipe out the other install. Not super helpful. I'm probably going to call it a night tonight, but the final step is to make sure both can be installed without conflicting with the other. I'm thinking of adding ZLS to a deps dir or something. I'm suffering from some jet lag so I'll reevaluate after some sleep!

Edit:

I did end up fixing it. Back to the original behavior where ZLS has to be installed with a Zig version.

The new syntax is:

zvm i -D=zls master

tristanisham commented 1 year ago

Also, @SigSeg-V @Joen-UnLogick It looks like there's a 100% Go zstd extraction library