vscode-zig icon indicating copy to clipboard operation
vscode-zig copied to clipboard

Unable to install ZLS 0.11.0 for Zig version 0.11.0

Open ftruter opened this issue 1 year ago • 1 comments

Can someone please tell me how to install ZLS manually? Doing it through this extension always fails.

It downloads the ZIG tarball and installs it. Then it downloads the ZLS tarball and upon installing it:-

TypeError: Cannot read properties of undefined (reading 'status')
Source: Zig Language

macOS Sonoma System installed Python 3.11.6

Version: 1.86.0-insider Commit: 271fb7fbd599b49a1482ea7284a50b3229317f96 Date: 2024-01-19T05:46:59.001Z Electron: 27.2.1 ElectronBuildId: 26149897 Chromium: 118.0.5993.159 Node.js: 18.17.1 V8: 11.8.172.18-electron.0 OS: Darwin arm64 23.3.0

ftruter avatar Jan 19 '24 22:01 ftruter

That's strange, would you be able to install a modified version of the extension to get a more accurate error message?

Steps:

git clone https://github.com/ziglang/vscode-zig.git --depth 1 --single-branch
git apply patch
npm install
npx vsce package
code --install-extension vscode-zig-0.5.1.vsix

patch:

diff --git a/src/zls.ts b/src/zls.ts
index b6fe42d..5a77334 100644
--- a/src/zls.ts
+++ b/src/zls.ts
@@ -216,7 +216,7 @@ async function installVersion(context: ExtensionContext, version: SemVer) {
             })).data;
         } catch (err) {
             // Missing prebuilt binary is reported as AccessDenied
-            if (err.response.status == 403) {
+            if (err.response != undefined && err.response.status == 403) {
                 window.showErrorMessage(`A prebuilt ZLS ${version} binary is not available for your system. You can build it yourself with https://github.com/zigtools/zls#from-source`);
                 return;
             }

And if not, you can manually install ZLS by downloading https://zigtools-releases.nyc3.digitaloceanspaces.com/zls/0.11.0/aarch64-macos/zls, making it executable with chmod and setting zig.zls.path to it.

Vexu avatar Jan 20 '24 15:01 Vexu