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.53k stars 3.03k forks source link

Unable to read from fs in slash command extension #16933

Open JaLnYn opened 2 months ago

JaLnYn commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I am attempting to write an extension that allows users to find and select python environments with a simple command. However, while the code logic works outside of zed extensions, I am getting os error 44 inside running inside the extension.

Code to reproduce is here https://github.com/JaLnYn/zed_pyenvselect Steps:

  1. install extension
  2. run /pyenvlst to lst commands
    
    Expected output:
    ======
    some python envs ...
    ======
    len n

Actual output:

Error reading directory ([worktree directory]): No such file or directory (os error 44) ======



I have appended error to the text output to see it. 

### Environment

Zed: v0.149.5 (Zed)
OS: macOS 14.6.1
Memory: 16 GiB
Architecture: aarch64

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

_No response_

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

<details><summary>Zed.log</summary><pre>
<!-- Click below this line and paste or drag-and-drop your log-->

<!-- Click above this line and paste or dra
[Zed.log](https://github.com/user-attachments/files/16757349/Zed.log)
g-and-drop your log--></pre></details>
maxdeviant commented 2 months ago

Extensions run inside of the Wasm sandbox and can currently only perform arbitrary file I/O within the extension working directory.

JaLnYn commented 2 months ago

Extensions run inside of the Wasm sandbox and can currently only perform arbitrary file I/O within the extension working directory.

Is there documentation you can point to about how to perform io operations within the working directory?

JaLnYn commented 2 months ago

There is no way to search the file directories either.