-
Notifications
You must be signed in to change notification settings - Fork 28
Bugfix: ZLS download using incorrect target #68
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
base: master
Are you sure you want to change the base?
Conversation
…ements in target download name
This should be |
|
I think we already do this exact same thing when downloading a mach version. We should share that code which also includes a cache and skips any network requests if we can already find the version in our local cache. |
|
question...do we really need an index for ZLS URLs? is there not a way to just generate the URL from the version? It just seems a bit silly that what we need is to get a download URL, and the way we get that is to generate a download URL that gets us the real download URL? We ultimately have to generate one anyway, why the extra steps? |
I don't think so. Hashstores indicate the zig compiler version and point to the Zig fetch cache, e.g, zls-0.15.1 and zls-0.15.2 hashstores will point to the same cache for the ZLS 0.15.0 binary. Marking the compiler version directly prevents the need to check which versions are compatible at runtime. The naming convention is a bit confusing but I think the intent is correct. |
The only reason is because, for whatever reason, ZLS doesn't match their version numbers to Zig's, so the url cannot be constructed from the compiler version number alone. I am using 0.15.1 but there is no ZLS-0.15.1 so the download fails. Edit: |
|
I'm double checking with ZLS folks if it has to be this way or not. If so, then I made a small commit that has the first part of this change which just puts the logic we're already using for mach in a function: b073c02 So if you want to have it ready, you could just start from that commit and add your function to extract the version for ZLS. |
Fixes: #67
Bug:
In certain conditions Anyzig would target the wrong link when trying to download the Zig Language Server.
Problem:
There were two conditions found that would cause this error:
Using a version of Zig which doesn't map to a ZLS release. Because ZLS doesn't keep the same versioning as Zig, using the compiler version directly can fail.
FIX: Zigtools offers a tool to match Zig version to ZLS version.
Zigtools has swapped the placement of OS and ARCH on the name of their latest binary release. This means the current target parsing is broken on the latest ZLS version.
FIX: Prefer ARCH-OS key, fallback to OS-ARCH.
Changes:
Created a function to call the ZLS version matching tool and do the fallback logic if the OS/ARCH are suspected to be swapped. The only change to existing code is calling this function rather than trying the download directly.
Previous behavior:
New behavior: