zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.51k stars 3.02k forks source link

Language Server Extension fails to load #16284

Open PJUllrich opened 2 months ago

PJUllrich commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I'm trying to built a minimal language server extension, but I receive the following error when I load it into Zed as a dev extension:

2024-08-15T12:43:07.272212Z [ERROR] failed to load wasm extension boring-ls

Caused by:
    0: failed to instantiate wasm extension
    1: component imports resource `key-value-store`, but a matching implementation was not found in the linker
    2: resource implementation is missing

I made sure that I can build the extension with cargo build and cargo build --target wasm32-wasi and both compilations work.

Environment

Zed: v0.148.0 (Zed) OS: macOS 14.5.0 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

The entire extension code is here: https://github.com/PJUllrich/boring-ls

If applicable, attach your Zed.log file to this issue.

Zed.log
2024-08-15T12:48:47.375737Z [INFO] ========== starting zed ==========
2024-08-15T12:48:47.377606Z [INFO] Opening main db
2024-08-15T12:48:47.379406Z [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-08-15T12:48:47.479475Z [ERROR] theme not found: Napalm Github x VSCode
2024-08-15T12:48:47.482703Z [INFO] extensions updated. loading 19, reloading 0, unloading 0
2024-08-15T12:48:47.515553Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.515665Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.515736Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.516203Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.516302Z [INFO] Opening main db
2024-08-15T12:48:47.516373Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.516531Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.516664Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.516843Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.518698Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.520155Z [ERROR] theme not found: Napalm Github x VSCode
2024-08-15T12:48:47.520637Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.522025Z [INFO] building git repository, `.git` path in the worktree: ".git"
2024-08-15T12:48:47.5321Z [WARN] Theme "Fleet Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.532162Z [WARN] Theme "Fleet Dark Purple" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.532208Z [WARN] Theme "Fleet Gray" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.532254Z [WARN] Theme "Fleet Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.538044Z [WARN] Theme "Napalm Github x VSCode" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590039Z [WARN] Theme "Xcode Bare" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590106Z [WARN] Theme "Xcode Basic" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590158Z [WARN] Theme "Xcode Classic Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590208Z [WARN] Theme "Xcode Classic Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.59026Z [WARN] Theme "Xcode Default Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590309Z [WARN] Theme "Xcode Default Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.59037Z [WARN] Theme "Xcode High Contrast Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590401Z [WARN] Theme "Xcode High Contrast Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590432Z [WARN] Theme "Xcode Low Key" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590462Z [WARN] Theme "Xcode Midnight" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590492Z [WARN] Theme "Xcode Presentation Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590528Z [WARN] Theme "Xcode Presentation Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590565Z [WARN] Theme "Xcode Spartan" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590601Z [WARN] Theme "Xcode Sunset" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:48:47.590639Z [INFO] set environment variables from shell:/bin/zsh, path:/opt/homebrew/opt/postgresql@15/bin:/opt/homebrew/opt/postgresql@16/bin:/Users/peterullrich/.pyenv/shims:/Users/peterullrich/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/Users/peterullrich/.cargo/bin:/Users/peterullrich/.mix/escripts:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/opt/postgresql@15/bin:/opt/homebrew/opt/postgresql@16/bin:/Users/peterullrich/.cargo/bin:/Users/peterullrich/.mix/escripts:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/peterullrich/.orbstack/bin:/Users/peterullrich/Library/Python/3.9/bin:/Users/peterullrich/.orbstack/bin:/Users/peterullrich/Library/Python/3.9/bin
2024-08-15T12:48:47.597532Z [INFO] set status on client 0: Authenticating
2024-08-15T12:48:47.598393Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.598703Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.598748Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.599607Z [INFO] Node runtime install_if_needed
2024-08-15T12:48:47.601469Z [INFO] Opening main db
2024-08-15T12:48:47.612006Z [INFO] set status on client 71320: Connecting
2024-08-15T12:48:47.615509Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.648372Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.655161Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:47.694316Z [INFO] starting language server. binary path: "/Users/peterullrich/Library/Application Support/Zed/node/node-v22.5.1-darwin-arm64/bin/node", working directory: "/", args: ["/Users/peterullrich/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
2024-08-15T12:48:47.763325Z [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-08-15T12:48:47.91105Z [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-08-15T12:48:47.907Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-08-15T12:48:47.907Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-08-15T12:48:47.912157Z [INFO] Language server with id 0 sent unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "cec09e73-86a5-4d55-8da5-d5646d0860fd",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-08-15T12:48:47.937202Z [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-08-15T12:48:47.916Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-08-15T12:48:47.916Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
2024-08-15T12:48:48.098792Z [INFO] add connection to peer
2024-08-15T12:48:48.098835Z [INFO] add_connection;
2024-08-15T12:48:48.098867Z [INFO] waiting for server hello
2024-08-15T12:48:48.107085Z [INFO] got server hello
2024-08-15T12:48:48.107157Z [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 483, id: 129824 })
2024-08-15T12:48:48.107213Z [INFO] set status on client 71320: Connected { peer_id: PeerId { owner_id: 483, id: 129824 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-08-15T12:48:48.413485Z [ERROR] failed to load wasm extension boring-ls

Caused by:
    0: failed to instantiate wasm extension
    1: component imports resource `key-value-store`, but a matching implementation was not found in the linker
    2: resource implementation is missing
2024-08-15T12:48:49.183714Z [WARN] request completed with error: failed to connect to the server
2024-08-15T12:48:53.134637Z [INFO] Opening main db
2024-08-15T12:49:13.848364Z [INFO] compiling Rust extension /Users/peterullrich/Library/Application Support/Zed/extensions/installed/boring-ls
2024-08-15T12:49:13.914698Z [INFO] compiling rust extension /Users/peterullrich/Library/Application Support/Zed/extensions/installed/boring-ls
2024-08-15T12:49:13.988918Z [INFO] finished compiling extension /Users/peterullrich/Library/Application Support/Zed/extensions/installed/boring-ls
2024-08-15T12:49:14.256797Z [WARN] Theme "Xcode Bare" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.256888Z [WARN] Theme "Xcode Basic" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.256937Z [WARN] Theme "Xcode Classic Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.256985Z [WARN] Theme "Xcode Classic Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257032Z [WARN] Theme "Xcode Default Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.25708Z [WARN] Theme "Xcode Default Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257127Z [WARN] Theme "Xcode High Contrast Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257175Z [WARN] Theme "Xcode High Contrast Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257222Z [WARN] Theme "Xcode Low Key" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257273Z [WARN] Theme "Xcode Midnight" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257323Z [WARN] Theme "Xcode Presentation Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257374Z [WARN] Theme "Xcode Presentation Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257421Z [WARN] Theme "Xcode Spartan" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.257478Z [WARN] Theme "Xcode Sunset" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.274448Z [WARN] Theme "Fleet Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.274523Z [WARN] Theme "Fleet Dark Purple" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.274562Z [WARN] Theme "Fleet Gray" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.274589Z [WARN] Theme "Fleet Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.279898Z [WARN] Theme "Napalm Github x VSCode" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-08-15T12:49:14.282178Z [INFO] rebuilt extension index in 89.579917ms
2024-08-15T12:49:14.282246Z [INFO] extensions updated. loading 0, reloading 1, unloading 0
2024-08-15T12:49:15.005315Z [ERROR] failed to load wasm extension boring-ls

Caused by:
    0: failed to instantiate wasm extension
    1: component imports resource `key-value-store`, but a matching implementation was not found in the linker
    2: resource implementation is missing
2024-08-15T12:49:15.006026Z [WARN] request completed with error: failed to connect to the server            
Moshyfawn commented 2 months ago

The repo linked in the issue is private.

PJUllrich commented 2 months ago

@Moshyfawn ah apologies. I've made it public now. I also downgraded to the zed_extension_api = 0.0.6 from 0.1.0 and that seemed to have fixed the issue.

PJUllrich commented 2 months ago

Yep, can confirm that upgrading to 0.1.0 throws that exception, but if I downgrade to 0.0.6, it works. I installed and uninstalled the extension in between version changes.

maxdeviant commented 2 months ago

@PJUllrich It looks like the version of Zed you're using is too old for v0.1.0 of the extension API.

v0.149.x is the first version that supports v0.1.0:

https://crates.io/crates/zed_extension_api#compatible-zed-versions