Closed mutkach closed 1 year ago
I'm not sure if this is within scope. How do you see the implementation working? @mutkach
ZLS pushes tags so you could possibly pull the tag that matches the selected Zig version. Not sure how it'd work for the master branch though.
I think it'd be good to have the option to. I created a fork with this feature by adding a flag --zls
with the install command, for example zvm i master --zls
Only master works so far because the tagged releases mentioned above ~require auth from Github's API afaik~.
Edit: I have gotten releases to download in curl without an auth token (am noob, haven't used github api before) will implement soon.
Opened PR adding this feature.
Another "hacky" solution is to clone the zls
repository and then building the needed version with the correct prefix into the directory. So when using zvm use 0.11.0
it also changes the zls
version.
This might be added to the README.md
if it is not easily possible to implement zls installation as a feature.
Command for 0.11.0
after cloning zls
repository and being inside the folder:
git checkout 0.11.0
zig build --prefix-exe-dir ~/.zvm/0.11.0/ -Doptimize=ReleaseSafe
or for master
:
git checkout master
zig build --prefix-exe-dir ~/.zvm/master/ -Doptimize=ReleaseSafe
Using zvm use master
results in:
$ zig version
0.12.0-dev.789+e6590fea1
$ zls --version
0.12.0-dev.133+ef3497c
and zvm use 0.11.0
as expected results in:
$ zig version
0.11.0
$ zls --version
0.11.0
zvm
could handle the build step for you. If you enabled install_ZLS in the settings.json
file, or passed it as a flag, if there was a version without a recompiled release ZVM could clone and build the zig projects for your system.
There's some support for ZVM in this capacity already built in. The sync command can already set Sky versions in a per-project basis. It wouldn't be hard to add a Zig runner so you could run different versions of Zig in the same project?
@tristanisham is compiling zls for each release more in line with zvm than downloading the releases and placing them in the release directory? Can pivot the open PR to go this direction if so.
@SigSeg-V I don't think so, but I wouldn't want ZLS to be installed in root with the rest of Zig. Maybe in a new directory? ~/.zvm/modules or ~/.zvm/vendor? I feel like the main directory is getting crowded.
Also, sorry about taking a while to respond. I'm just getting back from a trip. Will be on another one next week too.
No worries will work on that Sunday, been unusually busy at work. Have a good one :)
@SigSeg-V I've merged your request! Thanks for working so hard on this enhancement! Feel free to keep making PRs and tweaking with ZVM. I really appreciate your contributions! 😄
My request is more of a question about whether it makes sense to add
zls
as an optional part of installation (the same way asghcup
works, which allows to install hls, ghc, and its build systems).My experience was that, when you install a master version of
zig
, you also get an outdatedzls
, which is a little inconvenient.