zed icon indicating copy to clipboard operation
zed copied to clipboard

Command palette/projects/text buffer extension API

Open nd0ut opened this issue 1 year ago • 5 comments

Check for existing issues

  • [X] Completed

Describe the feature

Hi! I noticed that Zed has introduced an extension API, and I was planning to write an equivalent of the Project Manager (https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager) for VS Code. However, to my surprise, I found that the API does not allow adding custom commands to the command palette or managing the built-in projects.

I also thought about creating an equivalent of change-case (https://marketplace.visualstudio.com/items?itemName=wmaurer.change-case), but again ran into the lack of command palette API and the inability to control the text buffer.

Could you let me know if you plan to implement something like this, and is it included in the "General purpose extensions" section of the roadmap?

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

No response

nd0ut avatar Sep 18 '24 21:09 nd0ut

Zed already have a native change case, do you want to extend this functionality in any way?

Captura de Tela 2024-09-18 às 18 25 17

elvishp2006 avatar Sep 18 '24 21:09 elvishp2006

Zed already have a native change case, do you want to extend this functionality in any way?

Oh, cool 🔥 I'm sorry, I missed this.

Regarding the project manager, personally, I really miss the automatic scanning for git repositories - that's the reason why I wanted to write an extension for this.

nd0ut avatar Sep 19 '24 14:09 nd0ut

I'd like to add on to this that what i'm missing to make my Zed editor complete are the commands given with the two extensions in VS Code: advanced-new-file and file-utils

These extensions combined give me the possibility with keyboard only (and the command palette)

  • Copy file
  • Move file
  • Rename File
  • Delete File
  • Create new file in specific directory

I think being able to create extensions with a command palette api would solve all of the functionality above.

eliasrenman avatar Oct 08 '24 08:10 eliasrenman

I would like to add commands to the command palette to manage dependencies in my coding projects and trigger build processes, as described here #7808.

The closest we have right now are "slash commands", an API for extensions to register commands to be used within the AI assistant panel. I played with these a bit in this project. I imagine command palette actions could have a very similar API.

Additionally, it is difficult for extensions to run external processes unless it's a language server, or something pretending to be a language server. If extensions are already allowed to download and run binaries for that purpose, surely we could allow this functionality to be used more easily in other contexts.

jacobwhall avatar Nov 01 '24 16:11 jacobwhall

+1 on this request! would love the ability to make a "scratchpad" extension that can be used via the command pallete

adaminglehart avatar May 14 '25 21:05 adaminglehart

For me this would also be a good addition. I have a bunch of tasks for my cmake setup and the extra step of doing task: spawn and then typing cmake seems redundant.

mrexodia avatar May 19 '25 13:05 mrexodia

It would be great if extensions API supports this.

Can an extension add "tasks" to the project based on rules/context? Or can an extension add commands to the command palette?

vivek-pothina avatar Jun 21 '25 11:06 vivek-pothina

This seems like a very significant gap in basic features for an extension API. Can anyone in Zed Industries help us understand why it has not yet been prioritized?

brandonzylstra avatar Jul 23 '25 02:07 brandonzylstra

Zed team's effort is focused on features for now, as certain ones like Windows are missing entirely. The idea is to deliver those first, as a 1.0 promise and only then deal with the extension API, when the surface is more clear and less volatile.

SomeoneToIgnore avatar Jul 23 '25 05:07 SomeoneToIgnore

ℹ️ As a workaround i'm using a task + keybinding calling tv tool (could also works with fzf):

// ~/.config/zed/tasks.json
[
  {
    "label": "Project Finder",
    "command": "zed $(tv projects)",
    "hide": "always",
    "allow_concurrent_runs": true,
    "use_new_terminal": true,
    "reveal_target": "center"
  }
]
// ~/.config/zed/keymap.json
[
  {
    "bindings": {
      // "cmd-p": ["task::Spawn", { "task_name": "File Finder" }],
      "cmd-alt-p": ["task::Spawn", { "task_name": "Project Finder" }]
    }
  }
]
# ~/.config/television/cable/projects.toml
[metadata]
name = "projects"
requirements = ["fd", "git"]
description = "A channel to select from git repositories on your local machine"

[source]
command = "fd --glob .git --hidden --follow --type directory --max-depth 10 --prune ~/Developer/ --exec dirname '{}'"
display = "{regex_extract:.*/Developer/(.*):1}"

[preview]
command = "cd '{}'; git log -n 200 --pretty=medium --all --graph --color"

[keybindings]
shortcut = "f1"
ctrl-j = "actions:cd"
ctrl-m = "actions:zed"

[actions.cd]
description = "Go to directory"
command = "sh -c \"cd {}; $SHELL\""
mode = "execute"

[actions.zed]
description = "Open project into Zed"
command = "zed {}"
mode = "execute"

nikaro avatar Oct 13 '25 14:10 nikaro

This feature would help the Ruby extension fully utilize all language server features. Ruby LSP supports a custom go to relevant file LSP command for toggling between application and test file, which The VSCode extension is able to utilize.

However, since Zed extensions can't register custom commands, nor send custom LSP requests from what I've gathered, Zed can't currently offer the same functionality.

janko avatar Nov 20 '25 10:11 janko