mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
f8672289fc
This PR adds a Prompt Library to Zed, powering custom prompts and any default prompts we want to package with the assistant. These are useful for: - Creating a "default prompt" - a super prompt that includes a collection of things you want the assistant to know in every conversation. - Adding single prompts to your current context to help guide the assistant's responses. - (In the future) dynamically adding certain prompts to the assistant based on the current context, such as the presence of Rust code or a specific async runtime you want to work with. These will also be useful for populating the assistant actions typeahead we plan to build in the near future. ## Prompt Library The prompt library is a registry of prompts. Initially by default when opening the assistant, the prompt manager will load any custom prompts present in your `~/.config/zed/prompts` directory. Checked prompts are included in your "default prompt", which can be inserted into the assitant by running `assistant: insert default prompt` or clicking the `Insert Default Prompt` button in the assistant panel's more menu. When the app starts, no prompts are set to default. You can add prompts to the default by checking them in the Prompt Library. I plan to improve this UX in the future, allowing your default prompts to be remembered, and allowing creating, editing and exporting prompts from the Library. ### Creating a custom prompt Prompts have a simple format: ```json { // ~/.config/zed/prompts/no-comments.json "title": "No comments in code", "version": "1.0", "author": "Nate Butler <iamnbutler@gmail.com>", "languages": ["*"], "prompt": "Do not add inline or doc comments to any returned code. Avoid removing existing comments unless they are no longer accurate due to changes in the code." } ``` Ensure you properly escape your prompt string when creating a new prompt file. Example: ```json { // ... "prompt": "This project using the gpui crate as it's UI framework for building UI in Rust. When working in Rust files with gpui components, import it's dependencies using `use gpui::{*, prelude::*}`.\n\nWhen a struct has a `#[derive(IntoElement)]` attribute, it is a UI component that must implement `RenderOnce`. Example:\n\n```rust\n#[derive(IntoElement)]\nstruct MyComponent {\n id: ElementId,\n}\n\nimpl MyComponent {\n pub fn new(id: impl Into<ElementId>) -> Self {\n Self { id.into() }\n }\n}\n\nimpl RenderOnce for MyComponent {\n fn render(self, cx: &mut WindowContext) -> impl IntoElement {\n div().id(self.id.clone()).child(text(\"Hello, world!\"))\n }\n}\n```" } ``` Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com> |
||
---|---|---|
.cargo | ||
.cloudflare | ||
.config | ||
.github | ||
.zed | ||
assets | ||
crates | ||
docs | ||
extensions | ||
script | ||
tooling/xtask | ||
.dockerignore | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
Cargo.lock | ||
Cargo.toml | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
debug.plist | ||
docker-compose.sql | ||
docker-compose.yml | ||
Dockerfile | ||
LICENSE-AGPL | ||
LICENSE-APACHE | ||
LICENSE-GPL | ||
livekit.yaml | ||
Procfile | ||
README.md | ||
rust-toolchain.toml | ||
typos.toml |
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
You can download Zed today for macOS (v10.15+).
Support for additional platforms is on our roadmap:
- Linux (tracking issue)
- Windows (tracking issue)
- Web (tracking issue)
For macOS users, you can also install Zed using Homebrew:
brew install --cask zed
Alternatively, to install the Preview release:
brew install --cask zed@preview
Developing Zed
- Building Zed for macOS
- Building Zed for Linux
- Building Zed for Windows
- Running Collaboration Locally
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about
to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specified
error for a crate you've created? If so, addpublish = false
under[package]
in your crate's Cargo.toml. - Is the error
failed to satisfy license requirements
for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theaccepted
array inscript/licenses/zed-licenses.toml
. - Is
cargo-about
unable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml
, as specified in the cargo-about book.