diff --git a/.cargo/config.toml b/.cargo/config.toml index ae3d1573465a7a1f266e65b1d1417279cc6fafb9..717c5e18c8d294bacf65207bc6b8ecb7dba1b152 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -13,12 +13,6 @@ rustflags = ["-C", "link-arg=-fuse-ld=mold"] linker = "clang" rustflags = ["-C", "link-arg=-fuse-ld=mold"] -[target.aarch64-apple-darwin] -rustflags = ["-C", "link-args=-all_load"] - -[target.x86_64-apple-darwin] -rustflags = ["-C", "link-args=-all_load"] - [target.'cfg(target_os = "windows")'] rustflags = [ "--cfg", diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 2899da597d8accbe35c67fe70d278f172b216291..fbcc76a8654f7ed2241fb05c305eb466e3177c20 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -30,3 +30,7 @@ ffdda588b41f7d9d270ffe76cab116f828ad545e # 2024-07-05 Improved formatting of default keymaps (single line per bind) # https://github.com/zed-industries/zed/pull/13887 813cc3f5e537372fc86720b5e71b6e1c815440ab + +# 2024-07-24 docs: Format docs +# https://github.com/zed-industries/zed/pull/15352 +3a44a59f8ec114ac1ba22f7da1652717ef7e4e5c diff --git a/.github/ISSUE_TEMPLATE/01_bug_agent.yml b/.github/ISSUE_TEMPLATE/01_bug_ai.yml similarity index 58% rename from .github/ISSUE_TEMPLATE/01_bug_agent.yml rename to .github/ISSUE_TEMPLATE/01_bug_ai.yml index 144dda8c2c82a661bb29c55e025c8d5b4b897e2e..16bdef6c7effb6641db605b8d55c4151c0ab02b2 100644 --- a/.github/ISSUE_TEMPLATE/01_bug_agent.yml +++ b/.github/ISSUE_TEMPLATE/01_bug_ai.yml @@ -1,8 +1,8 @@ -name: Bug Report (Agent Panel) +name: Bug Report (AI) description: Zed Agent Panel Bugs type: "Bug" -labels: ["agent", "ai"] -title: "Agent Panel: " +labels: ["ai"] +title: "AI: " body: - type: textarea attributes: @@ -14,14 +14,19 @@ body: ### Description - Steps to trigger the problem: 1. 2. 3. - Actual Behavior: - Expected Behavior: + **Expected Behavior**: + **Actual Behavior**: + + ### Model Provider Details + - Provider: (Anthropic via ZedPro, Anthropic via API key, Copilot Chat, Mistral, OpenAI, etc) + - Model Name: + - Mode: (Agent Panel, Inline Assistant, Terminal Assistant or Text Threads) + - Other Details (MCPs, other settings, etc): validations: required: true @@ -29,8 +34,8 @@ body: id: environment attributes: label: Zed Version and System Specs - description: 'Open Zed, and in the command palette select "zed: Copy System Specs Into Clipboard"' + description: 'Open Zed, and in the command palette select "zed: copy system specs into clipboard"' placeholder: | - Output of "zed: Copy System Specs Into Clipboard" + Output of "zed: copy system specs into clipboard" validations: required: true diff --git a/.github/ISSUE_TEMPLATE/02_bug_edit_predictions.yml b/.github/ISSUE_TEMPLATE/02_bug_edit_predictions.yml deleted file mode 100644 index 14854198075b9ca6c2724a6491354c760d50f85a..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/02_bug_edit_predictions.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Bug Report (Edit Predictions) -description: Zed Edit Predictions bugs -type: "Bug" -labels: ["ai", "inline completion", "zeta"] -title: "Edit Predictions: " -body: - - type: textarea - attributes: - label: Summary - description: Describe the bug with a one line summary, and provide detailed reproduction steps - value: | - - SUMMARY_SENTENCE_HERE - - ### Description - - - Steps to trigger the problem: - 1. - 2. - 3. - - Actual Behavior: - Expected Behavior: - validations: - required: true - - - type: textarea - id: environment - attributes: - label: Zed Version and System Specs - description: 'Open Zed, and in the command palette select "zed: Copy System Specs Into Clipboard"' - placeholder: | - Output of "zed: Copy System Specs Into Clipboard" - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/03_bug_git.yml b/.github/ISSUE_TEMPLATE/04_bug_debugger.yml similarity index 70% rename from .github/ISSUE_TEMPLATE/03_bug_git.yml rename to .github/ISSUE_TEMPLATE/04_bug_debugger.yml index bed432e7375663f3867b3e05fbd38e3fb911fea3..2682295a431b1e5d8bd39c9f3a2955dad6f45364 100644 --- a/.github/ISSUE_TEMPLATE/03_bug_git.yml +++ b/.github/ISSUE_TEMPLATE/04_bug_debugger.yml @@ -1,8 +1,8 @@ -name: Bug Report (Git) -description: Zed Git-Related Bugs +name: Bug Report (Debugger) +description: Zed Debugger-Related Bugs type: "Bug" -labels: ["git"] -title: "Git: " +labels: ["debugger"] +title: "Debugger: " body: - type: textarea attributes: @@ -19,8 +19,8 @@ body: 2. 3. - Actual Behavior: - Expected Behavior: + **Expected Behavior**: + **Actual Behavior**: validations: required: true @@ -28,8 +28,8 @@ body: id: environment attributes: label: Zed Version and System Specs - description: 'Open Zed, and in the command palette select "zed: Copy System Specs Into Clipboard"' + description: 'Open Zed, and in the command palette select "zed: copy system specs into clipboard"' placeholder: | - Output of "zed: Copy System Specs Into Clipboard" + Output of "zed: copy system specs into clipboard" validations: required: true diff --git a/.github/ISSUE_TEMPLATE/10_bug_report.yml b/.github/ISSUE_TEMPLATE/10_bug_report.yml index 2fa687c11abaf22f965e4468be0e9724e98c29f6..e132eca1e52bc617f35fc2ec6e4e34fe3c796b11 100644 --- a/.github/ISSUE_TEMPLATE/10_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/10_bug_report.yml @@ -18,14 +18,16 @@ body: - Issues with insufficient detail may be summarily closed. --> + DESCRIPTION_HERE + Steps to reproduce: 1. 2. 3. 4. - Expected Behavior: - Actual Behavior: + **Expected Behavior**: + **Actual Behavior**: @@ -32,6 +33,8 @@ - [Channels](./channels.md) - [Collaboration](./collaboration.md) - [Git](./git.md) +- [Debugger](./debugger.md) +- [Diagnostics](./diagnostics.md) - [Tasks](./tasks.md) - [Remote Development](./remote-development.md) - [Environment Variables](./environment.md) @@ -48,11 +51,11 @@ - [Text Threads](./ai/text-threads.md) - [Rules](./ai/rules.md) - [Model Context Protocol](./ai/mcp.md) +- [Configuration](./ai/configuration.md) - [Subscription](./ai/subscription.md) - [Plans and Usage](./ai/plans-and-usage.md) - [Billing](./ai/billing.md) - [Models](./ai/models.md) -- [Use Your Own API Keys](./ai/custom-api-keys.md) - [Privacy and Security](./ai/privacy-and-security.md) - [AI Improvement](./ai/ai-improvement.md) @@ -62,10 +65,11 @@ - [Installing Extensions](./extensions/installing-extensions.md) - [Developing Extensions](./extensions/developing-extensions.md) - [Language Extensions](./extensions/languages.md) +- [Debugger Extensions](./extensions/debugger-extensions.md) - [Theme Extensions](./extensions/themes.md) - [Icon Theme Extensions](./extensions/icon-themes.md) - [Slash Command Extensions](./extensions/slash-commands.md) -- [Context Server Extensions](./extensions/context-servers.md) +- [MCP Server Extensions](./extensions/mcp-extensions.md) # Language Support @@ -110,6 +114,7 @@ - [Nim](./languages/nim.md) - [OCaml](./languages/ocaml.md) - [PHP](./languages/php.md) +- [PowerShell](./languages/powershell.md) - [Prisma](./languages/prisma.md) - [Proto](./languages/proto.md) - [PureScript](./languages/purescript.md) @@ -124,6 +129,7 @@ - [Scala](./languages/scala.md) - [Scheme](./languages/scheme.md) - [Shell Script](./languages/sh.md) +- [SQL](./languages/sql.md) - [Svelte](./languages/svelte.md) - [Swift](./languages/swift.md) - [Tailwind CSS](./languages/tailwindcss.md) @@ -144,6 +150,7 @@ - [macOS](./development/macos.md) - [Linux](./development/linux.md) - [Windows](./development/windows.md) + - [FreeBSD](./development/freebsd.md) - [Local Collaboration](./development/local-collaboration.md) - [Using Debuggers](./development/debuggers.md) - [Release Process](./development/releases.md) diff --git a/docs/src/accounts.md b/docs/src/accounts.md index 56f27e82786441a073a84870cd71d21e7df6b211..c13c98ad9aadd77ccf60c1f1cc3c33e6fac7690d 100644 --- a/docs/src/accounts.md +++ b/docs/src/accounts.md @@ -5,7 +5,7 @@ Signing in to Zed is not a requirement. You can use most features you'd expect i ## What Features Require Signing In? 1. All real-time [collaboration features](./collaboration.md). -2. [LLM-powered features](./ai/overview.md), if you are using Zed as the provider of your LLM models. Alternatively, you can [bring and configure your own API keys](./ai/custom-api-keys.md) if you'd prefer, and avoid having to sign in. +2. [LLM-powered features](./ai/overview.md), if you are using Zed as the provider of your LLM models. Alternatively, you can [bring and configure your own API keys](./ai/configuration.md#use-your-own-keys) if you'd prefer, and avoid having to sign in. ## Signing In @@ -24,3 +24,9 @@ To sign out of Zed, you can use either of these methods: - Click on the profile icon in the upper right corner and select `Sign Out` from the dropdown menu. - Open the command palette and run the `client: sign out` command. + +## Email Addresses {#email} + +Your Zed account's email address is the address provided by GitHub OAuth. If you have a public email address then it will be used, otherwise your primary GitHub email address will be used. Changes to your email address on GitHub can be synced to your Zed account by [signing in to zed.dev](https://zed.dev/sign_in). + +Stripe is used for billing, and will use your Zed account's email address when starting a subscription. Changes to your Zed account email address do not currently update the email address used in Stripe. See [Updating Billing Information](./ai/billing.md#updating-billing-info) for how to change this email address. diff --git a/docs/src/ai/agent-panel.md b/docs/src/ai/agent-panel.md index f99d1b8035ec4e886a62875cf901382e71b73285..3c04ae5c43f87ee54e96a253300aa20524d6d844 100644 --- a/docs/src/ai/agent-panel.md +++ b/docs/src/ai/agent-panel.md @@ -5,17 +5,14 @@ You can use it for various tasks, such as generating code, asking questions abou To open the Agent Panel, use the `agent: new thread` action in [the Command Palette](../getting-started.md#command-palette) or click the ✨ (sparkles) icon in the status bar. -If you're using the Agent Panel for the first time, you'll need to [configure at least one LLM provider](./custom-api-keys.md#providers). +If you're using the Agent Panel for the first time, you'll need to [configure at least one LLM provider](./configuration.md). ## Overview {#overview} -After you've configured some LLM providers, you're ready to start working with the Agent Panel. - -Type at the message editor and hit `enter` to submit your prompt to the LLM. +After you've configured one or more LLM providers, type at the message editor and hit `enter` to submit your prompt. If you need extra room to type, you can expand the message editor with {#kb agent::ExpandMessageEditor}. -You should start to see the responses stream in with indications of which [tools](./tools.md) the AI is using to fulfill your prompt. -For example, if the AI chooses to perform an edit, you will see a card with the diff. +You should start to see the responses stream in with indications of [which tools](./tools.md) the AI is using to fulfill your prompt. ### Editing Messages {#editing-messages} @@ -24,91 +21,93 @@ You can click on the card that contains your message and re-submit it with an ad ### Checkpoints {#checkpoints} -Every time the AI performs an edit, you should see a "Restore Checkpoint" button to the top of your message. -This allows you to return your code base to the state it was in prior to that message. -This is usually valuable if the AI's edit doesn't go in the right direction. +Every time the AI performs an edit, you should see a "Restore Checkpoint" button to the top of your message, allowing you to return your codebase to the state it was in prior to that message. + +The checkpoint button appears even if you interrupt the thread midway through an edit attempt, as this is likely a moment when you've identified that the agent is not heading in the right direction and you want to revert back. ### Navigating History {#navigating-history} -To quickly navigate through recently opened threads, use the {#kb agent::ToggleNavigationMenu} binding, when focused on the panel's editor, or click the hamburger icon button at the top left of the panel to open the dropdown that shows you the six most recent interactions with the LLM. +To quickly navigate through recently opened threads, use the {#kb agent::ToggleNavigationMenu} binding, when focused on the panel's editor, or click the hamburger icon button at the top left of the panel to open the dropdown that shows you the six most recent threads. -The items in this menu work similarly to tabs, and closing them from there doesn't delete the thread; just takes them out of the recent list. +The items in this menu function similarly to tabs, and closing them doesn’t delete the thread; instead, it simply removes them from the recent list. -You can also view all historical conversations with the `View All` option from within the same menu or by reaching for the {#kb agent::OpenHistory} binding. +To view all historical conversations, reach for the `View All` option from within the same menu or via the {#kb agent::OpenHistory} binding. ### Following the Agent {#following-the-agent} -Zed is built with collaboration natively integrated into the product. +Zed is built with collaboration natively integrated. This approach extends to collaboration with AI as well. - -As soon as you send a prompt to the Agent, click on the "crosshair" icon at the bottom left of the panel to follow along as it reads through your codebase and performs edits. +To follow the agent reading through your codebase and performing edits, click on the "crosshair" icon button at the bottom left of the panel. ### Get Notified {#get-notified} -If you send a prompt to the Agent and then move elsewhere, putting Zed in the background, a notification will pop up at the top right of your monitor indicating that the Agent has completed its work. +If you send a prompt to the Agent and then move elsewhere, thus putting Zed in the background, you can be notified of whether its response is finished either via: + +- a visual notification that appears in the top right of your screen +- or a sound notification -You can customize the notification behavior or turn it off entirely by using the `agent.notify_when_agent_waiting` key. +Both notification methods can be used together or individually according to your preference. + +You can customize their behavior, including turning them off entirely, by using the `agent.notify_when_agent_waiting` and `agent.play_sound_when_agent_done` settings keys. ### Reviewing Changes {#reviewing-changes} -If you are using a profile that includes write tools, and the agent has made changes to your project, you'll notice the Agent Panel surfaces the fact that edits have been applied. +Once the agent has made changes to your project, the panel will surface which files, and how many of them, have been edited. + +To see which files specifically have been edited, expand the accordion bar that shows up right above the message editor or click the `Review Changes` button ({#kb agent::OpenAgentDiff}), which opens a multi-buffer tab with all changes. -You can click on the accordion bar that shows up right above the panel's editor see which files have been changed, or click `Review Changes` ({#kb agent::OpenAgentDiff}) to open a multi-buffer to review them. -Reviewing includes the option to accept or reject each edit, or accept or reject all edits. +You're able to reject or accept each individual change hunk, or the whole set of changes made by the agent. -Diffs with changes also appear in individual buffers. -So, if your active tab had changes added by the AI, you'll see diffs with the same accept/reject controls as in the multi-buffer. +Edit diffs also appear in individual buffers. +So, if your active tab had edits made by the AI, you'll see diffs with the same accept/reject controls as in the multi-buffer. ## Adding Context {#adding-context} -Although Zed's agent is very efficient at reading through your code base to autonomously pick up relevant files, directories, and other context, manually adding context is still usually encouraged as a way to speed up and improve the AI's response quality. +Although Zed's agent is very efficient at reading through your codebase to autonomously pick up relevant files, directories, and other context, manually adding context is still encouraged as a way to speed up and improve the AI's response quality. -If you have a tab open when triggering the Agent Panel, that tab will appear as a suggested context in form of a dashed button. -You can also add other forms of context, like files, rules, and directories, by either typing `@` or hitting the `+` icon button. +If you have a tab open when opening the Agent Panel, that tab appears as a suggested context in form of a dashed button. +You can also add other forms of context by either mentioning them with `@` or hitting the `+` icon button. -You can even add previous threads as context with the `@thread` command, or by selecting "Start new from summary" option from the top-right menu in the agent panel to continue a longer conversation and keep it within the size of context window. +You can even add previous threads as context by mentioning them with `@thread`, or by selecting the "New From Summary" option from the top-right menu to continue a longer conversation, keeping it within the context window. -Images are also supported, and pasting them over in the panel's editor works. +Pasting images as context is also supported by the Agent Panel. ### Token Usage {#token-usage} Zed surfaces how many tokens you are consuming for your currently active thread in the panel's toolbar. Depending on how many pieces of context you add, your token consumption can grow rapidly. -With that in mind, once you get close to the model's context window, we'll display a banner on the bottom of the message editor offering to start a new thread with the current one summarized and added as context. +With that in mind, once you get close to the model's context window, a banner appears below the message editor suggesting to start a new thread with the current one summarized and added as context. You can also do this at any time with an ongoing thread via the "Agent Options" menu on the top right. ## Changing Models {#changing-models} -After you've configured your LLM providers—either via [a custom API key](./custom-api-keys.md) or through [Zed's hosted models](./models.md)—you can switch between them by clicking on the model selector on the message editor or by using the {#kb agent::ToggleModelSelector} keybinding. +After you've configured your LLM providers—either via [a custom API key](./configuration.md#use-your-own-keys) or through [Zed's hosted models](./models.md)—you can switch between them by clicking on the model selector on the message editor or by using the {#kb agent::ToggleModelSelector} keybinding. ## Using Tools {#using-tools} -The new Agent Panel supports tool calling, which enables agentic collaboration with AI. +The new Agent Panel supports tool calling, which enables agentic editing. Zed comes with [several built-in tools](./tools.md) that allow models to perform tasks such as searching through your codebase, editing files, running commands, and others. You can also extend the set of available tools via [MCP Servers](./mcp.md). ### Profiles {#profiles} -Profiles introduce a way to group tools. +Profiles act as a way to group tools. Zed offers three built-in profiles and you can create as many custom ones as you want. #### Built-in Profiles {#built-in-profiles} - `Write`: A profile with tools to allow the LLM to write to your files and run terminal commands. This one essentially has all built-in tools turned on. -- `Ask`: A profile with read-only tools. Best for asking questions about your code base without the fear of the agent making changes. -- `Minimal`: A profile with no tools. Best for general conversations with the LLM where no knowledge of your code is necessary. +- `Ask`: A profile with read-only tools. Best for asking questions about your code base without the concern of the agent making changes. +- `Minimal`: A profile with no tools. Best for general conversations with the LLM where no knowledge of your code base is necessary. You can explore the exact tools enabled in each profile by clicking on the profile selector button > `Configure Profiles…` > the one you want to check out. #### Custom Profiles {#custom-profiles} -You may find yourself in a situation where the built-in profiles don't quite fit your specific needs. -Zed's Agent Panel allows for building custom profiles. - -You can create new profile via the `Configure Profiles…` option in the profile selector. -From here, you can choose to `Add New Profile` or fork an existing one with your choice of tools and a custom profile name. +You can create a custom profile via the `Configure Profiles…` option in the profile selector. +From here, you can choose to `Add New Profile` or fork an existing one with a custom name and your preferred set of tools. You can also override built-in profiles. With a built-in profile selected, in the profile selector, navigate to `Configure Tools`, and select the tools you'd like. @@ -121,10 +120,10 @@ All custom profiles can be edited via the UI or by hand under the `assistant.pro Tool calling needs to be individually supported by each model and model provider. Therefore, despite the presence of tools, some models may not have the ability to pick them up yet in Zed. -You should see a "No tools" disabled button if you select a model that falls into this case. +You should see a "No tools" label if you select a model that falls into this case. We want to support all of them, though! -We may prioritize which ones to focus on based on popularity and user feedback, so feel free to help and contribute. +We may prioritize which ones to focus on based on popularity and user feedback, so feel free to help and contribute to fast-track those that don't fit this bill. All [Zed's hosted models](./models.md) support tool calling out-of-the-box. diff --git a/docs/src/ai/ai-improvement.md b/docs/src/ai/ai-improvement.md index cc2be3f44412135818653151d7445799ba27b262..5296b2a179ebe8ba8b7a966a54138cbde4650b4f 100644 --- a/docs/src/ai/ai-improvement.md +++ b/docs/src/ai/ai-improvement.md @@ -4,7 +4,7 @@ ### Opt-In -When using the Zed Agent Panel, whether through Zed's hosted AI service or via connecting a non-Zed AI service via API key, Zed does not persistently store user content or use user content to evaluate and/or improve our AI features, unless it is explicitly shared with Zed. Each share is opt-in, and sharing once will not cause future content or data to be shared again. +When using the Agent Panel, whether through Zed's hosted AI service or via connecting a non-Zed AI service via API key, Zed does not persistently store user content or use user content to evaluate and/or improve our AI features, unless it is explicitly shared with Zed. Each share is opt-in, and sharing once will not cause future content or data to be shared again. > Note that rating responses will send your data related to that response to Zed's servers. > **_If you don't want data persisted on Zed's servers, don't rate_**. We will not collect data for improving our Agentic offering without you explicitly rating responses. @@ -13,7 +13,10 @@ When using upstream services through Zed AI, we require assurances from our serv > "Anthropic may not train models on Customer Content from paid Services." -When you directly connect the Zed Assistant with a non Zed AI service (e.g. via API key) Zed does not have control over how your data is used by that service provider. You should reference your agreement with each service provider to understand what terms and conditions apply. +We also have a [zero-data retention agreement](https://privacy.anthropic.com/en/articles/8956058-i-have-a-zero-data-retention-agreement-with-anthropic-what-products-does-it-apply-to) with Anthropic. + +When you directly connect Zed with a non Zed AI service (e.g., via API key) Zed does not have control over how your data is used by that service provider. +You should reference your agreement with each service provider to understand what terms and conditions apply. ### Data we collect @@ -90,7 +93,7 @@ This data includes: ### Data Handling -Collected data is stored in Snowflake, a private database where we track other metrics. We periodically review this data to select training samples for inclusion in our model training dataset. We ensure any included data is anonymized and contains no sensitive information (access tokens, user IDs, email addresses, etc). This training dataset is publicly available at: [huggingface.co/datasets/zed-industries/zeta](https://huggingface.co/datasets/zed-industries/zeta). +Collected data is stored in Snowflake, a private database where we track other metrics. We periodically review this data to select training samples for inclusion in our model training dataset. We ensure any included data is anonymized and contains no sensitive information (access tokens, user IDs, email addresses, etc). This training dataset is publicly available at [huggingface.co/datasets/zed-industries/zeta](https://huggingface.co/datasets/zed-industries/zeta). ### Model Output diff --git a/docs/src/ai/ai.md b/docs/src/ai/ai.md deleted file mode 100644 index 07dd0c5c770357eace1b04f76e762baabca37471..0000000000000000000000000000000000000000 --- a/docs/src/ai/ai.md +++ /dev/null @@ -1 +0,0 @@ -# Overview diff --git a/docs/src/ai/configuration.md b/docs/src/ai/configuration.md new file mode 100644 index 0000000000000000000000000000000000000000..5c49cde598a71a3592bf96c2660dc4b31dfa8c30 --- /dev/null +++ b/docs/src/ai/configuration.md @@ -0,0 +1,648 @@ +# Configuration + +There are various aspects about the Agent Panel that you can customize. +All of them can be seen by either visiting [the Configuring Zed page](../configuring-zed.md#agent) or by running the `zed: open default settings` action and searching for `"agent"`. + +Alternatively, you can also visit the panel's Settings view by running the `agent: open configuration` action or going to the top-right menu and hitting "Settings". + +## LLM Providers + +Zed supports multiple large language model providers. +Here's an overview of the supported providers and tool call support: + +| Provider | Tool Use Supported | +| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Amazon Bedrock](#amazon-bedrock) | Depends on the model | +| [Anthropic](#anthropic) | ✅ | +| [DeepSeek](#deepseek) | ✅ | +| [GitHub Copilot Chat](#github-copilot-chat) | For some models ([link](https://github.com/zed-industries/zed/blob/9e0330ba7d848755c9734bf456c716bddf0973f3/crates/language_models/src/provider/copilot_chat.rs#L189-L198)) | +| [Google AI](#google-ai) | ✅ | +| [LM Studio](#lmstudio) | ✅ | +| [Mistral](#mistral) | ✅ | +| [Ollama](#ollama) | ✅ | +| [OpenAI](#openai) | ✅ | +| [OpenAI API Compatible](#openai-api-compatible) | 🚫 | +| [OpenRouter](#openrouter) | ✅ | + +## Use Your Own Keys {#use-your-own-keys} + +While Zed offers hosted versions of models through [our various plans](./plans-and-usage.md), we're always happy to support users wanting to supply their own API keys. +Below, you can learn how to do that for each provider. + +> Using your own API keys is _free_—you do not need to subscribe to a Zed plan to use our AI features with your own keys. + +### Amazon Bedrock {#amazon-bedrock} + +> ✅ Supports tool use with models that support streaming tool use. +> More details can be found in the [Amazon Bedrock's Tool Use documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html). + +To use Amazon Bedrock's models, an AWS authentication is required. +Ensure your credentials have the following permissions set up: + +- `bedrock:InvokeModelWithResponseStream` +- `bedrock:InvokeModel` +- `bedrock:ConverseStream` + +Your IAM policy should look similar to: + +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "bedrock:InvokeModel", + "bedrock:InvokeModelWithResponseStream", + "bedrock:ConverseStream" + ], + "Resource": "*" + } + ] +} +``` + +With that done, choose one of the two authentication methods: + +#### Authentication via Named Profile (Recommended) + +1. Ensure you have the AWS CLI installed and configured with a named profile +2. Open your `settings.json` (`zed: open settings`) and include the `bedrock` key under `language_models` with the following settings: + ```json + { + "language_models": { + "bedrock": { + "authentication_method": "named_profile", + "region": "your-aws-region", + "profile": "your-profile-name" + } + } + } + ``` + +#### Authentication via Static Credentials + +While it's possible to configure through the Agent Panel settings UI by entering your AWS access key and secret directly, we recommend using named profiles instead for better security practices. +To do this: + +1. Create an IAM User that you can assume in the [IAM Console](https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-1#/users). +2. Create security credentials for that User, save them and keep them secure. +3. Open the Agent Configuration with (`agent: open configuration`) and go to the Amazon Bedrock section +4. Copy the credentials from Step 2 into the respective **Access Key ID**, **Secret Access Key**, and **Region** fields. + +#### Cross-Region Inference + +The Zed implementation of Amazon Bedrock uses [Cross-Region inference](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html) for all the models and region combinations that support it. +With Cross-Region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput. + +For example, if you use `Claude Sonnet 3.7 Thinking` from `us-east-1`, it may be processed across the US regions, namely: `us-east-1`, `us-east-2`, or `us-west-2`. +Cross-Region inference requests are kept within the AWS Regions that are part of the geography where the data originally resides. +For example, a request made within the US is kept within the AWS Regions in the US. + +Although the data remains stored only in the source Region, your input prompts and output results might move outside of your source Region during cross-Region inference. +All data will be transmitted encrypted across Amazon's secure network. + +We will support Cross-Region inference for each of the models on a best-effort basis, please refer to the [Cross-Region Inference method Code](https://github.com/zed-industries/zed/blob/main/crates/bedrock/src/models.rs#L297). + +For the most up-to-date supported regions and models, refer to the [Supported Models and Regions for Cross Region inference](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html). + +### Anthropic {#anthropic} + +> ✅ Supports tool use + +You can use Anthropic models by choosing it via the model dropdown in the Agent Panel. + +1. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys) +2. Make sure that your Anthropic account has credits +3. Open the settings view (`agent: open configuration`) and go to the Anthropic section +4. Enter your Anthropic API key + +Even if you pay for Claude Pro, you will still have to [pay for additional credits](https://console.anthropic.com/settings/plans) to use it via the API. + +Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined. + +#### Custom Models {#anthropic-custom-models} + +You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`: + +```json +{ + "language_models": { + "anthropic": { + "available_models": [ + { + "name": "claude-3-5-sonnet-20240620", + "display_name": "Sonnet 2024-June", + "max_tokens": 128000, + "max_output_tokens": 2560, + "cache_configuration": { + "max_cache_anchors": 10, + "min_total_token": 10000, + "should_speculate": false + }, + "tool_override": "some-model-that-supports-toolcalling" + } + ] + } + } +} +``` + +Custom models will be listed in the model dropdown in the Agent Panel. + +You can configure a model to use [extended thinking](https://docs.anthropic.com/en/docs/about-claude/models/extended-thinking-models) (if it supports it) by changing the mode in your model's configuration to `thinking`, for example: + +```json +{ + "name": "claude-sonnet-4-latest", + "display_name": "claude-sonnet-4-thinking", + "max_tokens": 200000, + "mode": { + "type": "thinking", + "budget_tokens": 4_096 + } +} +``` + +### DeepSeek {#deepseek} + +> ✅ Supports tool use + +1. Visit the DeepSeek platform and [create an API key](https://platform.deepseek.com/api_keys) +2. Open the settings view (`agent: open configuration`) and go to the DeepSeek section +3. Enter your DeepSeek API key + +The DeepSeek API key will be saved in your keychain. + +Zed will also use the `DEEPSEEK_API_KEY` environment variable if it's defined. + +#### Custom Models {#deepseek-custom-models} + +The Zed agent comes pre-configured to use the latest version for common models (DeepSeek Chat, DeepSeek Reasoner). +If you wish to use alternate models or customize the API endpoint, you can do so by adding the following to your Zed `settings.json`: + +```json +{ + "language_models": { + "deepseek": { + "api_url": "https://api.deepseek.com", + "available_models": [ + { + "name": "deepseek-chat", + "display_name": "DeepSeek Chat", + "max_tokens": 64000 + }, + { + "name": "deepseek-reasoner", + "display_name": "DeepSeek Reasoner", + "max_tokens": 64000, + "max_output_tokens": 4096 + } + ] + } + } +} +``` + +Custom models will be listed in the model dropdown in the Agent Panel. +You can also modify the `api_url` to use a custom endpoint if needed. + +### GitHub Copilot Chat {#github-copilot-chat} + +> ✅ Supports tool use in some cases. +> Visit [the Copilot Chat code](https://github.com/zed-industries/zed/blob/9e0330ba7d848755c9734bf456c716bddf0973f3/crates/language_models/src/provider/copilot_chat.rs#L189-L198) for the supported subset. + +You can use GitHub Copilot Chat with the Zed agent by choosing it via the model dropdown in the Agent Panel. + +1. Open the settings view (`agent: open configuration`) and go to the GitHub Copilot Chat section +2. Click on `Sign in to use GitHub Copilot`, follow the steps shown in the modal. + +Alternatively, you can provide an OAuth token via the `GH_COPILOT_TOKEN` environment variable. + +> **Note**: If you don't see specific models in the dropdown, you may need to enable them in your [GitHub Copilot settings](https://github.com/settings/copilot/features). + +### Google AI {#google-ai} + +> ✅ Supports tool use + +You can use Gemini models with the Zed agent by choosing it via the model dropdown in the Agent Panel. + +1. Go to the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey). +2. Open the settings view (`agent: open configuration`) and go to the Google AI section +3. Enter your Google AI API key and press enter. + +The Google AI API key will be saved in your keychain. + +Zed will also use the `GOOGLE_AI_API_KEY` environment variable if it's defined. + +#### Custom Models {#google-ai-custom-models} + +By default, Zed will use `stable` versions of models, but you can use specific versions of models, including [experimental models](https://ai.google.dev/gemini-api/docs/models/experimental-models). You can configure a model to use [thinking mode](https://ai.google.dev/gemini-api/docs/thinking) (if it supports it) by adding a `mode` configuration to your model. This is useful for controlling reasoning token usage and response speed. If not specified, Gemini will automatically choose the thinking budget. + +Here is an example of a custom Google AI model you could add to your Zed `settings.json`: + +```json +{ + "language_models": { + "google": { + "available_models": [ + { + "name": "gemini-2.5-flash-preview-05-20", + "display_name": "Gemini 2.5 Flash (Thinking)", + "max_tokens": 1000000, + "mode": { + "type": "thinking", + "budget_tokens": 24000 + } + } + ] + } + } +} +``` + +Custom models will be listed in the model dropdown in the Agent Panel. + +### LM Studio {#lmstudio} + +> ✅ Supports tool use + +1. Download and install [the latest version of LM Studio](https://lmstudio.ai/download) +2. In the app press `cmd/ctrl-shift-m` and download at least one model (e.g., qwen2.5-coder-7b). Alternatively, you can get models via the LM Studio CLI: + + ```sh + lms get qwen2.5-coder-7b + ``` + +3. Make sure the LM Studio API server is running by executing: + + ```sh + lms server start + ``` + +Tip: Set [LM Studio as a login item](https://lmstudio.ai/docs/advanced/headless#run-the-llm-service-on-machine-login) to automate running the LM Studio server. + +### Mistral {#mistral} + +> ✅ Supports tool use + +1. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/) +2. Open the configuration view (`agent: open configuration`) and navigate to the Mistral section +3. Enter your Mistral API key + +The Mistral API key will be saved in your keychain. + +Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined. + +#### Custom Models {#mistral-custom-models} + +The Zed agent comes pre-configured with several Mistral models (codestral-latest, mistral-large-latest, mistral-medium-latest, mistral-small-latest, open-mistral-nemo, and open-codestral-mamba). +All the default models support tool use. +If you wish to use alternate models or customize their parameters, you can do so by adding the following to your Zed `settings.json`: + +```json +{ + "language_models": { + "mistral": { + "api_url": "https://api.mistral.ai/v1", + "available_models": [ + { + "name": "mistral-tiny-latest", + "display_name": "Mistral Tiny", + "max_tokens": 32000, + "max_output_tokens": 4096, + "max_completion_tokens": 1024, + "supports_tools": true, + "supports_images": false + } + ] + } + } +} +``` + +Custom models will be listed in the model dropdown in the Agent Panel. + +### Ollama {#ollama} + +> ✅ Supports tool use + +Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`. + +1. Download one of the [available models](https://ollama.com/models), for example, for `mistral`: + + ```sh + ollama pull mistral + ``` + +2. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching: + + ```sh + ollama serve + ``` + +3. In the Agent Panel, select one of the Ollama models using the model dropdown. + +#### Ollama Context Length {#ollama-context} + +Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models. +Zed API requests to Ollama include this as the `num_ctx` parameter, but the default values do not exceed `16384` so users with ~16GB of RAM are able to use most models out of the box. + +See [get_max_tokens in ollama.rs](https://github.com/zed-industries/zed/blob/main/crates/ollama/src/ollama.rs) for a complete set of defaults. + +> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer. + +Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json: + +```json +{ + "language_models": { + "ollama": { + "api_url": "http://localhost:11434", + "available_models": [ + { + "name": "qwen2.5-coder", + "display_name": "qwen 2.5 coder 32K", + "max_tokens": 32768, + "supports_tools": true, + "supports_thinking": true, + "supports_images": true + } + ] + } + } +} +``` + +If you specify a context length that is too large for your hardware, Ollama will log an error. +You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux). +Depending on the memory available on your machine, you may need to adjust the context length to a smaller value. + +You may also optionally specify a value for `keep_alive` for each available model. +This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc. +For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds. + +The `supports_tools` option controls whether the model will use additional tools. +If the model is tagged with `tools` in the Ollama catalog, this option should be supplied, and the built-in profiles `Ask` and `Write` can be used. +If the model is not tagged with `tools` in the Ollama catalog, this option can still be supplied with the value `true`; however, be aware that only the `Minimal` built-in profile will work. + +The `supports_thinking` option controls whether the model will perform an explicit "thinking" (reasoning) pass before producing its final answer. +If the model is tagged with `thinking` in the Ollama catalog, set this option and you can use it in Zed. + +The `supports_images` option enables the model's vision capabilities, allowing it to process images included in the conversation context. +If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in Zed. + +### OpenAI {#openai} + +> ✅ Supports tool use + +1. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys) +2. Make sure that your OpenAI account has credits +3. Open the settings view (`agent: open configuration`) and go to the OpenAI section +4. Enter your OpenAI API key + +The OpenAI API key will be saved in your keychain. + +Zed will also use the `OPENAI_API_KEY` environment variable if it's defined. + +#### Custom Models {#openai-custom-models} + +The Zed agent comes pre-configured to use the latest version for common models (GPT-3.5 Turbo, GPT-4, GPT-4 Turbo, GPT-4o, GPT-4o mini). +To use alternate models, perhaps a preview release or a dated model release, or if you wish to control the request parameters, you can do so by adding the following to your Zed `settings.json`: + +```json +{ + "language_models": { + "openai": { + "available_models": [ + { + "name": "gpt-4o-2024-08-06", + "display_name": "GPT 4o Summer 2024", + "max_tokens": 128000 + }, + { + "name": "o1-mini", + "display_name": "o1-mini", + "max_tokens": 128000, + "max_completion_tokens": 20000 + } + ], + "version": "1" + } + } +} +``` + +You must provide the model's context window in the `max_tokens` parameter; this can be found in the [OpenAI model documentation](https://platform.openai.com/docs/models). + +OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs. +Custom models will be listed in the model dropdown in the Agent Panel. + +### OpenAI API Compatible {#openai-api-compatible} + +Zed supports using OpenAI compatible APIs by specifying a custom `endpoint` and `available_models` for the OpenAI provider. + +You can add a custom API URL for OpenAI either via the UI or by editing your `settings.json`. +Here are a few model examples you can plug in by using this feature: + +#### X.ai Grok + +Example configuration for using X.ai Grok with Zed: + +```json + "language_models": { + "openai": { + "api_url": "https://api.x.ai/v1", + "available_models": [ + { + "name": "grok-beta", + "display_name": "X.ai Grok (Beta)", + "max_tokens": 131072 + } + ], + "version": "1" + }, + } +``` + +### OpenRouter {#openrouter} + +> ✅ Supports tool use + +OpenRouter provides access to multiple AI models through a single API. It supports tool use for compatible models. + +1. Visit [OpenRouter](https://openrouter.ai) and create an account +2. Generate an API key from your [OpenRouter keys page](https://openrouter.ai/keys) +3. Open the settings view (`agent: open configuration`) and go to the OpenRouter section +4. Enter your OpenRouter API key + +The OpenRouter API key will be saved in your keychain. + +Zed will also use the `OPENROUTER_API_KEY` environment variable if it's defined. + +#### Custom Models {#openrouter-custom-models} + +You can add custom models to the OpenRouter provider by adding the following to your Zed `settings.json`: + +```json +{ + "language_models": { + "open_router": { + "api_url": "https://openrouter.ai/api/v1", + "available_models": [ + { + "name": "google/gemini-2.0-flash-thinking-exp", + "display_name": "Gemini 2.0 Flash (Thinking)", + "max_tokens": 200000, + "max_output_tokens": 8192, + "supports_tools": true, + "supports_images": true, + "mode": { + "type": "thinking", + "budget_tokens": 8000 + } + } + ] + } + } +} +``` + +The available configuration options for each model are: + +- `name` (required): The model identifier used by OpenRouter +- `display_name` (optional): A human-readable name shown in the UI +- `max_tokens` (required): The model's context window size +- `max_output_tokens` (optional): Maximum tokens the model can generate +- `max_completion_tokens` (optional): Maximum completion tokens +- `supports_tools` (optional): Whether the model supports tool/function calling +- `supports_images` (optional): Whether the model supports image inputs +- `mode` (optional): Special mode configuration for thinking models + +You can find available models and their specifications on the [OpenRouter models page](https://openrouter.ai/models). + +Custom models will be listed in the model dropdown in the Agent Panel. + +### Vercel v0 + +[Vercel v0](https://vercel.com/docs/v0/api) is an expert model for generating full-stack apps, with framework-aware completions optimized for modern stacks like Next.js and Vercel. +It supports text and image inputs and provides fast streaming responses. + +The v0 models are [OpenAI-compatible models](/#openai-api-compatible), but Vercel is listed as first-class provider in the panel's settings view. + +To start using it with Zed, ensure you have first created a [v0 API key](https://v0.dev/chat/settings/keys). +Once you have it, paste it directly into the Vercel provider section in the panel's settings view. + +You should then find it as `v0-1.5-md` in the model dropdown in the Agent Panel. + +## Advanced Configuration {#advanced-configuration} + +### Custom Provider Endpoints {#custom-provider-endpoint} + +You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure. +To do so, add the following to your `settings.json`: + +```json +{ + "language_models": { + "some-provider": { + "api_url": "http://localhost:11434" + } + } +} +``` + +Where `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`. + +### Default Model {#default-model} + +Zed's hosted LLM service sets `claude-sonnet-4` as the default model. +However, you can change it either via the model dropdown in the Agent Panel's bottom-right corner or by manually editing the `default_model` object in your settings: + +```json +{ + "agent": { + "version": "2", + "default_model": { + "provider": "zed.dev", + "model": "gpt-4o" + } + } +} +``` + +### Feature-specific Models {#feature-specific-models} + +If a feature-specific model is not set, it will fall back to using the default model, which is the one you set on the Agent Panel. + +You can configure the following feature-specific models: + +- Thread summary model: Used for generating thread summaries +- Inline assistant model: Used for the inline assistant feature +- Commit message model: Used for generating Git commit messages + +Example configuration: + +```json +{ + "agent": { + "version": "2", + "default_model": { + "provider": "zed.dev", + "model": "claude-sonnet-4" + }, + "inline_assistant_model": { + "provider": "anthropic", + "model": "claude-3-5-sonnet" + }, + "commit_message_model": { + "provider": "openai", + "model": "gpt-4o-mini" + }, + "thread_summary_model": { + "provider": "google", + "model": "gemini-2.0-flash" + } + } +} +``` + +### Alternative Models for Inline Assists {#alternative-assists} + +You can configure additional models that will be used to perform inline assists in parallel. +When you do this, the inline assist UI will surface controls to cycle between the alternatives generated by each model. + +The models you specify here are always used in _addition_ to your [default model](#default-model). +For example, the following configuration will generate two outputs for every assist. +One with Claude 3.7 Sonnet, and one with GPT-4o. + +```json +{ + "agent": { + "default_model": { + "provider": "zed.dev", + "model": "claude-sonnet-4" + }, + "inline_alternatives": [ + { + "provider": "zed.dev", + "model": "gpt-4o" + } + ], + "version": "2" + } +} +``` + +### Default View + +Use the `default_view` setting to set change the default view of the Agent Panel. +You can choose between `thread` (the default) and `text_thread`: + +```json +{ + "agent": { + "default_view": "text_thread" + } +} +``` diff --git a/docs/src/ai/custom-api-keys.md b/docs/src/ai/custom-api-keys.md deleted file mode 100644 index 8b12fbca21a90ff63427b2c49858ebb2ad44e2d7..0000000000000000000000000000000000000000 --- a/docs/src/ai/custom-api-keys.md +++ /dev/null @@ -1,303 +0,0 @@ -# Configuring Custom API Keys - -While Zed offers hosted versions of models through our various plans, we're always happy to support users wanting to supply their own API keys for LLM providers. - -> Using your own API keys is **_free_** - you do not need to subscribe to a Zed plan to use our AI features with your own keys. - -## Supported LLM Providers - -| Provider | Tool Use Supported | -| ----------------------------------------------- | ------------------ | -| [Anthropic](#anthropic) | ✅ | -| [GitHub Copilot Chat](#github-copilot-chat) | In Some Cases | -| [Google AI](#google-ai) | ✅ | -| [Ollama](#ollama) | ✅ | -| [OpenAI](#openai) | ✅ | -| [DeepSeek](#deepseek) | 🚫 | -| [OpenAI API Compatible](#openai-api-compatible) | 🚫 | -| [LM Studio](#lmstudio) | 🚫 | - -## Providers {#providers} - -To access the Assistant configuration view, run `assistant: show configuration` in the command palette, or click on the hamburger menu at the top-right of the Assistant Panel and select "Configure". - -Below you can find all the supported providers available so far. - -### Anthropic {#anthropic} - -> 🔨Supports tool use - -You can use Anthropic models with the Zed assistant by choosing it via the model dropdown in the assistant panel. - -1. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys) -2. Make sure that your Anthropic account has credits -3. Open the configuration view (`assistant: show configuration`) and navigate to the Anthropic section -4. Enter your Anthropic API key - -Even if you pay for Claude Pro, you will still have to [pay for additional credits](https://console.anthropic.com/settings/plans) to use it via the API. - -Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined. - -#### Anthropic Custom Models {#anthropic-custom-models} - -You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`: - -```json -{ - "language_models": { - "anthropic": { - "available_models": [ - { - "name": "claude-3-5-sonnet-20240620", - "display_name": "Sonnet 2024-June", - "max_tokens": 128000, - "max_output_tokens": 2560, - "cache_configuration": { - "max_cache_anchors": 10, - "min_total_token": 10000, - "should_speculate": false - }, - "tool_override": "some-model-that-supports-toolcalling" - } - ] - } - } -} -``` - -Custom models will be listed in the model dropdown in the assistant panel. - -You can configure a model to use [extended thinking](https://docs.anthropic.com/en/docs/about-claude/models/extended-thinking-models) (if it supports it), -by changing the mode in of your models configuration to `thinking`, for example: - -```json -{ - "name": "claude-3-7-sonnet-latest", - "display_name": "claude-3-7-sonnet-thinking", - "max_tokens": 200000, - "mode": { - "type": "thinking", - "budget_tokens": 4_096 - } -} -``` - -### GitHub Copilot Chat {#github-copilot-chat} - -> 🔨Supports tool use in some cases. -> See [here](https://github.com/zed-industries/zed/blob/9e0330ba7d848755c9734bf456c716bddf0973f3/crates/language_models/src/provider/copilot_chat.rs#L189-L198) for the supported subset - -You can use GitHub Copilot chat with the Zed assistant by choosing it via the model dropdown in the assistant panel. - -### Google AI {#google-ai} - -> 🔨Supports tool use - -You can use Gemini 1.5 Pro/Flash with the Zed assistant by choosing it via the model dropdown in the assistant panel. - -1. Go the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey). -2. Open the configuration view (`assistant: show configuration`) and navigate to the Google AI section -3. Enter your Google AI API key and press enter. - -The Google AI API key will be saved in your keychain. - -Zed will also use the `GOOGLE_AI_API_KEY` environment variable if it's defined. - -#### Google AI custom models {#google-ai-custom-models} - -By default Zed will use `stable` versions of models, but you can use specific versions of models, including [experimental models](https://ai.google.dev/gemini-api/docs/models/experimental-models) with the Google AI provider by adding the following to your Zed `settings.json`: - -```json -{ - "language_models": { - "google": { - "available_models": [ - { - "name": "gemini-1.5-flash-latest", - "display_name": "Gemini 1.5 Flash (Latest)", - "max_tokens": 1000000 - } - ] - } - } -} -``` - -Custom models will be listed in the model dropdown in the assistant panel. - -### Ollama {#ollama} - -> 🔨Supports tool use - -Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`. - -1. Download one of the [available models](https://ollama.com/models), for example, for `mistral`: - - ```sh - ollama pull mistral - ``` - -2. Make sure that the Ollama server is running. You can start it either via running Ollama.app (MacOS) or launching: - - ```sh - ollama serve - ``` - -3. In the assistant panel, select one of the Ollama models using the model dropdown. - -#### Ollama Context Length {#ollama-context} - -Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models. Zed API requests to Ollama include this as `num_ctx` parameter, but the default values do not exceed `16384` so users with ~16GB of ram are able to use most models out of the box. See [get_max_tokens in ollama.rs](https://github.com/zed-industries/zed/blob/main/crates/ollama/src/ollama.rs) for a complete set of defaults. - -**Note**: Tokens counts displayed in the assistant panel are only estimates and will differ from the models native tokenizer. - -Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json: - -```json -{ - "language_models": { - "ollama": { - "api_url": "http://localhost:11434", - "available_models": [ - { - "name": "qwen2.5-coder", - "display_name": "qwen 2.5 coder 32K", - "max_tokens": 32768 - } - ] - } - } -} -``` - -If you specify a context length that is too large for your hardware, Ollama will log an error. You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (MacOS) or `journalctl -u ollama -f` (Linux). Depending on the memory available on your machine, you may need to adjust the context length to a smaller value. - -You may also optionally specify a value for `keep_alive` for each available model. This can be an integer (seconds) or alternately a string duration like "5m", "10m", "1h", "1d", etc., For example `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120seconds. - -### OpenAI {#openai} - -> 🔨Supports tool use - -1. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys) -2. Make sure that your OpenAI account has credits -3. Open the configuration view (`assistant: show configuration`) and navigate to the OpenAI section -4. Enter your OpenAI API key - -The OpenAI API key will be saved in your keychain. - -Zed will also use the `OPENAI_API_KEY` environment variable if it's defined. - -#### OpenAI Custom Models {#openai-custom-models} - -The Zed Assistant comes pre-configured to use the latest version for common models (GPT-3.5 Turbo, GPT-4, GPT-4 Turbo, GPT-4o, GPT-4o mini). If you wish to use alternate models, perhaps a preview release or a dated model release or you wish to control the request parameters you can do so by adding the following to your Zed `settings.json`: - -```json -{ - "language_models": { - "openai": { - "available_models": [ - { - "name": "gpt-4o-2024-08-06", - "display_name": "GPT 4o Summer 2024", - "max_tokens": 128000 - }, - { - "name": "o1-mini", - "display_name": "o1-mini", - "max_tokens": 128000, - "max_completion_tokens": 20000 - } - ] - "version": "1" - }, - } -} -``` - -You must provide the model's Context Window in the `max_tokens` parameter, this can be found [OpenAI Model Docs](https://platform.openai.com/docs/models). OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs. Custom models will be listed in the model dropdown in the assistant panel. - -### DeepSeek {#deepseek} - -> 🚫 Does not support tool use 🚫 - -1. Visit the DeepSeek platform and [create an API key](https://platform.deepseek.com/api_keys) -2. Open the configuration view (`assistant: show configuration`) and navigate to the DeepSeek section -3. Enter your DeepSeek API key - -The DeepSeek API key will be saved in your keychain. - -Zed will also use the `DEEPSEEK_API_KEY` environment variable if it's defined. - -#### DeepSeek Custom Models {#deepseek-custom-models} - -The Zed Assistant comes pre-configured to use the latest version for common models (DeepSeek Chat, DeepSeek Reasoner). If you wish to use alternate models or customize the API endpoint, you can do so by adding the following to your Zed `settings.json`: - -```json -{ - "language_models": { - "deepseek": { - "api_url": "https://api.deepseek.com", - "available_models": [ - { - "name": "deepseek-chat", - "display_name": "DeepSeek Chat", - "max_tokens": 64000 - }, - { - "name": "deepseek-reasoner", - "display_name": "DeepSeek Reasoner", - "max_tokens": 64000, - "max_output_tokens": 4096 - } - ] - } - } -} -``` - -Custom models will be listed in the model dropdown in the assistant panel. You can also modify the `api_url` to use a custom endpoint if needed. - -### OpenAI API Compatible{#openai-api-compatible} - -Zed supports using OpenAI compatible APIs by specifying a custom `endpoint` and `available_models` for the OpenAI provider. - -#### X.ai Grok - -Example configuration for using X.ai Grok with Zed: - -```json - "language_models": { - "openai": { - "api_url": "https://api.x.ai/v1", - "available_models": [ - { - "name": "grok-beta", - "display_name": "X.ai Grok (Beta)", - "max_tokens": 131072 - } - ], - "version": "1" - }, - } -``` - -### LM Studio {#lmstudio} - -> 🚫 Does not support tool use 🚫 - -1. Download and install the latest version of LM Studio from https://lmstudio.ai/download -2. In the app press ⌘/Ctrl + Shift + M and download at least one model, e.g. qwen2.5-coder-7b - - You can also get models via the LM Studio CLI: - - ```sh - lms get qwen2.5-coder-7b - ``` - -3. Make sure the LM Studio API server by running: - - ```sh - lms server start - ``` - -Tip: Set [LM Studio as a login item](https://lmstudio.ai/docs/advanced/headless#run-the-llm-service-on-machine-login) to automate running the LM Studio server. diff --git a/docs/src/ai/edit-prediction.md b/docs/src/ai/edit-prediction.md index 0a7e3a3ad46b5c48882dc0f19fc2f6932689b6a4..13f75e71da72c739196ed7108a3ca73f1b9fb377 100644 --- a/docs/src/ai/edit-prediction.md +++ b/docs/src/ai/edit-prediction.md @@ -231,6 +231,18 @@ To not have predictions appear automatically as you type when working with a spe } ``` +### In Specific Directories + +To disable edit predictions for specific directories or files, set this within `settings.json`: + +```json +{ + "edit_predictions": { + "disabled_globs": ["~/.config/zed/settings.json"] + } +} +``` + ### Turning Off Completely To completely turn off edit prediction across all providers, explicitly set the settings to `none`, like so: @@ -276,4 +288,4 @@ You should be able to sign-in to Supermaven by clicking on the Supermaven icon i ## See also -You may also use the [Agent Panel](./agent-panel.md) or the [Inline Assistant](./inline-assistant.md) to interact with language models, see the [AI documentation](./ai.md) for more information on the other AI features in Zed. +You may also use the [Agent Panel](./agent-panel.md) or the [Inline Assistant](./inline-assistant.md) to interact with language models, see the [AI documentation](./overview.md) for more information on the other AI features in Zed. diff --git a/docs/src/ai/inline-assistant.md b/docs/src/ai/inline-assistant.md index c6c688910d74061e914a9c2a9d9885458c95678c..cd0ace3ce67876990f02f2618ec53aea4c391a03 100644 --- a/docs/src/ai/inline-assistant.md +++ b/docs/src/ai/inline-assistant.md @@ -1,20 +1,20 @@ # Inline Assistant -## Using the Inline Assistant +## Usage Overview -You can use `ctrl-enter` to open the Inline Assistant nearly anywhere you can enter text: editors, the agent panel, the prompt library, channel notes, and even within the terminal panel. +Use `ctrl-enter` to open the Inline Assistant nearly anywhere you can enter text: editors, text threads, the rules library, channel notes, and even within the terminal panel. The Inline Assistant allows you to send the current selection (or the current line) to a language model and modify the selection with the language model's response. -You can use `ctrl-enter` to open the inline assistant nearly anywhere you can write text: editors, the Agent Panel, the Rules Library, channel notes, and even within the terminal panel. - -You can also perform multiple generation requests in parallel by pressing `ctrl-enter` with multiple cursors, or by pressing `ctrl-enter` with a selection that spans multiple excerpts in a multibuffer. +You can also perform multiple generation requests in parallel by pressing `ctrl-enter` with multiple cursors, or by pressing the same binding with a selection that spans multiple excerpts in a multibuffer. ## Context -You can give the Inline Assistant context the same way you can in the agent panel, allowing you to provide additional instructions or rules for code transformations with @-mentions. +Give the Inline Assistant context the same way you can in [the Agent Panel](./agent-panel.md), allowing you to provide additional instructions or rules for code transformations with @-mentions. + +A useful pattern here is to create a thread in the Agent Panel, and then use the mention that thread with `@thread` in the Inline Assistant to include it as context. -A useful pattern here is to create a thread in the [Agent Panel](./agent-panel.md), and then use the `@thread` command in the Inline Assistant to include the thread as context for the Inline Assistant transformation. +> The Inline Assistant is limited to normal mode context windows ([see Models](./models.md) for more). ## Prefilling Prompts diff --git a/docs/src/ai/mcp.md b/docs/src/ai/mcp.md index 6d6f0e2079ac2108889fc96485fc554ae720b79a..8fbea0fef11fa6b18480ea1a1b73501fcea59c89 100644 --- a/docs/src/ai/mcp.md +++ b/docs/src/ai/mcp.md @@ -6,9 +6,21 @@ Zed uses the [Model Context Protocol](https://modelcontextprotocol.io/) to inter Check out the [Anthropic news post](https://www.anthropic.com/news/model-context-protocol) and the [Zed blog post](https://zed.dev/blog/mcp) for an introduction to MCP. -## Try it out +## MCP Servers as Extensions -Want to try it for yourself? Here are some MCP servers available as Zed extensions: +One of the ways you can use MCP servers in Zed is by exposing them as an extension. +To learn how to do that, check out the [MCP Server Extensions](../extensions/mcp-extensions.md) page for more details. + +### Available extensions + +Many MCP servers have been exposed as extensions already, thanks to Zed's awesome community. +Check which ones are already available in Zed's extension store via any of these routes: + +1. [the Zed website](https://zed.dev/extensions?filter=context-servers) +2. in the app, run the `zed: extensions` action +3. in the app, go to the Agent Panel's top-right menu and look for the "View Server Extensions" menu item + +In any case, here are some of the ones available: - [Postgres](https://github.com/zed-extensions/postgres-context-server) - [GitHub](https://github.com/LoamStudios/zed-mcp-server-github) @@ -18,11 +30,27 @@ Want to try it for yourself? Here are some MCP servers available as Zed extensio - [Prisma](https://github.com/aqrln/prisma-mcp-zed) - [Framelink Figma](https://github.com/LoamStudios/zed-mcp-server-figma) - [Linear](https://github.com/LoamStudios/zed-mcp-server-linear) - -Browse all available MCP extensions either on [Zed's website](https://zed.dev/extensions?filter=context-servers) or directly in Zed via the `zed: extensions` action in the Command Palette. - -## Bring your own context server - -If there's an existing MCP server you'd like to bring to Zed, check out the [context server extension docs](../extensions/context-servers.md) for how to make it available as an extension. - -If you are interested in building your own MCP server, check out the [Model Context Protocol docs](https://modelcontextprotocol.io/introduction#get-started-with-mcp) to get started. +- [Resend](https://github.com/danilo-leal/zed-resend-mcp-server) + +## Add your own MCP server + +Creating an extension is not the only way to use MCP servers in Zed. +You can connect them by adding their commands directly to your `settings.json`, like so: + +```json +{ + "context_servers": { + "some-context-server": { + "source": "custom", + "command": { + "path": "some-command", + "args": ["arg-1", "arg-2"], + "env": {} + } + } + } +} +``` + +Alternatively, you can also add a custom server by accessing the Agent Panel's Settings view (also accessible via the `agent: open configuration` action). +From there, you can add it through the modal that appears when clicking the "Add Custom Server" button. diff --git a/docs/src/ai/models.md b/docs/src/ai/models.md index 36a7190db71fef3ee781097033921c5f02ecc7f1..b40f17b77f7fcf70e28e228ab9448a2ad1021fe0 100644 --- a/docs/src/ai/models.md +++ b/docs/src/ai/models.md @@ -1,39 +1,59 @@ # Models -Zed’s plans offer hosted versions of major LLM’s, generally with higher rate limits than individual API keys. We’re working hard to expand the models supported by Zed’s subscription offerings, so please check back often. +Zed’s plans offer hosted versions of major LLM’s, generally with higher rate limits than individual API keys. +We’re working hard to expand the models supported by Zed’s subscription offerings, so please check back often. -| Model | Provider | Max Mode | Context Window | Price per Prompt | Price per Request | -| ----------------- | --------- | -------- | -------------- | ---------------- | ----------------- | -| Claude 3.5 Sonnet | Anthropic | ❌ | 120k | $0.04 | N/A | -| Claude 3.7 Sonnet | Anthropic | ❌ | 120k | $0.04 | N/A | -| Claude 3.7 Sonnet | Anthropic | ✅ | 200k | N/A | $0.05 | +| Model | Provider | Burn Mode | Context Window | Price per Prompt | Price per Request | +| ----------------- | --------- | --------- | -------------- | ---------------- | ----------------- | +| Claude 3.5 Sonnet | Anthropic | ❌ | 60k | $0.04 | N/A | +| Claude 3.7 Sonnet | Anthropic | ❌ | 120k | $0.04 | N/A | +| Claude 3.7 Sonnet | Anthropic | ✅ | 200k | N/A | $0.05 | +| Claude Sonnet 4 | Anthropic | ❌ | 120k | $0.04 | N/A | +| Claude Sonnet 4 | Anthropic | ✅ | 200k | N/A | $0.05 | +| Claude Opus 4 | Anthropic | ❌ | 120k | $0.20 | N/A | +| Claude Opus 4 | Anthropic | ✅ | 200k | N/A | $0.25 | + +> Note: Because of the 5x token cost for [Opus relative to Sonnet](https://www.anthropic.com/pricing#api), each Opus prompt consumes 5 prompts against your billing meter ## Usage {#usage} -The models above can be used with the prompts included in your plan. For models not marked with [“Max Mode”](#max-mode), each prompt is counted against the monthly limit of your plan. +The models above can be used with the prompts included in your plan. For models not marked with [“Burn Mode”](#burn-mode), each prompt is counted against the monthly limit of your plan. If you’ve exceeded your limit for the month, and are on a paid plan, you can enable usage-based pricing to continue using models for the rest of the month. See [Plans and Usage](./plans-and-usage.md) for more information. -Non-[Max Mode](#max-mode) will use up to 25 tool calls per one prompt. If your prompt extends beyond 25 tool calls, Zed will ask if you’d like to continue which will consume a second prompt. See [Max Mode](#max-mode) for more information on tool calls in [Max Mode](#max-mode). +Non-Burn Mode usage will use up to 25 tool calls per one prompt. If your prompt extends beyond 25 tool calls, Zed will ask if you’d like to continue, which will consume a second prompt. + +## Burn Mode {#burn-mode} + +> Note: "Burn Mode" is the new name for what was previously called "Max Mode". -## Max Mode {#max-mode} +In Burn Mode, we enable models to use [large context windows](#context-windows), unlimited tool calls, and other capabilities for expanded reasoning, to allow an unfettered agentic experience. -In Max Mode, we enable models to use [large context windows](#context-windows), unlimited tool calls, and other capabilities for expanded reasoning, to allow an unfettered agentic experience. Because of the increased cost to Zed, each subsequent request beyond the initial user prompt in [Max Mode](#max-mode) models is counted as a prompt for metering. In addition, usage-based pricing per request is slightly more expensive for [Max Mode](#max-mode) models than usage-based pricing per prompt for regular models. +Because of the increased cost to Zed, each subsequent request beyond the initial user prompt in Burn Mode models is counted as a prompt for metering. -Note that the Agent Panel using a Max Mode model may consume a good bit of your monthly prompt capacity, if many tool calls are used. We encourage you to think through what model is best for your needs before leaving the Agent Panel to work. +In addition, usage-based pricing per request is slightly more expensive for Burn Mode models than usage-based pricing per prompt for regular models. -By default, all Agent threads start in normal mode, however you can use the agent setting `preferred_completion_mode` to start new Agent threads in max mode. +> Note that the Agent Panel using a Burn Mode model may consume a good bit of your monthly prompt capacity, if many tool calls are used. +> We encourage you to think through what model is best for your needs before leaving the Agent Panel to work. + +By default, all threads and [text threads](./text-threads.md) start in normal mode. +However, you can use the `agent.preferred_completion_mode` setting to have Burn Mode activated by default. ## Context Windows {#context-windows} A context window is the maximum span of text and code an LLM can consider at once, including both the input prompt and output generated by the model. -In [Max Mode](#max-mode), we increase context window size to allow models to have enhanced reasoning capabilities. +In [Burn Mode](#burn-mode), we increase context window size to allow models to have enhanced reasoning capabilities. -Each Agent thread in Zed maintains its own context window. The more prompts, attached files, and responses included in a session, the larger the context window grows. +Each Agent thread and text thread in Zed maintains its own context window. +The more prompts, attached files, and responses included in a session, the larger the context window grows. For best results, it’s recommended you take a purpose-based approach to Agent thread management, starting a new thread for each unique task. ## Tool Calls {#tool-calls} -Models can use [tools](./tools.md) to interface with your code, search the web, and perform other useful functions. In [Max Mode](#max-mode), models can use an unlimited number of tools per prompt, with each tool call counting as a prompt for metering purposes. For non-Max Mode models, you'll need to interact with the model every 25 tool calls to continue, at which point a new prompt will be counted against your plan limit. +Models can use [tools](./tools.md) to interface with your code, search the web, and perform other useful functions. + +In [Burn Mode](#burn-mode), models can use an unlimited number of tools per prompt, with each tool call counting as a prompt for metering purposes. + +For non-Burn Mode models, you'll need to interact with the model every 25 tool calls to continue, at which point a new prompt will be counted against your plan limit. diff --git a/docs/src/ai/overview.md b/docs/src/ai/overview.md index 1fc9dde044d41dc67012ad79c6f80394e7afb37c..f437b24ba6ecf3eb52523ea56b33e16c8f14c01d 100644 --- a/docs/src/ai/overview.md +++ b/docs/src/ai/overview.md @@ -1,34 +1,33 @@ # AI -Zed offers various features that integrate LLMs smoothly into the editor. +Zed smoothly integrates LLMs in multiple ways across the editor. +Learn how to get started with AI on Zed and all its capabilities. ## Setting up AI in Zed -- [Models](./models.md): Information about the various language models available in Zed. +- [Configuration](./configuration.md): Learn how to set up different language model providers like Anthropic, OpenAI, Ollama, Google AI, and more. -- [Configuration](./custom-api-keys.md): Configure the Agent, and set up different language model providers like Anthropic, OpenAI, Ollama, Google AI, and more. +- [Models](./models.md): Learn about the various language models available in Zed. -- [Custom API Keys](./custom-api-keys.md): How to use your own API keys with the AI features. - -- [Subscription](./subscription.md): Information about Zed's subscriptions and other billing related information. +- [Subscription](./subscription.md): Learn about Zed's subscriptions and other billing-related information. - [Privacy and Security](./privacy-and-security.md): Understand how Zed handles privacy and security with AI features. ## Agentic Editing -- [Agent Panel](./agent-panel.md): Create and collaboratively edit new threads, and manage interactions with language models. +- [Agent Panel](./agent-panel.md): Create and manage interactions with language models. - [Rules](./rules.md): How to define rules for AI interactions. -- [Tools](./tools.md): Explore the tools that enhance the AI's capabilities to interact with your codebase. +- [Tools](./tools.md): Explore the tools that enable agentic capabilities. -- [Model Context Protocol](./mcp.md): Learn about context servers that enhance the Assistant's capabilities. +- [Model Context Protocol](./mcp.md): Learn about how to install and configure MCP servers. -- [Inline Assistant](./inline-assistant.md): Discover how to use the agent to power inline transformations directly within your code editor and terminal. +- [Inline Assistant](./inline-assistant.md): Discover how to use the agent to power inline transformations directly within a file or terminal. ## Edit Prediction -- [Edit Prediction](./edit-prediction.md): Learn about Zed's Edit Prediction feature that helps autocomplete your code. +- [Edit Prediction](./edit-prediction.md): Learn about Zed's AI prediction feature that helps autocomplete your code. ## Text Threads diff --git a/docs/src/ai/plans-and-usage.md b/docs/src/ai/plans-and-usage.md index 397e9ad76373115399e50cdb9f8ad2a0717b445f..a1da17f50de5057740e8f0d52d87f94afe3c13e9 100644 --- a/docs/src/ai/plans-and-usage.md +++ b/docs/src/ai/plans-and-usage.md @@ -15,7 +15,7 @@ Please note that if you’re interested in just using Zed as the world’s faste - A `request` in Zed is a response to a `prompt`, plus any tool calls that are initiated as part of that response. There may be one `request` per `prompt`, or many. Most models offered by Zed are metered per-prompt. -Some models that use large context windows and unlimited tool calls ([“Max Mode”](./models.md#max-mode)) count each individual request within a prompt against your prompt limit, since the agentic work spawned by the prompt is expensive to support. +Some models that use large context windows and unlimited tool calls ([“Burn Mode”](./models.md#burn-mode)) count each individual request within a prompt against your prompt limit, since the agentic work spawned by the prompt is expensive to support. See [the Models page](./models.md) for a list of which subset of models are metered by request. diff --git a/docs/src/ai/rules.md b/docs/src/ai/rules.md index 7a34a89ec267b9a58f7aa82da88458cce8f34fec..ed916874cadb957ca45d02af00d3a4047ebd3246 100644 --- a/docs/src/ai/rules.md +++ b/docs/src/ai/rules.md @@ -1,23 +1,22 @@ # Using Rules {#using-rules} -Rules are an essential part of interacting with AI assistants in Zed. They help guide the AI's responses and ensure you get the most relevant and useful information. - -Every new chat will start with the [default rules](#default-rules), which can be customized and is where your model prompting will stored. - -Remember that effective prompting is an iterative process. Experiment with different prompt structures and wordings to find what works best for your specific needs and the model you're using. - -Here are some tips for creating effective rules: - -1. Be specific: Clearly state what you want the AI to do or explain. -2. Provide context: Include relevant information about your project or problem. -3. Use examples: If applicable, provide examples to illustrate your request. -4. Break down complex tasks: For multi-step problems, consider breaking them into smaller, more manageable rules. +A rule is essentially a prompt that is inserted at the beginning of each interaction with the Agent. +Currently, Zed supports `.rules` files at the directory's root and the Rules Library, which allows you to store multiple rules for on-demand usage. ## `.rules` files -Zed supports including `.rules` files at the top level of worktrees. Here, you can include project-level instructions you'd like to have included in all of your interactions with the agent panel. Other names for this file are also supported - the first file which matches in this list will be used: `.rules`, `.cursorrules`, `.windsurfrules`, `.clinerules`, `.github/copilot-instructions.md`, or `CLAUDE.md`. +Zed supports including `.rules` files at the top level of worktrees, and act as project-level instructions that are included in all of your interactions with the Agent Panel. +Other names for this file are also supported for compatibility with other agents, but note that the first file which matches in this list will be used: -Zed also supports creating rules (`Rules Library`) that can be included in any interaction with the agent panel. +- `.rules` +- `.cursorrules` +- `.windsurfrules` +- `.clinerules` +- `.github/copilot-instructions.md` +- `AGENT.md` +- `AGENTS.md` +- `CLAUDE.md` +- `GEMINI.md` ## Rules Library {#rules-library} @@ -27,11 +26,11 @@ You can use the inline assistant right in the rules editor, allowing you to auto ### Opening the Rules Library -1. Open the agent panel. -2. Click on the `Agent Menu` (`...`) in the top right corner. +1. Open the Agent Panel. +2. Click on the Agent menu (`...`) in the top right corner. 3. Select `Rules...` from the dropdown. -You can also use the `assistant: open rules library` command while in the agent panel. +You can also use the `agent: open rules library` command while in the Agent Panel. ### Managing Rules @@ -39,50 +38,38 @@ Once a rules file is selected, you can edit it directly in the built-in editor. Rules can be duplicated, deleted, or added to the default rules using the buttons in the rules editor. -## Creating Rules {#creating-rules} +### Creating Rules {#creating-rules} To create a rule file, simply open the `Rules Library` and click the `+` button. Rules files are stored locally and can be accessed from the library at any time. Having a series of rules files specifically tailored to prompt engineering can also help you write consistent and effective rules. -The process of writing and refining prompts is commonly referred to as "prompt engineering." - -More on rule engineering: +Here are a couple of helpful resources for writing better rules: - [Anthropic: Prompt Engineering](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview) - [OpenAI: Prompt Engineering](https://platform.openai.com/docs/guides/prompt-engineering) -## Editing the Default Rules {#default-rules} - -Zed allows you to customize the default rules used when interacting with LLMs. Or to be more precise, it uses a series of rules that are combined to form the default rules. - -To edit rules, select `Rules...` from the `Agent Menu` icon (`...`) in the upper right hand corner or using the {#kb assistant::OpenRulesLibrary} keyboard shortcut. - -A default set of rules might look something like: - -```plaintext -[-] Default - [+] Today's date - [+] You are an expert - [+] Don't add comments -``` - -Default rules are included in the context of new threads automatically. - -Default rules will show at the top of the rules list, and will be included with every new conversation. +### Editing the Default Rules {#default-rules} -You can manually add other rules as context using the `@rule` command. +Zed allows you to customize the default rules used when interacting with LLMs. +Or to be more precise, it uses a series of rules that are combined to form the default rules. -> **Note:** Remember, commands are only evaluated when the context is created, so a command like `@file` won't continuously update. +Default rules are included in the context of every new thread automatically. +You can also manually add other rules (that are not flagged as default) as context using the `@rule` command. ## Migrating from Prompt Library -Previously, the Rules Library was called the Prompt Library. The new rules system replaces the Prompt Library except in a few specific cases, which are outlined below. +Previously, the Rules Library was called the "Prompt Library". +The new rules system replaces the Prompt Library except in a few specific cases, which are outlined below. ### Slash Commands in Rules -Previously, it was possible to use slash commands (now @-mentions) in custom prompts (now rules). There is currently no support for using @-mentions in rules files, however, slash commands are supported in rules files when used with text threads. See the documentation for using [slash commands in rules](./text-threads.md#slash-commands-in-rules) for more information. +Previously, it was possible to use slash commands (now @-mentions) in custom prompts (now rules). +There is currently no support for using @-mentions in rules files, however, slash commands are supported in rules files when used with text threads. +See the documentation for using [slash commands in rules](./text-threads.md#slash-commands-in-rules) for more information. ### Prompt templates -Zed maintains backwards compatibility with its original template system, which allows you to customize prompts used throughout the application, including the inline assistant. While the Rules Library is now the primary way to manage prompts, you can still use these legacy templates to override default prompts. For more details, see the [Rules Templates](./text-threads.md#rule-templates) section under [Text Threads](./text-threads.md). +Zed maintains backwards compatibility with its original template system, which allows you to customize prompts used throughout the application, including the inline assistant. +While the Rules Library is now the primary way to manage prompts, you can still use these legacy templates to override default prompts. +For more details, see the [Rules Templates](./text-threads.md#rule-templates) section under [Text Threads](./text-threads.md). diff --git a/docs/src/ai/subscription.md b/docs/src/ai/subscription.md index b3f6bf4a8967134680f5f0f62da54c7083fd77f0..078fe43384a4fc51b0413ef0bfa8fc7a8ddb1e38 100644 --- a/docs/src/ai/subscription.md +++ b/docs/src/ai/subscription.md @@ -2,7 +2,7 @@ Zed's hosted models are offered via subscription to Zed Pro or Zed Business. -> Using your own API keys is **_free_** - you do not need to subscribe to a Zed plan to use our AI features with your own keys. +> Using your own API keys is _free_—you do not need to subscribe to a Zed plan to use our AI features with your own keys. See the following pages for specific aspects of our subscription offering: diff --git a/docs/src/ai/temperature.md b/docs/src/ai/temperature.md index ff5e415630cdfe53640ba3f51427c2f2374119cc..bb0cef6b517e73712b3531fda45d7d1c6cd6f788 100644 --- a/docs/src/ai/temperature.md +++ b/docs/src/ai/temperature.md @@ -16,7 +16,7 @@ Zed's settings allow you to specify a custom temperature for a provider and/or m // To set parameters for a specific provider and model: { "provider": "zed.dev", - "model": "claude-3-7-sonnet-latest", + "model": "claude-sonnet-4", "temperature": 1.0 } ], diff --git a/docs/src/ai/text-threads.md b/docs/src/ai/text-threads.md index e24c7056e73bfb0f1807011328407711b21926b1..65a5dcba037a73b5f3041297041c21607211df23 100644 --- a/docs/src/ai/text-threads.md +++ b/docs/src/ai/text-threads.md @@ -32,11 +32,12 @@ If you want to start a new conversation at any time, you can hit cmd-n|ctrl Simple back-and-forth conversations work well with the text threads. However, there may come a time when you want to modify the previous text in the conversation and steer it in a different direction. -## Editing a Context {#edit-context} +## Editing a Text Thread {#edit-text-thread} -> **Note**: Wondering about Context vs. Conversation? [Read more here](./contexts.md). - -Text threads give you the flexibility to have control over the context. You can freely edit any previous text, including the responses from the LLM. If you want to remove a message block entirely, simply place your cursor at the beginning of the block and use the `delete` key. A typical workflow might involve making edits and adjustments throughout the context to refine your inquiry or provide additional information. Here's an example: +Text threads give you the flexibility to have control over the context. +You can freely edit any previous text, including the responses from the LLM. +If you want to remove a message block entirely, simply place your cursor at the beginning of the block and use the `delete` key. +A typical workflow might involve making edits and adjustments throughout the context to refine your inquiry or provide additional information. Here's an example: 1. Write text in a `You` block. 2. Submit the message with {#kb assistant::Assist}. @@ -46,7 +47,7 @@ Text threads give you the flexibility to have control over the context. You can 6. Add additional context to your original message. 7. Submit the message with {#kb assistant::Assist}. -Being able to edit previous messages gives you control over how tokens are used. You don't need to start up a new chats to correct a mistake or to add additional information, and you don't have to waste tokens by submitting follow-up corrections. +Being able to edit previous messages gives you control over how tokens are used. You don't need to start up a new chat to correct a mistake or to add additional information, and you don't have to waste tokens by submitting follow-up corrections. > **Note**: The act of editing past messages is often referred to as "Rewriting History" in the context of the language models. @@ -58,31 +59,26 @@ Some additional points to keep in mind: Slash commands enhance the assistant's capabilities. Begin by typing a `/` at the beginning of the line to see a list of available commands: -- `/default`: Inserts the default prompt into the context -- `/diagnostics`: Injects errors reported by the project's language server into the context -- `/fetch`: Fetches the content of a webpage and inserts it into the context -- `/file`: Inserts a single file or a directory of files into the context -- `/now`: Inserts the current date and time into the context +- `/default`: Inserts the default rule +- `/diagnostics`: Injects errors reported by the project's language server +- `/fetch`: Fetches the content of a webpage and inserts it +- `/file`: Inserts a single file or a directory of files +- `/now`: Inserts the current date and time - `/prompt`: Adds a custom-configured prompt to the context ([see Rules Library](./rules.md#rules-library)) -- `/symbols`: Inserts the current tab's active symbols into the context -- `/tab`: Inserts the content of the active tab or all open tabs into the context +- `/symbols`: Inserts the current tab's active symbols +- `/tab`: Inserts the content of the active tab or all open tabs - `/terminal`: Inserts a select number of lines of output from the terminal -- `/selection`: Inserts the selected text into the context - -### Other Commands: +- `/selection`: Inserts the selected text -- `/search`: Performs semantic search for content in your project based on natural language - - Not generally available yet, but some users may have access to it. +> **Note:** Remember, commands are only evaluated when the text thread is created or when the command is inserted, so a command like `/now` won't continuously update, or `/file` commands won't keep their contents up to date. -> **Note:** Remember, commands are only evaluated when the context is created or when the command is inserted, so a command like `/now` won't continuously update, or `/file` commands won't keep their contents up to date. - -#### `/default` +### `/default` Read more about `/default` in the [Rules: Editing the Default Rules](./rules.md#default-rules) section. Usage: `/default` -#### `/diagnostics` +### `/diagnostics` The `/diagnostics` command injects errors reported by the project's language server into the context. This is useful for getting an overview of current issues in your project. @@ -91,7 +87,7 @@ Usage: `/diagnostics [--include-warnings] [path]` - `--include-warnings`: Optional flag to include warnings in addition to errors. - `path`: Optional path to limit diagnostics to a specific file or directory. -#### `/file` +### `/file` The `/file` command inserts the content of a single file or a directory of files into the context. This allows you to reference specific parts of your project in your conversation with the assistant. @@ -105,13 +101,13 @@ Examples: - `/file src/*.js` - Inserts the content of all `.js` files in the `src` directory. - `/file src` - Inserts the content of all files in the `src` directory. -#### `/now` +### `/now` The `/now` command inserts the current date and time into the context. This can be useful letting the language model know the current time (and by extension, how old their current knowledge base is). Usage: `/now` -#### `/prompt` +### `/prompt` The `/prompt` command inserts a prompt from the prompt library into the context. It can also be used to nest prompts within prompts. @@ -119,13 +115,13 @@ Usage: `/prompt ` Related: `/default` -#### `/symbols` +### `/symbols` The `/symbols` command inserts the active symbols (functions, classes, etc.) from the current tab into the context. This is useful for getting an overview of the structure of the current file. Usage: `/symbols` -#### `/tab` +### `/tab` The `/tab` command inserts the content of the active tab or all open tabs into the context. This allows you to reference the content you're currently working on. @@ -140,7 +136,7 @@ Examples: - `/tab "index.js"` - Inserts the content of the tab named "index.js". - `/tab all` - Inserts the content of all open tabs. -#### `/terminal` +### `/terminal` The `/terminal` command inserts a select number of lines of output from the terminal into the context. This is useful for referencing recent command outputs or logs. @@ -148,7 +144,7 @@ Usage: `/terminal []` - ``: Optional parameter to specify the number of lines to insert (default is a 50). -#### `/selection` +### `/selection` The `/selection` command inserts the selected text in the editor into the context. This is useful for referencing specific parts of your code. @@ -156,9 +152,10 @@ This is equivalent to the `assistant: quote selection` command ({#kb assistant:: Usage: `/selection` -## Commands in the Rules Library (previously known as Prompt Library) {#slash-commands-in-rules} +## Commands in the Rules Library {#slash-commands-in-rules} -[Commands](#commands) can be used in rules to insert dynamic content or perform actions. For example, if you want to create a rule where it is important for the model to know the date, you can use the `/now` command to insert the current date. +[Commands](#commands) can be used in rules, in the Rules Library (previously known as Prompt Library), to insert dynamic content or perform actions. +For example, if you want to create a rule where it is important for the model to know the date, you can use the `/now` command to insert the current date. > **Warn:** Slash commands in rules **only** work when they are used in text threads. Using them in non-text threads is not supported. @@ -166,7 +163,7 @@ Usage: `/selection` See the [list of commands](#commands) above for more information on commands, and what slash commands are available. -### Example: +### Example ```plaintext You are an expert Rust engineer. The user has asked you to review their project and answer some questions. diff --git a/docs/src/ai/tools.md b/docs/src/ai/tools.md index b747ad7f5152e73dbabab0cb096b9f172ca78f5c..06e80a863dfd7141500d48db4ad3b4ff0552305c 100644 --- a/docs/src/ai/tools.md +++ b/docs/src/ai/tools.md @@ -1,20 +1,75 @@ # Tools -Zed's Agent has access to a variety of tools that allow it to interact with your codebase and perform tasks: - -- **`copy_path`**: Copies a file or directory recursively in the project, more efficient than manually reading and writing files when duplicating content. -- **`create_directory`**: Creates a new directory at the specified path within the project, creating all necessary parent directories (similar to `mkdir -p`). -- **`create_file`**: Creates a new file at a specified path with given text content, the most efficient way to create new files or completely replace existing ones. -- **`delete_path`**: Deletes a file or directory (including contents recursively) at the specified path and confirms the deletion. -- **`diagnostics`**: Gets errors and warnings for either a specific file or the entire project, useful after making edits to determine if further changes are needed. -- **`edit_file`**: Edits files by replacing specific text with new content. -- **`fetch`**: Fetches a URL and returns the content as Markdown. Useful for providing docs as context. -- **`list_directory`**: Lists files and directories in a given path, providing an overview of filesystem contents. -- **`move_path`**: Moves or renames a file or directory in the project, performing a rename if only the filename differs. -- **`now`**: Returns the current date and time. -- **`find_path`**: Quickly finds files by matching glob patterns (like "\*_/_.js"), returning matching file paths alphabetically. -- **`read_file`**: Reads the content of a specified file in the project, allowing access to file contents. -- **`grep`**: Searches file contents across the project using regular expressions, preferred for finding symbols in code without knowing exact file paths. -- **`terminal`**: Executes shell commands and returns the combined output, creating a new shell process for each invocation. -- **`thinking`**: Allows the Agent to work through problems, brainstorm ideas, or plan without executing actions, useful for complex problem-solving. -- **`web_search`**: Searches the web for information, providing results with snippets and links from relevant web pages, useful for accessing real-time information. +Zed's Agent has access to a variety of tools that allow it to interact with your codebase and perform tasks. + +## Read & Search Tools + +### `diagnostics` + +Gets errors and warnings for either a specific file or the entire project, useful after making edits to determine if further changes are needed. + +### `fetch` + +Fetches a URL and returns the content as Markdown. Useful for providing docs as context. + +### `find_path` + +Quickly finds files by matching glob patterns (like "\*_/_.js"), returning matching file paths alphabetically. + +### `grep` + +Searches file contents across the project using regular expressions, preferred for finding symbols in code without knowing exact file paths. + +### `list_directory` + +Lists files and directories in a given path, providing an overview of filesystem contents. + +### `now` + +Returns the current date and time. + +### `open` + +Opens a file or URL with the default application associated with it on the user's operating system. + +### `read_file` + +Reads the content of a specified file in the project, allowing access to file contents. + +### `thinking` + +Allows the Agent to work through problems, brainstorm ideas, or plan without executing actions, useful for complex problem-solving. + +### `web_search` + +Searches the web for information, providing results with snippets and links from relevant web pages, useful for accessing real-time information. + +## Edit Tools + +### `copy_path` + +Copies a file or directory recursively in the project, more efficient than manually reading and writing files when duplicating content. + +### `create_directory` + +Creates a new directory at the specified path within the project, creating all necessary parent directories (similar to `mkdir -p`). + +### `create_file` + +Creates a new file at a specified path with given text content, the most efficient way to create new files or completely replace existing ones. + +### `delete_path` + +Deletes a file or directory (including contents recursively) at the specified path and confirms the deletion. + +### `edit_file` + +Edits files by replacing specific text with new content. + +### `move_path` + +Moves or renames a file or directory in the project, performing a rename if only the filename differs. + +### `terminal` + +Executes shell commands and returns the combined output, creating a new shell process for each invocation. diff --git a/docs/src/channels.md b/docs/src/channels.md index a794928858d93bcff576553f26ba84a69c667cac..d8318d22e5d18cf0e5ff514a6c3a4a2618f54325 100644 --- a/docs/src/channels.md +++ b/docs/src/channels.md @@ -2,7 +2,7 @@ At Zed we believe that great things are built by great people working together. We have designed Zed to help every individual work faster and to help teams of people work together more effectively. -### Overview +## Overview Channels provide a way to streamline collaborating for software engineers in many ways, but particularly: @@ -11,11 +11,9 @@ Channels provide a way to streamline collaborating for software engineers in man - Refactoring – you can have multiple people join in on large refactoring without fear of conflict. - Ambient awareness – you can see what everyone else is working on with no need for status emails or meetings. -### Channels +## Channels -To open the collaboration panel hit `cmd-shift-c` (or `cmd-shift-p “collab panel: toggle focus”`). - -
+To open the collaboration panel hit {#kb collab_panel::ToggleFocus} or `collab panel: toggle focus`. Each channel corresponds to an ongoing project or work-stream. You can see who’s in a channel as their avatars will show up in the sidebar. This makes it easy to see what everyone is doing and where to find them if needed. @@ -23,29 +21,25 @@ You can create as many channels as you need. As in the example above, you can mi Joining a channel adds you to a shared room where you can work on projects together. -### Sharing projects +## Sharing projects After joining a channel, you can `Share` a project with the other people there. This will enable them to edit the code hosted on your machine as though they had it checked out locally. -
- When you are editing someone else’s project, you still have the full power of the editor at your fingertips, you can jump to definitions, use the AI assistant, and see any diagnostic errors. This is extremely powerful for pairing, as one of you can be implementing the current method while the other is reading and researching the correct solution to the next problem. And, because you have your own config running, it feels like you’re using your own machine. See [our collaboration documentation](./collaboration.md) for more details about how this works. -### Notes +## Notes Each channel has a notes file associated with it to keep track of current status, new ideas, or to collaborate on building out the design for the feature that you’re working on before diving into code. -
- This is similar to a Google Doc, except powered by Zed's collaborative software and persisted to our servers. -### Chat +## Chat The chat is also there for quickly sharing context without a microphone, getting questions answered, or however else you'd want to use a chat channel. -### Inviting people +## Inviting people By default, channels you create can only be accessed by you. You can invite collaborators by right clicking and selecting `Manage members`. @@ -53,7 +47,7 @@ When you have channels nested under each other, permissions are inherited. For i Once you have added someone, they can either join your channel by clicking on it in their Zed sidebar, or you can share the link to the channel so that they can join directly. -### Livestreaming & Guests +## Livestreaming & Guests A Channel can also be made Public. This allows anyone to join the channel by clicking on the link. diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index 92ad474dfddcad0341ff5842c39b7fa10ab1b370..4587a70ac15bf294728b235e75e73a1a1572fbd1 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -38,23 +38,12 @@ Extensions that provide language servers may also provide default settings for t ```json { "active_pane_modifiers": { - "magnification": 1.0, "border_size": 0.0, "inactive_opacity": 1.0 } } ``` -### Magnification - -- Description: Scale by which to zoom the active pane. When set to `1.0`, the active pane has the same size as others, but when set to a larger value, the active pane takes up more space. -- Setting: `magnification` -- Default: `1.0` - -**Options** - -`float` values - ### Border size - Description: Size of the border surrounding the active pane. When set to 0, the active pane doesn't have any border. The border is drawn inset. @@ -123,7 +112,7 @@ Non-negative `float` values **Options** -You can find the names of your currently installed extensions by listing the subfolders under the [extension installation location](./extensions/installing-extensions#installation-location): +You can find the names of your currently installed extensions by listing the subfolders under the [extension installation location](./extensions/installing-extensions.md#installation-location): On MacOS: @@ -389,6 +378,20 @@ For example, to use `Nerd Font` as a fallback, add the following to your setting `"standard"`, `"comfortable"` or `{ "custom": float }` (`1` is compact, `2` is loose) +## Close on File Delete + +- Description: Whether to automatically close editor tabs when their corresponding files are deleted from disk. +- Setting: `close_on_file_delete` +- Default: `false` + +**Options** + +`boolean` values + +When enabled, this setting will automatically close tabs for files that have been deleted from the file system. This is particularly useful for workflows involving temporary or scratch files that are frequently created and deleted. When disabled (default), deleted files remain open with a strikethrough through their tab title. + +Note: Dirty files (files with unsaved changes) will not be automatically closed even when this setting is enabled, ensuring you don't lose unsaved work. + ## Confirm Quit - Description: Whether or not to prompt the user to confirm before closing the application. @@ -831,6 +834,185 @@ List of `string` values `boolean` values +## Minimap + +- Description: Settings related to the editor's minimap, which provides an overview of your document. +- Setting: `minimap` +- Default: + +```json +{ + "minimap": { + "show": "never", + "thumb": "always", + "thumb_border": "left_open", + "current_line_highlight": null + } +} +``` + +### Show Mode + +- Description: When to show the minimap in the editor. +- Setting: `show` +- Default: `never` + +**Options** + +1. Always show the minimap: + +```json +{ + "show": "always" +} +``` + +2. Show the minimap if the editor's scrollbars are visible: + +```json +{ + "show": "auto" +} +``` + +3. Never show the minimap: + +```json +{ + "show": "never" +} +``` + +### Thumb Display + +- Description: When to show the minimap thumb (the visible editor area) in the minimap. +- Setting: `thumb` +- Default: `always` + +**Options** + +1. Show the minimap thumb when hovering over the minimap: + +```json +{ + "thumb": "hover" +} +``` + +2. Always show the minimap thumb: + +```json +{ + "thumb": "always" +} +``` + +### Thumb Border + +- Description: How the minimap thumb border should look. +- Setting: `thumb_border` +- Default: `left_open` + +**Options** + +1. Display a border on all sides of the thumb: + +```json +{ + "thumb_border": "full" +} +``` + +2. Display a border on all sides except the left side: + +```json +{ + "thumb_border": "left_open" +} +``` + +3. Display a border on all sides except the right side: + +```json +{ + "thumb_border": "right_open" +} +``` + +4. Display a border only on the left side: + +```json +{ + "thumb_border": "left_only" +} +``` + +5. Display the thumb without any border: + +```json +{ + "thumb_border": "none" +} +``` + +### Current Line Highlight + +- Description: How to highlight the current line in the minimap. +- Setting: `current_line_highlight` +- Default: `null` + +**Options** + +1. Inherit the editor's current line highlight setting: + +```json +{ + "minimap": { + "current_line_highlight": null + } +} +``` + +2. Highlight the current line in the minimap: + +```json +{ + "minimap": { + "current_line_highlight": "line" + } +} +``` + +or + +```json +{ + "minimap": { + "current_line_highlight": "all" + } +} +``` + +3. Do not highlight the current line in the minimap: + +```json +{ + "minimap": { + "current_line_highlight": "gutter" + } +} +``` + +or + +```json +{ + "minimap": { + "current_line_highlight": "none" + } +} +``` + ## Editor Tab Bar - Description: Settings related to the editor's tab bar. @@ -1024,6 +1206,26 @@ List of `string` values } ``` +### Show Inline Code Actions + +- Description: Whether to show code action button at start of buffer line. +- Setting: `inline_code_actions` +- Default: `true` + +**Options** + +`boolean` values + +### Drag And Drop Selection + +- Description: Whether to allow drag and drop text selection in buffer. +- Setting: `drag_and_drop_selection` +- Default: `true` + +**Options** + +`boolean` values + ## Editor Toolbar - Description: Whether or not to show various elements in the editor toolbar. @@ -1035,7 +1237,8 @@ List of `string` values "breadcrumbs": true, "quick_actions": true, "selections_menu": true, - "agent_review": true + "agent_review": true, + "code_actions": false }, ``` @@ -1171,7 +1374,7 @@ While other options may be changed at a runtime and should be placed under `sett } ``` -3. External formatters may optionally include a `{buffer_path}` placeholder which at runtime will include the path of the buffer being formatted. Formatters operate by receiving file content via standard input, reformatting it and then outputting it to standard output and so normally don't know the filename of what they are formatting. Tools like prettier support receiving the file path via a command line argument which can then used to impact formatting decisions. +3. External formatters may optionally include a `{buffer_path}` placeholder which at runtime will include the path of the buffer being formatted. Formatters operate by receiving file content via standard input, reformatting it and then outputting it to standard output and so normally don't know the filename of what they are formatting. Tools like Prettier support receiving the file path via a command line argument which can then used to impact formatting decisions. WARNING: `{buffer_path}` should not be used to direct your formatter to read from a filename. Your formatter should only read from standard input and should not read or write files directly. @@ -1563,91 +1766,91 @@ Example: } ``` -### Hunk Style +**Options** -- Description: What styling we should use for the diff hunks. -- Setting: `hunk_style` -- Default: +1. Disable inline git blame: ```json { "git": { - "hunk_style": "staged_hollow" + "inline_blame": { + "enabled": false + } } } ``` -**Options** - -1. Show the staged hunks faded out and with a border: +2. Only show inline git blame after a delay (that starts after cursor stops moving): ```json { "git": { - "hunk_style": "staged_hollow" + "inline_blame": { + "enabled": true, + "delay_ms": 500 + } } } ``` -2. Show unstaged hunks faded out and with a border: +3. Show a commit summary next to the commit date and author: ```json { "git": { - "hunk_style": "unstaged_hollow" + "inline_blame": { + "enabled": true, + "show_commit_summary": true + } } } ``` -**Options** - -1. Disable inline git blame: +4. Use this as the minimum column at which to display inline blame information: ```json { "git": { "inline_blame": { - "enabled": false + "enabled": true, + "min_column": 80 } } } ``` -2. Only show inline git blame after a delay (that starts after cursor stops moving): +### Hunk Style + +- Description: What styling we should use for the diff hunks. +- Setting: `hunk_style` +- Default: ```json { "git": { - "inline_blame": { - "enabled": true, - "delay_ms": 500 - } + "hunk_style": "staged_hollow" } } ``` -3. Show a commit summary next to the commit date and author: +**Options** + +1. Show the staged hunks faded out and with a border: ```json { "git": { - "inline_blame": { - "enabled": true, - "show_commit_summary": true - } + "hunk_style": "staged_hollow" } } ``` -4. Use this as the minimum column at which to display inline blame information: +2. Show unstaged hunks faded out and with a border: ```json { "git": { - "inline_blame": { - "enabled": true, - "min_column": 80 - } + "hunk_style": "unstaged_hollow" } } ``` @@ -1731,6 +1934,30 @@ Example: `boolean` values +## Multi Cursor Modifier + +- Description: Determines the modifier to be used to add multiple cursors with the mouse. The open hover link mouse gestures will adapt such that it do not conflict with the multicursor modifier. +- Setting: `multi_cursor_modifier` +- Default: `alt` + +**Options** + +1. Maps to `Alt` on Linux and Windows and to `Option` on MacOS: + +```jsonc +{ + "multi_cursor_modifier": "alt", +} +``` + +2. Maps `Control` on Linux and Windows and to `Command` on MacOS: + +```jsonc +{ + "multi_cursor_modifier": "cmd_or_ctrl", // alias: "cmd", "ctrl" +} +``` + ## Hover Popover Enabled - Description: Whether or not to show the informational hover box when moving the mouse over symbols in the editor. @@ -1741,6 +1968,16 @@ Example: `boolean` values +## Hover Popover Delay + +- Description: Time to wait in milliseconds before showing the informational hover box. +- Setting: `hover_popover_delay` +- Default: `300` + +**Options** + +`integer` values representing milliseconds + ## Icon Theme - Description: The icon theme setting can be specified in two forms - either as the name of an icon theme or as an object containing the `mode`, `dark`, and `light` icon themes for files/folders inside Zed. @@ -2861,7 +3098,8 @@ Run the `theme selector: toggle` action in the command palette to see a current "show_diagnostics": "all", "indent_guides": { "show": "always" - } + }, + "hide_root": false } } ``` @@ -3084,13 +3322,10 @@ Run the `theme selector: toggle` action in the command palette to see a current "dock": "right", "default_width": 640, "default_height": 320, + "default_view": "thread", "default_model": { "provider": "zed.dev", - "model": "claude-3-7-sonnet-latest" - }, - "editor_model": { - "provider": "zed.dev", - "model": "claude-3-7-sonnet-latest" + "model": "claude-sonnet-4" }, "single_file_review": true, } diff --git a/docs/src/debugger.md b/docs/src/debugger.md new file mode 100644 index 0000000000000000000000000000000000000000..37930ac560a543301ab1a79bc1bbf9eb75115cb2 --- /dev/null +++ b/docs/src/debugger.md @@ -0,0 +1,609 @@ +# Debugger + +Zed uses the [Debug Adapter Protocol (DAP)](https://microsoft.github.io/debug-adapter-protocol/) to provide debugging functionality across multiple programming languages. +DAP is a standardized protocol that defines how debuggers, editors, and IDEs communicate with each other. +It allows Zed to support various debuggers without needing to implement language-specific debugging logic. + +This protocol enables features like setting breakpoints, stepping through code, inspecting variables, +and more, in a consistent manner across different programming languages and runtime environments. + +> We currently offer onboarding support for users. We are eager to hear from you if you encounter any issues or have suggestions for improvement for our debugging experience. +> You can schedule a call via [Cal.com](https://cal.com/team/zed-research/debugger) + +## Supported Debug Adapters + +Zed supports a variety of debug adapters for different programming languages out of the box: + +- JavaScript ([vscode-js-debug](https://github.com/microsoft/vscode-js-debug.git)): Enables debugging of Node.js applications, including setting breakpoints, stepping through code, and inspecting variables in JavaScript. + +- Python ([debugpy](https://github.com/microsoft/debugpy.git)): Provides debugging capabilities for Python applications, supporting features like remote debugging, multi-threaded debugging, and Django/Flask application debugging. + +- LLDB ([CodeLLDB](https://github.com/vadimcn/codelldb.git)): A powerful debugger for Rust, C, C++, and some other compiled languages, offering low-level debugging features and support for Apple platforms. + +- GDB ([GDB](https://sourceware.org/gdb/)): The GNU Debugger, which supports debugging for multiple programming languages including C, C++, Go, and Rust, across various platforms. + +- Go ([Delve](https://github.com/go-delve/delve)): Delve, a debugger for the Go programming language, offering both local and remote debugging capabilities with full support for Go's runtime and standard library. + +- PHP ([Xdebug](https://xdebug.org/)): Provides debugging and profiling capabilities for PHP applications, including remote debugging and code coverage analysis. + +- Ruby ([rdbg](https://github.com/ruby/debug)): Provides debugging for Ruby. + +These adapters enable Zed to provide a consistent debugging experience across multiple languages while leveraging the specific features and capabilities of each debugger. + +> Is your desired debugger not listed? You can install a [Debug Adapter extension](https://zed.dev/extensions?filter=debug-adapters) to add support for your favorite debugger. +> If that's not enough, you can contribute by creating an extension yourself. Check out our [debugger extensions](extensions/debugger-extensions.md) documentation for more information. + +## Getting Started + +For basic debugging, you can set up a new configuration by opening the `New Session Modal` either via the `debugger: start` (default: f4) or by clicking the plus icon at the top right of the debug panel. + +For more advanced use cases, you can create debug configurations by directly editing the `.zed/debug.json` file in your project root directory. + +You can then use the `New Session Modal` to select a configuration and start debugging. + +### Launching & Attaching + +Zed debugger offers two ways to debug your program; you can either _launch_ a new instance of your program or _attach_ to an existing process. +Which one you choose depends on what you are trying to achieve. + +When launching a new instance, Zed (and the underlying debug adapter) can often do a better job at picking up the debug information compared to attaching to an existing process, since it controls the lifetime of a whole program. +Running unit tests or a debug build of your application is a good use case for launching. + +Compared to launching, attaching to an existing process might seem inferior, but that's far from truth; there are cases where you cannot afford to restart your program, because for example, the bug is not reproducible outside of a production environment or some other circumstances. + +## Configuration + +While configuration fields are debug adapter-dependent, most adapters support the following fields: + +```json +[ + { + // The label for the debug configuration and used to identify the debug session inside the debug panel & new session modal + "label": "Example Start debugger config", + // The debug adapter that Zed should use to debug the program + "adapter": "Example adapter name", + // Request: + // - launch: Zed will launch the program if specified or shows a debug terminal with the right configuration + // - attach: Zed will attach to a running program to debug it or when the process_id is not specified we will show a process picker (only supported for node currently) + "request": "launch", + // program: The program that you want to debug + // This field supports path resolution with ~ or . symbols + "program": "path_to_program", + // cwd: defaults to the current working directory of your project ($ZED_WORKTREE_ROOT) + "cwd": "$ZED_WORKTREE_ROOT" + } +] +``` + +All configuration fields support [task variables](./tasks.md#variables). + +### Build tasks + +Zed also allows embedding a Zed task in a `build` field that is run before the debugger starts. This is useful for setting up the environment or running any necessary setup steps before the debugger starts. + +```json +[ + { + "label": "Build Binary", + "adapter": "CodeLLDB", + "program": "path_to_program", + "request": "launch", + "build": { + "command": "make", + "args": ["build", "-j8"] + } + } +] +``` + +Build tasks can also refer to the existing tasks by unsubstituted label: + +```json +[ + { + "label": "Build Binary", + "adapter": "CodeLLDB", + "program": "path_to_program", + "request": "launch", + "build": "my build task" // Or "my build task for $ZED_FILE" + } +] +``` + +### Automatic scenario creation + +Given a Zed task, Zed can automatically create a scenario for you. Automatic scenario creation also powers our scenario creation from gutter. +Automatic scenario creation is currently supported for Rust, Go, and Python. JavaScript/TypeScript support is being worked on. + +### Example Configurations + +#### JavaScript + +##### Debug Active File + +```json +[ + { + "label": "Debug with node", + "adapter": "JavaScript", + "program": "$ZED_FILE", + "request": "launch", + "console": "integratedTerminal", + "type": "pwa-node" + } +] +``` + +##### Attach debugger to a server running in web browser (`npx serve`) + +Given an externally-ran web server (e.g., with `npx serve` or `npx live-server`) one can attach to it and open it with a browser. + +```json +[ + { + "label": "Inspect ", + "adapter": "JavaScript", + "type": "pwa-chrome", + "request": "launch", + "url": "http://localhost:5500", // Fill your URL here. + "program": "$ZED_FILE", + "webRoot": "${ZED_WORKTREE_ROOT}" + } +] +``` + +#### Python + +##### Debug Active File + +```json +[ + { + "label": "Python Active File", + "adapter": "Debugpy", + "program": "$ZED_FILE", + "request": "launch" + } +] +``` + +##### Flask App + +For a common Flask Application with a file structure similar to the following: + +``` +.venv/ +app/ + init.py + main.py + routes.py +templates/ + index.html +static/ + style.css +requirements.txt +``` + +…the following configuration can be used: + +```json +[ + { + "label": "Python: Flask", + "adapter": "Debugpy", + "request": "launch", + "module": "app", + "cwd": "$ZED_WORKTREE_ROOT", + "env": { + "FLASK_APP": "app", + "FLASK_DEBUG": "1" + }, + "args": [ + "run", + "--reload", // Enables Flask reloader that watches for file changes + "--debugger" // Enables Flask debugger + ], + "autoReload": { + "enable": true + }, + "jinja": true, + "justMyCode": true + } +] +``` + +#### Rust/C++/C + +##### Using pre-built binary + +```json +[ + { + "label": "Debug native binary", + "program": "$ZED_WORKTREE_ROOT/build/binary", + "request": "launch", + "adapter": "CodeLLDB" // GDB is available on non arm macs as well as linux + } +] +``` + +##### Build binary then debug + +```json +[ + { + "label": "Build & Debug native binary", + "build": { + "command": "cargo", + "args": ["build"] + }, + "program": "$ZED_WORKTREE_ROOT/target/debug/binary", + "request": "launch", + "adapter": "CodeLLDB" // GDB is available on non arm macs as well as linux + } +] +``` + +#### TypeScript + +##### Attach debugger to a server running in web browser (`npx serve`) + +Given an externally-ran web server (e.g., with `npx serve` or `npx live-server`) one can attach to it and open it with a browser. + +```json +[ + { + "label": "Launch Chrome (TypeScript)", + "adapter": "JavaScript", + "type": "pwa-chrome", + "request": "launch", + "url": "http://localhost:5500", + "program": "$ZED_FILE", + "webRoot": "${ZED_WORKTREE_ROOT}", + "sourceMaps": true, + "build": { + "command": "npx", + "args": ["tsc"] + } + } +] +``` + +#### Go + +Zed uses [delve](https://github.com/go-delve/delve?tab=readme-ov-file) to debug Go applications. +Zed will automatically create debug scenarios for `func main` in your main packages, and also +for any tests, so you can use the Play button in the gutter to debug these without configuration. + +##### Debug Go Packages + +To debug a specific package, you can do so by setting the Delve mode to "debug". In this case "program" should be set to the package name. + +```json +[ + { + "label": "Go (Delve)", + "adapter": "Delve", + "program": "$ZED_FILE", + "request": "launch", + "mode": "debug" + } +] +``` + +```json +[ + { + "label": "Run server", + "adapter": "Delve", + "request": "launch", + "mode": "debug", + // For Delve, the program can be a package name + "program": "./cmd/server" + // "args": [], + // "buildFlags": [], + } +] +``` + +##### Debug Go Tests + +To debug the tests for a package, set the Delve mode to "test". +The "program" is still the package name, and you can use the "buildFlags" to do things like set tags, and the "args" to set args on the test binary. (See `go help testflags` for more information on doing that). + +```json +[ + { + "label": "Run integration tests", + "adapter": "Delve", + "request": "launch", + "mode": "test", + "program": ".", + "buildFlags": ["-tags", "integration"] + // To filter down to just the test your cursor is in: + // "args": ["-test.run", "$ZED_SYMBOL"] + } +] +``` + +##### Build and debug separately + +If you need to build your application with a specific command, you can use the "exec" mode of Delve. In this case "program" should point to an executable, +and the "build" command should build that. + +```json +{ + "label": "Debug Prebuilt Unit Tests", + "adapter": "Delve", + "request": "launch", + "mode": "exec", + "program": "${ZED_WORKTREE_ROOT}/__debug_unit", + "args": ["-test.v", "-test.run=${ZED_SYMBOL}"], + "build": { + "command": "go", + "args": [ + "test", + "-c", + "-tags", + "unit", + "-gcflags\"all=-N -l\"", + "-o", + "__debug_unit", + "./pkg/..." + ] + } +} +``` + +##### Attaching to an existing instance of Delve + +You might find yourself needing to connect to an existing instance of Delve that's not necessarily running on your machine; in such case, you can use `tcp_arguments` to instrument Zed's connection to Delve. + +``` +{ + "adapter": "Delve", + "label": "Connect to a running Delve instance", + "program": "/Users/zed/Projects/language_repositories/golang/hello/hello", + "cwd": "/Users/zed/Projects/language_repositories/golang/hello", + "args": [], + "env": {}, + "request": "launch", + "mode": "exec", + "stopOnEntry": false, + "tcp_connection": { "host": "123.456.789.012", "port": 53412 } +} +``` + +In such case Zed won't spawn a new instance of Delve, as it opts to use an existing one. The consequence of this is that _there will be no terminal_ in Zed; you have to interact with the Delve instance directly, as it handles stdin/stdout of the debuggee. + +#### Ruby + +To run a ruby task in the debugger, you will need to configure it in the `.zed/debug.json` file in your project. We don't yet have automatic detection of ruby tasks, nor do we support connecting to an existing process. + +The configuration should look like this: + +```json +[ + { + "adapter": "Ruby", + "label": "Run CLI", + "script": "cli.rb" + // If you want to customize how the script is run (for example using bundle exec) + // use "command" instead. + // "command": "bundle exec cli.rb" + // + // "args": [] + // "env": {} + // "cwd": "" + } +] +``` + +## Breakpoints + +To set a breakpoint, simply click next to the line number in the editor gutter. +Breakpoints can be tweaked depending on your needs; to access additional options of a given breakpoint, right-click on the breakpoint icon in the gutter and select the desired option. +At present, you can: + +- Add a log to a breakpoint, which will output a log message whenever that breakpoint is hit. +- Make the breakpoint conditional, which will only stop at the breakpoint when the condition is met. The syntax for conditions is adapter-specific. +- Add a hit count to a breakpoint, which will only stop at the breakpoint after it's hit a certain number of times. +- Disable a breakpoint, which will prevent it from being hit while leaving it visible in the gutter. + +Some debug adapters (e.g. CodeLLDB and JavaScript) will also _verify_ whether your breakpoints can be hit; breakpoints that cannot be hit are surfaced more prominently in the UI. + +All breakpoints enabled for a given project are also listed in "Breakpoints" item in your debugging session UI. From "Breakpoints" item in your UI you can also manage exception breakpoints. +The debug adapter will then stop whenever an exception of a given kind occurs. Which exception types are supported depends on the debug adapter. + +## Settings + +- `dock`: Determines the position of the debug panel in the UI. +- `stepping_granularity`: Determines the stepping granularity. +- `save_breakpoints`: Whether the breakpoints should be reused across Zed sessions. +- `button`: Whether to show the debug button in the status bar. +- `timeout`: Time in milliseconds until timeout error when connecting to a TCP debug adapter. +- `log_dap_communications`: Whether to log messages between active debug adapters and Zed. +- `format_dap_log_messages`: Whether to format DAP messages when adding them to the debug adapter logger. + +### Dock + +- Description: The position of the debug panel in the UI. +- Default: `bottom` +- Setting: debugger.dock + +**Options** + +1. `left` - The debug panel will be docked to the left side of the UI. +2. `right` - The debug panel will be docked to the right side of the UI. +3. `bottom` - The debug panel will be docked to the bottom of the UI. + +```json +"debugger": { + "dock": "bottom" +}, +``` + +### Stepping granularity + +- Description: The Step granularity that the debugger will use +- Default: line +- Setting: debugger.stepping_granularity + +**Options** + +1. Statement - The step should allow the program to run until the current statement has finished executing. + The meaning of a statement is determined by the adapter and it may be considered equivalent to a line. + For example 'for(int i = 0; i < 10; i++)' could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'. + +```json +{ + "debugger": { + "stepping_granularity": "statement" + } +} +``` + +2. Line - The step should allow the program to run until the current source line has executed. + +```json +{ + "debugger": { + "stepping_granularity": "line" + } +} +``` + +3. Instruction - The step should allow one instruction to execute (e.g. one x86 instruction). + +```json +{ + "debugger": { + "stepping_granularity": "instruction" + } +} +``` + +### Save Breakpoints + +- Description: Whether the breakpoints should be saved across Zed sessions. +- Default: true +- Setting: debugger.save_breakpoints + +**Options** + +`boolean` values + +```json +{ + "debugger": { + "save_breakpoints": true + } +} +``` + +### Button + +- Description: Whether the button should be displayed in the debugger toolbar. +- Default: true +- Setting: debugger.show_button + +**Options** + +`boolean` values + +```json +{ + "debugger": { + "show_button": true + } +} +``` + +### Timeout + +- Description: Time in milliseconds until timeout error when connecting to a TCP debug adapter. +- Default: 2000 +- Setting: debugger.timeout + +**Options** + +`integer` values + +```json +{ + "debugger": { + "timeout": 3000 + } +} +``` + +### Log Dap Communications + +- Description: Whether to log messages between active debug adapters and Zed. (Used for DAP development) +- Default: false +- Setting: debugger.log_dap_communications + +**Options** + +`boolean` values + +```json +{ + "debugger": { + "log_dap_communications": true + } +} +``` + +### Format Dap Log Messages + +- Description: Whether to format DAP messages when adding them to the debug adapter logger. (Used for DAP development) +- Default: false +- Setting: debugger.format_dap_log_messages + +**Options** + +`boolean` values + +```json +{ + "debugger": { + "format_dap_log_messages": true + } +} +``` + +### Customizing Debug Adapters + +- Description: Custom program path and arguments to override how Zed launches a specific debug adapter. +- Default: Adapter-specific +- Setting: `dap.$ADAPTER.binary` and `dap.$ADAPTER.args` + +You can pass `binary`, `args`, or both. `binary` should be a path to a _debug adapter_ (like `lldb-dap`) not a _debugger_ (like `lldb` itself). The `args` setting overrides any arguments that Zed would otherwise pass to the adapter. + +```json +{ + "dap": { + "CodeLLDB": { + "binary": "/Users/name/bin/lldb-dap", + "args": ["--wait-for-debugger"] + } + } +} +``` + +## Theme + +The Debugger supports the following theme options: + +- `debugger.accent`: Color used to accent breakpoint & breakpoint-related symbols +- `editor.debugger_active_line.background`: Background color of active debug line + +## Troubleshooting + +If you're running into problems with the debugger, please [open a GitHub issue](https://github.com/zed-industries/zed/issues/new?template=04_bug_debugger.yml) or [schedule an onboarding call](https://cal.com/team/zed-research/debugger) with us so we can help understand and fix your issue. + +There are also some features you can use to gather more information about the problem: + +- When you have a session running in the debug panel, you can run the `dev: copy debug adapter arguments` action to copy a JSON blob to the clipboard that describes how Zed initialized the session. This is especially useful when the session failed to start, and is great context to add if you open a GitHub issue. +- You can also use the `dev: open debug adapter logs` action to see a trace of all of Zed's communications with debug adapters during the most recent debug sessions. diff --git a/docs/src/development/debuggers.md b/docs/src/development/debuggers.md index 4de12f95256febe7dc84e26cd8336dd0cca7588e..1a0efd86d539c1c57dc5132f5728c5c2b8388451 100644 --- a/docs/src/development/debuggers.md +++ b/docs/src/development/debuggers.md @@ -1,32 +1,35 @@ # Using a debugger -> **DISCLAIMER**: This is not documentation for the [planned debugger support in Zed](https://github.com/zed-industries/zed/issues/5065). -> Rather, it is intended to provide information on how to use an external debugger while developing Zed itself to both Zed employees and external contributors. -> Once debugger support is implemented, this section will be updated to provide information on how to use the built-in debugger as part of Zed development. +> **DISCLAIMER**: This is not documentation for [configuring Zed's debugger](../debugger.md). +> Rather, it is intended to provide information on how to use a debugger while developing Zed itself to both Zed employees and external contributors. -## Build profile considerations +## Using Zed's built-in debugger -By default, builds using the dev and release profiles (release is the profile used for production builds, i.e. nightly, preview, and stable) include limited debug info. +While the Zed project is open you can open the `New Process Modal` and select the `Debug` tab. There you can see to debug configurations to debug Zed with, one for GDB and one for LLDB. Select the configuration you want and Zed will build and launch the binary. -This is done by setting the `profile.(release|dev).debug` field in the root `Cargo.toml` field to `"limited"`. +Please note, GDB isn't supported on arm Macbooks + +## Release build profile considerations + +By default, builds using the release profile (release is the profile used for production builds, i.e. nightly, preview, and stable) include limited debug info. + +This is done by setting the `profile.(release).debug` field in the root `Cargo.toml` field to `"limited"`. The official documentation for the `debug` field can be found [here](https://doc.rust-lang.org/cargo/reference/profiles.html#debug). But the TLDR is that `"limited"` strips type and variable level debug info. In release builds, this is done to reduce the binary size, as type and variable level debug info is not required, and does not impact the usability of generated stack traces. -In debug builds, this is done to reduce compilation (especially incremental compilation) time. - However, while the type and variable level debug info is not required for good stack traces, it is very important for a good experience using debuggers, as without the type and variable level debug info, the debugger has no way to resolve local variables, inspect them, format them using pretty-printers, etc. -Therefore, in order to use a debugger to it's fullest extent, you must compile a new Zed binary, with full debug info. +Therefore, in order to use a debugger to it's fullest extent when debugging a release build, you must compile a new Zed binary, with full debug info. The simplest way to do this, is to use the `--config` flag to override the `debug` field in the root `Cargo.toml` file when running `cargo run` or `cargo build` like so: ```sh -cargo run --config 'profile.dev.debug="full"' -cargo build --config 'profile.dev.debug="full"' +cargo run --config 'profile.release.debug="full"' +cargo build --config 'profile.release.debug="full"' ``` > If you wish to avoid passing the `--config` flag on every invocation of `cargo`. You may also change the section in the [root `Cargo.toml`](https://github.com/zed-industries/zed/blob/main/Cargo.toml) @@ -34,22 +37,22 @@ cargo build --config 'profile.dev.debug="full"' > from > > ```toml -> [profile.dev] +> [profile.release] > debug = "limited" > ``` > > to > > ```toml -> [profile.dev] +> [profile.release] > debug = "full" > ``` > -> This will ensure all invocations of `cargo run` or `cargo build` will compile with full debug info. +> This will ensure all invocations of `cargo run --release` or `cargo build --release` will compile with full debug info. > > **WARNING:** Make sure to avoid committing these changes! -## GDB/LLDB +## Running Zed with a shell debugger GDB/LLDB ### Background @@ -73,8 +76,6 @@ If you are unfamiliar with `gdb` or `lldb`, you can learn more about them [here] ### Usage with Zed -#### Running Zed with a Debugger - After following the steps above for including full debug info when compiling Zed, You can either run `rust-gdb` or `rust-lldb` on the compiled Zed binary after building it with `cargo build`, by running one of the following commands: diff --git a/docs/src/development/freebsd.md b/docs/src/development/freebsd.md new file mode 100644 index 0000000000000000000000000000000000000000..33ff9a56d94c3f3882d7465d82f236b463fac7d6 --- /dev/null +++ b/docs/src/development/freebsd.md @@ -0,0 +1,30 @@ +# Building Zed for FreeBSD + +Note, FreeBSD is not currently a supported platform, and so this is a work-in-progress. + +## Repository + +Clone the [Zed repository](https://github.com/zed-industries/zed). + +## Dependencies + +- Install the necessary system packages and rustup: + + ```sh + script/freebsd + ``` + + If preferred, you can inspect [`script/freebsd`](https://github.com/zed-industries/zed/blob/main/script/freebsd) and perform the steps manually. + +--- + +### ⚠️ WebRTC Notice + +Currently, building `webrtc-sys` on FreeBSD fails due to missing upstream support and unavailable prebuilt binaries. +This is actively being worked on. + +More progress and discussion can be found in [Zed’s GitHub Discussions](https://github.com/zed-industries/zed/discussions/29550). + +_Environment: +FreeBSD 14.2-RELEASE +Architecture: amd64 (x86_64)_ diff --git a/docs/src/development/linux.md b/docs/src/development/linux.md index e0c0de6619ab607a60108f25b55db32d2a94e399..08ac7f116bdcb0000bcc734fe8c6a170992af1cf 100644 --- a/docs/src/development/linux.md +++ b/docs/src/development/linux.md @@ -154,9 +154,3 @@ When this zed instance is exited, terminal output will include a command to run ### Cargo errors claiming that a dependency is using unstable features Try `cargo clean` and `cargo build`. - -### Vulkan/GPU issues - -If Zed crashes at runtime due to GPU or vulkan issues, you can try running [vkcube](https://github.com/krh/vkcube) (usually available as part of the `vulkaninfo` package on various distributions) to try to troubleshoot where the issue is coming from. Try running in both X11 and wayland modes by running `vkcube -m [x11|wayland]`. Some versions of `vkcube` use `vkcube` to run in X11 and `vkcube-wayland` to run in wayland. - -If you have multiple GPUs, you can also try running Zed on a different one (for example, with [vkdevicechooser](https://github.com/jiriks74/vkdevicechooser)) to figure out where the issue comes from. diff --git a/docs/src/development/local-collaboration.md b/docs/src/development/local-collaboration.md index 9a8dedf0b5d40910fb353d883d2a70c110546219..6c96c342a872868a0c86495d5772168cc8772f40 100644 --- a/docs/src/development/local-collaboration.md +++ b/docs/src/development/local-collaboration.md @@ -26,7 +26,7 @@ The script will seed the database with various content defined by: cat crates/collab/seed.default.json ``` -To use a different set of admin users, you can create your own version of that json file and export the `SEED_PATH` environment variable. Note that the usernames listed in the admins list currently must correspond to valid Github users. +To use a different set of admin users, you can create your own version of that json file and export the `SEED_PATH` environment variable. Note that the usernames listed in the admins list currently must correspond to valid GitHub users. ```json { diff --git a/docs/src/development/windows.md b/docs/src/development/windows.md index 53404449b6258ce570aa6c9498846d6818c702a5..6d67500aab9f7c65f5a746c1eedc6a004fd3d1aa 100644 --- a/docs/src/development/windows.md +++ b/docs/src/development/windows.md @@ -10,11 +10,13 @@ Clone down the [Zed repository](https://github.com/zed-industries/zed). - Install [rustup](https://www.rust-lang.org/tools/install) -- Install [Visual Studio](https://visualstudio.microsoft.com/downloads/) with the optional components `MSVC v*** - VS YYYY C++ x64/x86 build tools` and `MSVC v*** - VS YYYY C++ x64/x86 Spectre-mitigated libs (latest)` (`v***` is your VS version and `YYYY` is year when your VS was released. Pay attention to the architecture and change it to yours if needed.) +- Install either [Visual Studio](https://visualstudio.microsoft.com/downloads/) with the optional components `MSVC v*** - VS YYYY C++ x64/x86 build tools` and `MSVC v*** - VS YYYY C++ x64/x86 Spectre-mitigated libs (latest)` (`v***` is your VS version and `YYYY` is year when your VS was released. Pay attention to the architecture and change it to yours if needed.) +- Or, if you prefer to have a slimmer installer of only the MSVC compiler tools, you can install the [build tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) (+libs as above) and the "Desktop development with C++" workload. + But beware this installation is not automatically picked up by rustup. You must initialize your environment variables by first launching the "developer" shell (cmd/powershell) this installation places in the start menu or in Windows Terminal and then compile. - Install Windows 11 or 10 SDK depending on your system, but ensure that at least `Windows 10 SDK version 2104 (10.0.20348.0)` is installed on your machine. You can download it from the [Windows SDK Archive](https://developer.microsoft.com/windows/downloads/windows-sdk/) - Install [CMake](https://cmake.org/download) (required by [a dependency](https://docs.rs/wasmtime-c-api-impl/latest/wasmtime_c_api/)). Or you can install it through Visual Studio Installer, then manually add the `bin` directory to your `PATH`, for example: `C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin`. -If you can't compile Zed, make sure that you have at least the following components installed: +If you can't compile Zed, make sure that you have at least the following components installed in case of a Visual Studio installation: ```json { @@ -32,6 +34,32 @@ If you can't compile Zed, make sure that you have at least the following compone } ``` +Or if in case of just Build Tools, the following components: + +```json +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Component.Roslyn.Compiler", + "Microsoft.Component.MSBuild", + "Microsoft.VisualStudio.Component.CoreBuildTools", + "Microsoft.VisualStudio.Workload.MSBuildTools", + "Microsoft.VisualStudio.Component.Windows10SDK", + "Microsoft.VisualStudio.Component.VC.CoreBuildTools", + "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", + "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", + "Microsoft.VisualStudio.Component.Windows11SDK.26100", + "Microsoft.VisualStudio.Component.VC.CMake.Project", + "Microsoft.VisualStudio.Component.TextTemplating", + "Microsoft.VisualStudio.Component.VC.CoreIde", + "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", + "Microsoft.VisualStudio.Workload.VCTools", + "Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre" + ], + "extensions": [] +} +``` + The list can be obtained as follows: - Open the Visual Studio Installer @@ -231,3 +259,23 @@ New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name For more information on this, please see [win32 docs](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell) (note that you will need to restart your system after enabling longpath support) + +### Graphics issues + +#### Zed fails to launch + +Currently, Zed uses Vulkan as its graphics API on Windows. However, Vulkan isn't always the most reliable on Windows, so if Zed fails to launch, it's likely a Vulkan-related issue. + +You can check the Zed log at: +`C:\Users\YOU\AppData\Local\Zed\logs\Zed.log` + +If you see messages like: + +- `Zed failed to open a window: NoSupportedDeviceFound` +- `ERROR_INITIALIZATION_FAILED` +- `GPU Crashed` +- `ERROR_SURFACE_LOST_KHR` + +Then Vulkan might not be working properly on your system. In most cases, updating your GPU drivers may help resolve this. + +If there's nothing Vulkan-related in the logs and you happen to have Bandicam installed, try uninstalling it. Zed is currently not compatible with Bandicam. diff --git a/docs/src/diagnostics.md b/docs/src/diagnostics.md new file mode 100644 index 0000000000000000000000000000000000000000..a015fbebf88b64ebb75941133d3ab21279182685 --- /dev/null +++ b/docs/src/diagnostics.md @@ -0,0 +1,70 @@ +# Diagnostics + +Zed gets its diagnostics from the language servers and supports both push and pull variants of the LSP which makes it compatible with all existing language servers. + +# Regular diagnostics + +By default, Zed displays all diagnostics as underlined text in the editor and the scrollbar. + +Editor diagnostics could be filtered with the + +```json5 +"diagnostics_max_severity": null +``` + +editor setting (possible values: `"off"`, `"error"`, `"warning"`, `"info"`, `"hint"`, `null` (default, all diagnostics)). + +The scrollbar ones are configured with the + +```json5 +"scrollbar": { + "diagnostics": "all", +} +``` + +configuration (possible values: `"none"`, `"error"`, `"warning"`, `"information"`, `"all"` (default)) + +The diagnostics could be hovered to display a tooltip with full, rendered diagnostic message. +Or, `editor::GoToDiagnostic` and `editor::GoToPreviousDiagnostic` could be used to navigate between diagnostics in the editor, showing a popover for the currently active diagnostic. + +# Inline diagnostics (Error lens) + +Zed supports showing diagnostic as lens to the right of the code. +This is disabled by default, but can either be temporarily turned on (or off) using the editor menu, or permanently, using the + +```json5 +"diagnostics": { + "inline": { + "enabled": true, + "max_severity": null, // same values as the `diagnostics_max_severity` from the editor settings + } +} +``` + +# Other UI places + +## Project Panel + +Project panel can have its entries coloured based on the severity of the diagnostics in the file. + +To configure, use + +```json5 +"project_panel": { + "diagnostics": "all", +} +``` + +configuration (possible values: `"off"`, `"errors"`, `"all"` (default)) + +## Editor tabs + +Similar to the project panel, editor tabs can be colorized with the + +```json5 +"tabs": { + "show_diagnostics": "off", +} +``` + +configuration (possible values: `"off"` (default), `"errors"`, `"all"`) diff --git a/docs/src/extensions.md b/docs/src/extensions.md index 25bae742d75705bd061ad6777cc19b9cd12fd17e..5378222e56f3b4a1dfebe83ea03d0ca0b5db5ca1 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -5,6 +5,8 @@ Zed lets you add new functionality using user-defined extensions. - [Installing Extensions](./extensions/installing-extensions.md) - [Developing Extensions](./extensions/developing-extensions.md) - [Developing Language Extensions](./extensions/languages.md) + - [Developing Debugger Extensions](./extensions/debugger-extensions.md) - [Developing Themes](./extensions/themes.md) - [Developing Icon Themes](./extensions/icon-themes.md) - [Developing Slash Commands](./extensions/slash-commands.md) + - [Developing MCP Servers](./extensions/mcp-extensions.md) diff --git a/docs/src/extensions/context-servers.md b/docs/src/extensions/context-servers.md deleted file mode 100644 index bd4c16126b82a18cb9b5a9a325ef61ce176b91ba..0000000000000000000000000000000000000000 --- a/docs/src/extensions/context-servers.md +++ /dev/null @@ -1,39 +0,0 @@ -# Context Servers - -Extensions may provide [context servers](../ai/mcp.md) for use in the Assistant. - -## Example extension - -To see a working example of an extension that provides context servers, check out the [`postgres-context-server` extension](https://github.com/zed-extensions/postgres-context-server). - -This extension can be [installed as a dev extension](./developing-extensions.html#developing-an-extension-locally) if you want to try it out for yourself. - -## Defining context servers - -A given extension may provide one or more context servers. Each context server must be registered in the `extension.toml`: - -```toml -[context_servers.my-context-server] -``` - -Then, in the Rust code for your extension, implement the `context_server_command` method on your extension: - -```rust -impl zed::Extension for MyExtension { - fn context_server_command( - &mut self, - context_server_id: &ContextServerId, - project: &zed::Project, - ) -> Result { - Ok(zed::Command { - command: get_path_to_context_server_executable()?, - args: get_args_for_context_server()?, - env: get_env_for_context_server()?, - }) - } -} -``` - -This method should return the command to start up a context server, along with any arguments or environment variables necessary for it to function. - -If you need to download the context server from an external source—like GitHub Releases or npm—you can also do this here. diff --git a/docs/src/extensions/debugger-extensions.md b/docs/src/extensions/debugger-extensions.md new file mode 100644 index 0000000000000000000000000000000000000000..ad8e2c5e2970c21179d42ea32f9bab4414de4e44 --- /dev/null +++ b/docs/src/extensions/debugger-extensions.md @@ -0,0 +1,117 @@ +# Debugger Extensions + +[Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol) Servers can be exposed as extensions for use in the [debugger](../debugger.md). + +## Defining Debugger Extensions + +A given extension may provide one or more DAP servers. +Each DAP server must be registered in the `extension.toml`: + +```toml +[debug_adapters.my-debug-adapter] +# Optional relative path to the JSON schema for the debug adapter configuration schema. Defaults to `debug_adapter_schemas/$DEBUG_ADAPTER_NAME_ID.json`. +# Note that while this field is optional, a schema is mandatory. +schema_path = "relative/path/to/schema.json" +``` + +Then, in the Rust code for your extension, implement the `get_dap_binary` method on your extension: + +```rust +impl zed::Extension for MyExtension { + fn get_dap_binary( + &mut self, + adapter_name: String, + config: DebugTaskDefinition, + user_provided_debug_adapter_path: Option, + worktree: &Worktree, + ) -> Result; +} +``` + +This method should return the command to start up a debug adapter protocol server, along with any arguments or environment variables necessary for it to function. + +If you need to download the DAP server from an external source—like GitHub Releases or npm—you can also do that in this function. Make sure to check for updates only periodically, as this function is called whenever a user spawns a new debug session with your debug adapter. + +You must also implement `dap_request_kind`. This function is used to determine whether a given debug scenario will _launch_ a new debuggee or _attach_ to an existing one. +We also use it to determine that a given debug scenario requires running a _locator_. + +```rust +impl zed::Extension for MyExtension { + fn dap_request_kind( + &mut self, + _adapter_name: String, + _config: Value, + ) -> Result; +} +``` + +These two functions are sufficient to expose your debug adapter in `debug.json`-based user workflows, but you should strongly consider implementing `dap_config_to_scenario` as well. + +```rust +impl zed::Extension for MyExtension { + fn dap_config_to_scenario( + &mut self, + _adapter_name: DebugConfig, + ) -> Result; +} +``` + +`dap_config_to_scenario` is used when the user spawns a session via new session modal UI. At a high level, it takes a generic debug configuration (that isn't specific to any +debug adapter) and tries to turn it into a concrete debug scenario for your adapter. +Put another way, it is supposed to answer the question: "Given a program, a list of arguments, current working directory and environment variables, what would the configuration for spawning this debug adapter look like?". + +## Defining Debug Locators + +Zed offers an automatic way to create debug scenarios with _debug locators_. +A locator locates the debug target and figures out how to spawn a debug session for it. Thanks to locators, we can automatically convert existing user tasks (e.g. `cargo run`) and convert them into debug scenarios (e.g. `cargo build` followed by spawning a debugger with `target/debug/my_program` as the program to debug). + +> Your extension can define it's own debug locators even if it does not expose a debug adapter. We strongly recommend doing so when your extension already exposes language tasks, as it allows users to spawn a debug session without having to manually configure the debug adapter. + +Locators can (but don't have to) be agnostic to the debug adapter they are used with. They are simply responsible for locating the debug target and figuring out how to spawn a debug session for it. This allows for a more flexible and extensible debugging experience. + +Your extension can define one or more debug locators. Each debug locator must be registered in the `extension.toml`: + +```toml +[debug_locators.my-debug-locator] +``` + +Locators have two components. +First, each locator is ran on each available task to figure out if any of the available locators can provide a debug scenario for a given task. This is done by calling `dap_locator_create_scenario`. + +```rust +impl zed::Extension for MyExtension { + fn dap_locator_create_scenario( + &mut self, + _locator_name: String, + _build_task: TaskTemplate, + _resolved_label: String, + _debug_adapter_name: String, + ) -> Option; +} +``` + +This function should return `Some` debug scenario when that scenario defines a debugging counterpart to a given user task. +Note that a `DebugScenario` can include a [build task](../debugger.md#build-tasks). If there is one, we will execute `run_dap_locator` after a build task is finished successfully. + +```rust +impl zed::Extension for MyExtension { + fn run_dap_locator( + &mut self, + _locator_name: String, + _build_task: TaskTemplate, + ) -> Result; +} +``` + +`run_dap_locator` is useful in case you cannot determine a build target deterministically. Some build systems may produce artifacts whose names are not known up-front. +Note however that you do _not_ need to go through a 2-phase resolution; if you can determine the full debug configuration with just `dap_locator_create_scenario`, you can omit `build` property on a returned `DebugScenario`. Please also note that your locator **will be** called with tasks it's unlikely to accept; thus you should take some effort to return `None` early before performing any expensive operations. + +## Available Extensions + +Check out all the DAP servers that have already been exposed as extensions [on Zed's site](https://zed.dev/extensions?filter=debug-adapters). + +We recommend taking a look at their repositories as a way to understand how they are generally created and structured. + +## Testing + +To test your new Debug Adapter Protocol server extension, you can [install it as a dev extension](./developing-extensions.md#developing-an-extension-locally). diff --git a/docs/src/extensions/developing-extensions.md b/docs/src/extensions/developing-extensions.md index d03aaa5d64ee62270586669a9ae4eddee0273604..97af1f2673ef7f8d8995e9cefbf0351d5b490734 100644 --- a/docs/src/extensions/developing-extensions.md +++ b/docs/src/extensions/developing-extensions.md @@ -5,10 +5,11 @@ Extensions can add the following capabilities to Zed: - [Languages](./languages.md) +- [Debuggers](./debugger-extensions.md) - [Themes](./themes.md) - [Icon Themes](./icon-themes.md) - [Slash Commands](./slash-commands.md) -- [Context Servers](./context-servers.md) +- [MCP Servers](./mcp-extensions.md) ## Developing an Extension Locally @@ -88,12 +89,28 @@ impl zed::Extension for MyExtension { zed::register_extension!(MyExtension); ``` -## Publishing your extension +> `stdout`/`stderr` is forwarded directly to the Zed process. In order to see `println!`/`dbg!` output from your extension, you can start Zed in your terminal with a `--foreground` flag. -To publish an extension, open a PR to [the `zed-industries/extensions` repo](https://github.com/zed-industries/extensions). +## Forking and cloning the repo + +1. Fork the repo > Note: It is very helpful if you fork the `zed-industries/extensions` repo to a personal GitHub account instead of a GitHub organization, as this allows Zed staff to push any needed changes to your PR to expedite the publishing process. +2. Clone the repo to your local machine + +```sh +# Substitute the url of your fork here: +# git clone https://github.com/zed-industries/extensions +cd extensions +git submodule init +git submodule update +``` + +## Publishing your extension + +To publish an extension, open a PR to [the `zed-industries/extensions` repo](https://github.com/zed-industries/extensions). + In your PR, do the following: 1. Add your extension as a Git submodule within the `extensions/` directory @@ -103,6 +120,8 @@ git submodule add https://github.com/your-username/foobar-zed.git extensions/foo git add extensions/foobar ``` +> All extension submodules must use HTTPS URLs and not SSH URLS (`git@github.com`). + 2. Add a new entry to the top-level `extensions.toml` file containing your extension: ```toml diff --git a/docs/src/extensions/languages.md b/docs/src/extensions/languages.md index 257c3ff18b32951b1a3bbddc174a21012e812eb3..44c673e3e131dc433f4598ff69b43e9fe46d28e0 100644 --- a/docs/src/extensions/languages.md +++ b/docs/src/extensions/languages.md @@ -27,6 +27,7 @@ line_comments = ["# "] - `tab_size` defines the indentation/tab size used for this language (default is `4`). - `hard_tabs` whether to indent with tabs (`true`) or spaces (`false`, the default). - `first_line_pattern` is a regular expression, that in addition to `path_suffixes` (above) or `file_types` in settings can be used to match files which should use this language. For example Zed uses this to identify Shell Scripts by matching the [shebangs lines](https://github.com/zed-industries/zed/blob/main/crates/languages/src/bash/config.toml) in the first line of a script. +- `debuggers` is an array of strings that are used to identify debuggers in the language. When launching a debugger's `New Process Modal`, Zed will order available debuggers by the order of entries in this array. @@ -120,7 +134,7 @@ or by simply right clicking and selecting `Copy Permalink` with line(s) selected | {#action git::Branch} | {#kb git::Branch} | | {#action git::Switch} | {#kb git::Switch} | | {#action git::CheckoutBranch} | {#kb git::CheckoutBranch} | -| {#action editor::ToggleGitBlame} | {#kb editor::ToggleGitBlame} | +| {#action git::Blame} | {#kb git::Blame} | | {#action editor::ToggleGitBlameInline} | {#kb editor::ToggleGitBlameInline} | > Not all actions have default keybindings, but can be bound by [customizing your keymap](./key-bindings.md#user-keymaps). diff --git a/docs/src/key-bindings.md b/docs/src/key-bindings.md index 78bf7cc5c574a5c26c8183e79b7a7856721e5851..8a956b518591720bde777a68c0ac587cef712ce2 100644 --- a/docs/src/key-bindings.md +++ b/docs/src/key-bindings.md @@ -18,7 +18,7 @@ You can also enable `vim_mode`, which adds vim bindings too. ## User keymaps -Zed reads your keymap from `~/.zed/keymap.json` on MacOS (or `~/.config/zed/keymap.json` on Linux). You can open the file within Zed with {#kb zed::OpenKeymap}, or via `zed: Open Keymap` in the command palette. +Zed reads your keymap from `~/.config/zed/keymap.json`. You can open the file within Zed with {#kb zed::OpenKeymap}, or via `zed: Open Keymap` in the command palette. The file contains a JSON array of objects with `"bindings"`. If no `"context"` is set the bindings are always active. If it is set the binding is only active when the [context matches](#contexts). @@ -47,7 +47,7 @@ For example: You can see all of Zed's default bindings in the default keymaps for [MacOS](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-macos.json) or [Linux](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-linux.json). -If you want to debug problems with custom keymaps you can use `debug: Open Key Context View` from the command palette. Please file [an issue](https://github.com/zed-industries/zed) if you run into something you think should work but isn't. +If you want to debug problems with custom keymaps you can use `dev: Open Key Context View` from the command palette. Please file [an issue](https://github.com/zed-industries/zed) if you run into something you think should work but isn't. ### Keybinding syntax @@ -62,7 +62,7 @@ Each keypress is a sequence of modifiers followed by a key. The modifiers are: - `fn-` The function key - `secondary-` Equivalent to `cmd` when Zed is running on macOS and `ctrl` when on Windows and Linux -The keys can be any single unicode codepoint that your keyboard generates (for example `a`, `0`, `£` or `ç`), or any named key (`tab`, `f1`, `shift`, or `cmd`). If you are using a non-Latin layout (e.g. Cyrillic), you can bind either to the cyrillic character, or the latin character that that key generates with `cmd` pressed. +The keys can be any single unicode codepoint that your keyboard generates (for example `a`, `0`, `£` or `ç`), or any named key (`tab`, `f1`, `shift`, or `cmd`). If you are using a non-Latin layout (e.g. Cyrillic), you can bind either to the cyrillic character, or the latin character that key generates with `cmd` pressed. A few examples: @@ -85,7 +85,7 @@ It is possible to match against typing a modifier key on its own. For example `s If a binding group has a `"context"` key it will be matched against the currently active contexts in Zed. -Zed's contexts make up a tree, with the root being `Workspace`. Workspaces contain Panes and Panels, and Panes contain Editors, etc. The easiest way to see what contexts are active at a given moment is the key context view, which you can get to with `debug: Open Key Context View` in the command palette. +Zed's contexts make up a tree, with the root being `Workspace`. Workspaces contain Panes and Panels, and Panes contain Editors, etc. The easiest way to see what contexts are active at a given moment is the key context view, which you can get to with `dev: Open Key Context View` in the command palette. Contexts can contain extra attributes in addition to the name, so that you can (for example) match only in markdown files with `"context": "Editor && extension==md"`. It's worth noting that you can only use attributes at the level they are defined. diff --git a/docs/src/languages/ansible.md b/docs/src/languages/ansible.md index 95a1a8e47c5c088f24545afa5c06eb02a6f79758..16b6cef5abffd59072140c0be19c317160f8c582 100644 --- a/docs/src/languages/ansible.md +++ b/docs/src/languages/ansible.md @@ -9,7 +9,7 @@ Support for Ansible in Zed is provided via a community-maintained [Ansible exten ### File detection -By default, to avoid mishandling non-Ansible YAML files, the Ansible Language is not associated with any file extensions by default. To change this behavior you can add a `"file_types"` section to the Zed settings inside your project (`.zed/settings.json`) or your Zed user settings (`~/.config/zed/settings.json`) to match your folder/naming conventions. For example: +To avoid mishandling non-Ansible YAML files, the Ansible Language is not associated with any file extensions by default. To change this behavior you can add a `"file_types"` section to Zed settings inside your project (`.zed/settings.json`) or your Zed user settings (`~/.config/zed/settings.json`) to match your folder/naming conventions. For example: ```json "file_types": { @@ -21,25 +21,83 @@ By default, to avoid mishandling non-Ansible YAML files, the Ansible Language is "**/meta/*.yml", "**/meta/*.yaml", "**/tasks/*.yml", - "**/tasks/*.yml", "**/tasks/*.yaml", "**/handlers/*.yml", "**/handlers/*.yaml", "**/group_vars/*.yml", "**/group_vars/*.yaml", - "**/playbooks/*.yaml", + "**/host_vars/*.yml", + "**/host_vars/*.yaml", "**/playbooks/*.yml", - "**playbook*.yaml", - "**playbook*.yml" + "**/playbooks/*.yaml", + "**playbook*.yml", + "**playbook*.yaml" ] } ``` Feel free to modify this list as per your needs. +#### Inventory + +If your inventory file is in the YAML format, you can either: + +- Append the `ansible-lint` inventory json schema to it via the following comment at the top of your inventory file: + +```yml +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json +``` + +- Or configure the yaml language server settings to set this schema for all your inventory files, that match your inventory pattern, under your Zed settings ([ref](https://zed.dev/docs/languages/yaml)): + +```json +"lsp": { + "yaml-language-server": { + "settings": { + "yaml": { + "schemas": { + "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json": [ + "./inventory/*.yaml", + "hosts.yml", + ] + } + } + } + } +}, +``` + ### LSP Configuration -LSP options for this extension can be configured under Zed's settings file. To get the best experience, add the following configuration under the `"lsp"` section in your `~/.zed/settings.json`: +By default, the following default config is passed to the Ansible language server. It conveniently mirrors the defaults set by [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/blob/03bc581e05e81d33808b42b2d7e76d70adb3b595/lua/lspconfig/configs/ansiblels.lua) for the Ansible language server: + +```json +{ + "ansible": { + "ansible": { + "path": "ansible" + }, + "executionEnvironment": { + "enabled": false + }, + "python": { + "interpreterPath": "python3" + }, + "validation": { + "enabled": true, + "lint": { + "enabled": true, + "path": "ansible-lint" + } + } + } +} +``` + +> [!NOTE] +> In order for linting to work, ensure that `ansible-lint` is installed and discoverable on your PATH + +When desired, any of the above default settings can be overridden under the `"lsp"` section of your Zed settings file. For example: ```json "lsp": { @@ -57,10 +115,9 @@ LSP options for this extension can be configured under Zed's settings file. To g "interpreterPath": "python3" }, "validation": { - "enabled": true, - // To enable linting, manually install ansible-lint and make sure it is your PATH + "enabled": false, // disable validation "lint": { - "enabled": true, + "enabled": false, // disable ansible-lint "path": "ansible-lint" } } @@ -69,7 +126,5 @@ LSP options for this extension can be configured under Zed's settings file. To g } ``` -This config was conveniently adopted from [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/blob/ad32182cc4a03c8826a64e9ced68046c575fdb7d/lua/lspconfig/server_configurations/ansiblels.lua#L6-L23). - A full list of options/settings, that can be passed to the server, can be found at the project's page [here](https://github.com/ansible/vscode-ansible/blob/5a89836d66d470fb9d20e7ea8aa2af96f12f61fb/docs/als/settings.md). Feel free to modify option values as needed. diff --git a/docs/src/languages/c.md b/docs/src/languages/c.md index 42ccc2dff79391341c28e9a7401bd5fa9081406e..ff6b1806601b21608a7e4ec3ed96a0a262df6d9e 100644 --- a/docs/src/languages/c.md +++ b/docs/src/languages/c.md @@ -48,8 +48,6 @@ You can trigger formatting via {#kb editor::Format} or the `editor: format` acti } ``` -See [Clang-Format Style Options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) for a complete list of options. - ## Compile Commands For some projects Clangd requires a `compile_commands.json` file to properly analyze your project. This file contains the compilation database that tells clangd how your project should be built. diff --git a/docs/src/languages/csharp.md b/docs/src/languages/csharp.md index 7fbf2b14379a078c819e21f89f5a972c76bccf37..b422e0941b5dc8cd67028c96eaad0d6249ab45c3 100644 --- a/docs/src/languages/csharp.md +++ b/docs/src/languages/csharp.md @@ -23,17 +23,3 @@ The `OmniSharp` binary can be configured in a Zed settings file with: } } ``` - -If you want to disable Zed looking for a `omnisharp` binary, you can set `ignore_system_version` to `true`: - -```json -{ - "lsp": { - "omnisharp": { - "binary": { - "ignore_system_version": true - } - } - } -} -``` diff --git a/docs/src/languages/css.md b/docs/src/languages/css.md index cf860d1b4f77e26b13b347934a6ad18061578fd6..c31f3578fb78e03b48101c5f0421acf612b24a87 100644 --- a/docs/src/languages/css.md +++ b/docs/src/languages/css.md @@ -1,18 +1,19 @@ # CSS -CSS support is available natively in Zed. +Zed has built-in support for CSS. - Tree-sitter: [tree-sitter/tree-sitter-css](https://github.com/tree-sitter/tree-sitter-css) - Language Servers: - [microsoft/vscode-html-languageservice](https://github.com/microsoft/vscode-html-languageservice) - [tailwindcss-language-server](https://github.com/tailwindlabs/tailwindcss-intellisense) - +## Tailwind CSS -## See also: +Zed also supports [Tailwind CSS](./tailwindcss.md) out-of-the-box for languages and frameworks like JavaScript, Astro, Svelte, and more. + + + +## Recommended Reading - [HTML](./html.md) - [TypeScript](./typescript.md) diff --git a/docs/src/languages/deno.md b/docs/src/languages/deno.md index c578413bbd809f9f529b75e623a44749b62fd0ac..c18b112326ef36cc8fdf535f6ce785b0a9e43275 100644 --- a/docs/src/languages/deno.md +++ b/docs/src/languages/deno.md @@ -20,6 +20,15 @@ To use the Deno Language Server with TypeScript and TSX files, you will likely w } }, "languages": { + "JavaScript": { + "language_servers": [ + "deno", + "!typescript-language-server", + "!vtsls", + "!eslint" + ], + "formatter": "language_server" + }, "TypeScript": { "language_servers": [ "deno", diff --git a/docs/src/languages/helm.md b/docs/src/languages/helm.md index 284a7b92a87ca5aa8efc77997efb6dba8cb731a0..a6e3c8fa49b9056fb9d053790a3f3f656087d366 100644 --- a/docs/src/languages/helm.md +++ b/docs/src/languages/helm.md @@ -16,7 +16,10 @@ Enable Helm language for Helm files by editing your `.zed/settings.json` and add "**/templates/**/*.yaml", "**/templates/**/*.yml", "**/helmfile.d/**/*.yaml", - "**/helmfile.d/**/*.yml" + "**/helmfile.d/**/*.yml", + "**/values*.yaml" ] } ``` + +This will also mark values.yaml files as the type helm, since helm-ls supports this. diff --git a/docs/src/languages/html.md b/docs/src/languages/html.md index 15c0efdd20ed526e0b5fc9266828979d309e2c60..3afa34068d9f9902595e6835951d07fe31de11ca 100644 --- a/docs/src/languages/html.md +++ b/docs/src/languages/html.md @@ -5,9 +5,7 @@ HTML support is available through the [HTML extension](https://github.com/zed-in - Tree-sitter: [tree-sitter/tree-sitter-html](https://github.com/tree-sitter/tree-sitter-html) - Language Server: [microsoft/vscode-html-languageservice](https://github.com/microsoft/vscode-html-languageservice) -This extension is automatically installed. - -If you do not want to use the HTML extension, you can add the following to your settings: +This extension is automatically installed, but if you do not want to use it, you can add the following to your settings: ```json { @@ -19,9 +17,9 @@ If you do not want to use the HTML extension, you can add the following to your ## Formatting -By default Zed uses [Prettier](https://prettier.io/) for formatting HTML +By default Zed uses [Prettier](https://prettier.io/) for formatting HTML. -You can disable `format_on_save` by adding the following to your Zed settings: +You can disable `format_on_save` by adding the following to your Zed `settings.json`: ```json "languages": { @@ -31,11 +29,11 @@ You can disable `format_on_save` by adding the following to your Zed settings: } ``` -You can still trigger formatting manually with {#kb editor::Format} or by opening the command palette ( {#kb commandPalette::Toggle} and selecting `Format Document`. +You can still trigger formatting manually with {#kb editor::Format} or by opening [the Command Palette](..//getting-started.md#command-palette) ({#kb command_palette::Toggle}) and selecting "Format Document". ### LSP Formatting -If you prefer you can use `vscode-html-language-server` instead of Prettier for auto-formatting by adding the following to your Zed settings: +To use the `vscode-html-language-server` language server auto-formatting instead of Prettier, add the following to your Zed settings: ```json "languages": { @@ -45,7 +43,7 @@ If you prefer you can use `vscode-html-language-server` instead of Prettier for } ``` -You can customize various [formatting options](https://code.visualstudio.com/docs/languages/html#_formatting) for `vscode-html-language-server` via Zed settings.json: +You can customize various [formatting options](https://code.visualstudio.com/docs/languages/html#_formatting) for `vscode-html-language-server` via your Zed `settings.json`: ```json "lsp": { @@ -66,7 +64,7 @@ You can customize various [formatting options](https://code.visualstudio.com/doc } ``` -## See also: +## See also - [CSS](./css.md) - [JavaScript](./javascript.md) diff --git a/docs/src/languages/javascript.md b/docs/src/languages/javascript.md index 60f0c1c3bbaea6a3007bba8449db355a009ee247..b42fa31922a1f44a5fed0a7b69a3c9c59543a7fe 100644 --- a/docs/src/languages/javascript.md +++ b/docs/src/languages/javascript.md @@ -7,7 +7,10 @@ JavaScript support is available natively in Zed. ## Code formatting -Formatting on save is enabled by default for JavaScript, using TypeScript's built-in code formatting. But many JavaScript projects use other command-line code-formatting tools, such as [Prettier](https://prettier.io/). You can use one of these tools by specifying an _external_ code formatter for JavaScript in your settings. See the [configuration](../configuring-zed.md) documentation for more information. +Formatting on save is enabled by default for JavaScript, using TypeScript's built-in code formatting. +But many JavaScript projects use other command-line code-formatting tools, such as [Prettier](https://prettier.io/). +You can use one of these tools by specifying an _external_ code formatter for JavaScript in your settings. +See [the configuration docs](../configuring-zed.md) for more information. For example, if you have Prettier installed and on your `PATH`, you can use it to format JavaScript files by adding the following to your `settings.json`: @@ -34,12 +37,12 @@ In JSX strings, the [`tailwindcss-language-server`](./tailwindcss.md) is used pr ## JSDoc -Zed supports JSDoc syntax in JavaScript and TypeScript comments that match the JSDoc syntax. Zed uses [tree-sitter/tree-sitter-jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) for parsing and highlighting JSDoc. +Zed supports JSDoc syntax in JavaScript and TypeScript comments that match the JSDoc syntax. +Zed uses [tree-sitter/tree-sitter-jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) for parsing and highlighting JSDoc. ## ESLint -You can configure Zed to format code using `eslint --fix` by running the ESLint -code action when formatting: +You can configure Zed to format code using `eslint --fix` by running the ESLint code action when formatting: ```json { @@ -77,7 +80,7 @@ You can also only execute a single ESLint rule when using `fixAll`: ``` > **Note:** the other formatter you have configured will still run, after ESLint. -> So if your language server or prettier configuration don't format according to +> So if your language server or Prettier configuration don't format according to > ESLint's rules, then they will overwrite what ESLint fixed and you end up with > errors. diff --git a/docs/src/languages/json.md b/docs/src/languages/json.md index 40615429b284a962c9b6a922c2266f511a882170..94f56999d51a3e2395f481be67d267172ba07075 100644 --- a/docs/src/languages/json.md +++ b/docs/src/languages/json.md @@ -14,7 +14,7 @@ While editing these files you can use `cmd-/` (macOS) or `ctrl-/` (Linux) to tog If you use files with the `*.jsonc` extension when using `Format Document` or have `format_on_save` enabled, Zed invokes Prettier as the formatter. Prettier has an [outstanding issue](https://github.com/prettier/prettier/issues/15956) where it will add trailing commas to files with a `jsonc` extension. JSONC files which have a `.json` extension are unaffected. -To workaround this behavior you can add the following to your `.prettierrc` +To workaround this behavior you can add the following to your `.prettierrc` configuration file: ```json { @@ -32,7 +32,7 @@ To workaround this behavior you can add the following to your `.prettierrc` ## JSON Language Server -Zed automatically out of the box supports JSON Schema validation of `package.json` and `tsconfig.json` files, but `json-language-server` can use JSON Schema definitions in project files, from the [JSON Schema Store](https://www.schemastore.org/json/) or other publicly available URLs for JSON validation. +Zed automatically out of the box supports JSON Schema validation of `package.json` and `tsconfig.json` files, but `json-language-server` can use JSON Schema definitions in project files, from the [JSON Schema Store](https://www.schemastore.org) or other publicly available URLs for JSON validation. ### Inline Schema Specification diff --git a/docs/src/languages/lua.md b/docs/src/languages/lua.md index 4ad143ce41de2767df21c80a7e4da6a9a3016a06..8fdaaafedb80af3c9f466e2fdfd44959364a8789 100644 --- a/docs/src/languages/lua.md +++ b/docs/src/languages/lua.md @@ -86,7 +86,7 @@ Then in your `.luarc.json`: ### Inlay Hints -To enable [Inlay Hints](../configuring-languages#inlay-hints) for LuaLS in Zed +To enable [Inlay Hints](../configuring-languages.md#inlay-hints) for LuaLS in Zed 1. Add the following to your Zed settings.json: @@ -107,9 +107,18 @@ To enable [Inlay Hints](../configuring-languages#inlay-hints) for LuaLS in Zed ## Formatting -### LuaLS +### LuaLS Formatting -To enable auto-formatting with your LuaLS (provided by [CppCXY/EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle)) make sure you have `"format.enable": true,` in your .luarc.json add the following to your Zed `settings.json`: +To enable auto-formatting with your LuaLS (provided by [CppCXY/EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle)) make sure you have `"format.enable": true,` in your .luarc.json: + +```json +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "format.enable": true +} +``` + +Then add the following to your Zed `settings.json`: ```json { @@ -124,7 +133,7 @@ To enable auto-formatting with your LuaLS (provided by [CppCXY/EmmyLuaCodeStyle] You can customize various EmmyLuaCodeStyle style options via `.editorconfig`, see [lua.template.editorconfig](https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/lua.template.editorconfig) for all available options. -### StyLua +### StyLua Formatting Alternatively to use [StyLua](https://github.com/JohnnyMorganz/StyLua) for auto-formatting: diff --git a/docs/src/languages/markdown.md b/docs/src/languages/markdown.md index ef6c4d38f687aae3e67ba025954e4ebc6ee96f99..38a2b1c43f94b91097bcd0b1dc3301427e1b9685 100644 --- a/docs/src/languages/markdown.md +++ b/docs/src/languages/markdown.md @@ -23,7 +23,7 @@ def fib(n): ### Format -Zed supports using Prettier to automatically re-format Markdown documents. You can trigger this manually via the {#action editor::Format} action or via the {#kb editor::Format} keyboard shortcut. Alternately, you can automatically format by enabling [`format_on_save`](./configuring-zed.md#format-on-save) in your settings.json: +Zed supports using Prettier to automatically re-format Markdown documents. You can trigger this manually via the {#action editor::Format} action or via the {#kb editor::Format} keyboard shortcut. Alternately, you can automatically format by enabling [`format_on_save`](../configuring-zed.md#format-on-save) in your settings.json: ```json "languages": { diff --git a/docs/src/languages/powershell.md b/docs/src/languages/powershell.md new file mode 100644 index 0000000000000000000000000000000000000000..d4d706425663c494e66ce0c18d8bf801d94cf910 --- /dev/null +++ b/docs/src/languages/powershell.md @@ -0,0 +1,35 @@ +# PowerShell + +PowerShell language support in Zed is provided by the community-maintained [Zed PowerShell extension](https://github.com/wingyplus/zed-powershell). Please report issues to: [github.com/wingyplus/zed-powershell/issues](https://github.com/wingyplus/zed-powershell/issues) + +- Tree-sitter: [airbus-cert/tree-sitter-powershell](https://github.com/airbus-cert/tree-sitter-powershell) +- Language Server: [PowerShell/PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices) + +## Setup + +### Install PowerShell 7+ {#powershell-install} + +- macOS: `brew install powershell/tap/powershell` +- Alpine: [Installing PowerShell on Alpine Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/install-alpine) +- Debian: [Install PowerShell on Debian Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/install-debian) +- RedHat: [Install PowerShell on RHEL](https://learn.microsoft.com/en-us/powershell/scripting/install/install-rhel) +- Ubuntu: [Install PowerShell on RHEL](https://learn.microsoft.com/en-us/powershell/scripting/install/install-ubuntu) +- Windows: [Install PowerShell on Windows](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows) + +The Zed PowerShell extension will default to the `pwsh` executable found in your path. + +### Install PowerShell Editor Services (Optional) {#powershell-editor-services} + +The Zed PowerShell extensions will attempt to download [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) automatically. + +If want to use a specific binary, you can specify in your that in your Zed settings.json: + +```json + "lsp": { + "powershell-es": { + "binary": { + "path": "/path/to/PowerShellEditorServices" + } + } + } +``` diff --git a/docs/src/languages/python.md b/docs/src/languages/python.md index 2848884316f7336467fd5fec09b42cbf7ba4e49e..05f1491ca73b2adccb04aeca412a2bef9702e22a 100644 --- a/docs/src/languages/python.md +++ b/docs/src/languages/python.md @@ -2,7 +2,7 @@ Python support is available natively in Zed. -- Tree-sitter: [tree-sitter-python](https://github.com/tree-sitter/tree-sitter-python) +- Tree-sitter: [tree-sitter-python](https://github.com/zed-industries/tree-sitter-python) - Language Servers: - [microsoft/pyright](https://github.com/microsoft/pyright) - [python-lsp/python-lsp-server](https://github.com/python-lsp/python-lsp-server) (PyLSP) diff --git a/docs/src/languages/ruby.md b/docs/src/languages/ruby.md index fbc089914025945c6857d8a638aebc5b3f26826b..4c563ca1f41d98f5c9b32fcafe0fd5f151540ed5 100644 --- a/docs/src/languages/ruby.md +++ b/docs/src/languages/ruby.md @@ -21,9 +21,13 @@ There are multiple language servers available for Ruby. Zed supports the two fol They both have an overlapping feature set of autocomplete, diagnostics, code actions, etc. and it's up to you to decide which one you want to use. Note that you can't use both at the same time. -In addition to these two language servers, Zed also supports [rubocop](https://github.com/rubocop/rubocop) which is a static code analyzer and linter for Ruby. Under the hood, it's also used by Zed as a language server, but its functionality is complimentary to that of solargraph and ruby-lsp. +In addition to these two language servers, Zed also supports: -When configuring a language server, it helps to open the LSP Logs window using the 'debug: open language server logs' command. You can then choose the corresponding language instance to see any logged information. +- [rubocop](https://github.com/rubocop/rubocop) which is a static code analyzer and linter for Ruby. Under the hood, it's also used by Zed as a language server, but its functionality is complimentary to that of solargraph and ruby-lsp. +- [sorbet](https://sorbet.org/) which is a static type checker for Ruby with a custom gradual type system. +- [steep](https://github.com/soutaro/steep) which is a static type checker for Ruby that leverages Ruby Signature (RBS). + +When configuring a language server, it helps to open the LSP Logs window using the 'dev: Open Language Server Logs' command. You can then choose the corresponding language instance to see any logged information. ## Configuring a language server @@ -31,7 +35,7 @@ The [Ruby extension](https://github.com/zed-extensions/ruby) offers both `solarg ### Language Server Activation -For all Ruby language servers (`solargraph`, `ruby-lsp`, and `rubocop`), the Ruby extension follows this activation sequence: +For all supported Ruby language servers (`solargraph`, `ruby-lsp`, `rubocop`, `sorbet`, and `steep`), the Ruby extension follows this activation sequence: 1. If the language server is found in your project's `Gemfile`, it will be used through `bundle exec`. 2. If not found in the `Gemfile`, the Ruby extension will look for the executable in your system `PATH`. @@ -188,6 +192,52 @@ Rubocop has unsafe autocorrection disabled by default. We can tell Zed to enable } ``` +## Setting up Sorbet + +[Sorbet](https://sorbet.org/) is a popular static type checker for Ruby that includes a language server. + +To enable Sorbet, add `\"sorbet\"` to the `language_servers` list for Ruby in your `settings.json`. You may want to disable other language servers if Sorbet is intended to be your primary LSP, or if you plan to use it alongside another LSP for specific features like type checking. + +```json +{ + "languages": { + "Ruby": { + "language_servers": [ + "ruby-lsp", + "sorbet", + "!rubocop", + "!solargraph", + "..." + ] + } + } +} +``` + +For all aspects of installing Sorbet, setting it up in your project, and configuring its behavior, please refer to the [official Sorbet documentation](https://sorbet.org/docs/overview). + +## Setting up Steep + +[Steep](https://github.com/soutaro/steep) is a static type checker for Ruby that uses RBS files to define types. + +To enable Steep, add `\"steep\"` to the `language_servers` list for Ruby in your `settings.json`. You may need to adjust the order or disable other LSPs depending on your desired setup. + +```json +{ + "languages": { + "Ruby": { + "language_servers": [ + "ruby-lsp", + "steep", + "!solargraph", + "!rubocop", + "..." + ] + } + } +} +``` + ## Using the Tailwind CSS Language Server with Ruby It's possible to use the [Tailwind CSS Language Server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in Ruby and ERB files. @@ -241,25 +291,36 @@ To run tests in your Ruby project, you can set up custom tasks in your local `.z ```json [ { - "label": "test $ZED_RELATIVE_FILE -n /$ZED_SYMBOL/", - "command": "bin/rails test $ZED_RELATIVE_FILE -n /$ZED_SYMBOL/", + "label": "test $ZED_RELATIVE_FILE -n /$ZED_CUSTOM_RUBY_TEST_NAME/", + "command": "bin/rails", + "args": [ + "test", + "$ZED_RELATIVE_FILE", + "-n", + "\"$ZED_CUSTOM_RUBY_TEST_NAME\"" + ], "tags": ["ruby-test"] } ] ``` -Note: We can't use `args` here because of the way quotes are handled. - ### Minitest -Plain minitest does not support running tests by line number, only by name, so we need to use `$ZED_SYMBOL` instead: +Plain minitest does not support running tests by line number, only by name, so we need to use `$ZED_CUSTOM_RUBY_TEST_NAME` instead: ```json [ { - "label": "-Itest $ZED_RELATIVE_FILE -n /$ZED_SYMBOL/", - "command": "bundle exec ruby", - "args": ["-Itest", "$ZED_RELATIVE_FILE", "-n /$ZED_SYMBOL/"], + "label": "-Itest $ZED_RELATIVE_FILE -n /$ZED_CUSTOM_RUBY_TEST_NAME/", + "command": "bundle", + "args": [ + "exec", + "ruby", + "-Itest", + "$ZED_RELATIVE_FILE", + "-n", + "\"$ZED_CUSTOM_RUBY_TEST_NAME\"" + ], "tags": ["ruby-test"] } ] @@ -271,35 +332,11 @@ Plain minitest does not support running tests by line number, only by name, so w [ { "label": "test $ZED_RELATIVE_FILE:$ZED_ROW", - "command": "bundle exec rspec", - "args": ["\"$ZED_RELATIVE_FILE:$ZED_ROW\""], + "command": "bundle", + "args": ["exec", "rspec", "\"$ZED_RELATIVE_FILE:$ZED_ROW\""], "tags": ["ruby-test"] } ] ``` -### quickdraw - -```json -[ - { - "label": "test $ZED_RELATIVE_FILE:$ZED_ROW", - "command": "bundle exec qt", - "args": ["\"$ZED_RELATIVE_FILE:$ZED_ROW\""], - "tags": ["ruby-test"] - } -] -``` - -### tldr - -```json -[ - { - "label": "test $ZED_RELATIVE_FILE:$ZED_ROW", - "command": "bundle exec tldr", - "args": ["\"$ZED_RELATIVE_FILE:$ZED_ROW\""], - "tags": ["ruby-test"] - } -] -``` +Similar task syntax can be used for other test frameworks such as `quickdraw` or `tldr`. diff --git a/docs/src/languages/rust.md b/docs/src/languages/rust.md index 9cd92471d190d7ca81631e594746fd1da3533108..ea6f6912cd863e82e9866595554e5ce609fa1133 100644 --- a/docs/src/languages/rust.md +++ b/docs/src/languages/rust.md @@ -78,7 +78,7 @@ If you want to disable Zed looking for a `rust-analyzer` binary, you can set `ig } ``` -If you want to use a binary in a custom location, you can specify a `path` and optional `args`: +If you want to use a binary in a custom location, you can specify a `path` and optional `arguments`: ```json { @@ -86,7 +86,7 @@ If you want to use a binary in a custom location, you can specify a `path` and o "rust-analyzer": { "binary": { "path": "/Users/example/bin/rust-analyzer", - "args": [] + "arguments": [] } } } diff --git a/docs/src/languages/sh.md b/docs/src/languages/sh.md index c4d3957d5748435b16d40ecd4f66193f599f7fc6..abc8f03a6c051d9484052aad3ea0e453d9fb4fdc 100644 --- a/docs/src/languages/sh.md +++ b/docs/src/languages/sh.md @@ -19,7 +19,7 @@ You can configure various settings for Shell Scripts in your Zed User Settings ( ### Formatting -Zed supports auto-formatting Shell Scripts using external tools like [`shfmt`](https://github.com/patrickvane/shfmt). +Zed supports auto-formatting Shell Scripts using external tools like [`shfmt`](https://github.com/mvdan/sh). 1. Install `shfmt`: diff --git a/docs/src/languages/sql.md b/docs/src/languages/sql.md new file mode 100644 index 0000000000000000000000000000000000000000..7993450a04c788494116bbd259af84c12d9b0dfc --- /dev/null +++ b/docs/src/languages/sql.md @@ -0,0 +1,68 @@ +# SQL + +SQL files are handled by the [SQL Extension](https://github.com/zed-extensions/sql). + +- Tree-sitter: [nervenes/tree-sitter-sql](https://github.com/nervenes/tree-sitter-sql) + +### Formatting + +Zed supports auto-formatting SQL using external tools like [`sql-formatter`](https://github.com/sql-formatter-org/sql-formatter). + +1. Install `sql-formatter`: + +```sh +npm install -g sql-formatter +``` + +2. Ensure `sql-formatter` is available in your path and check the version: + +```sh +which sql-formatter +sql-formatter --version +``` + +3. Configure Zed to automatically format SQL with `sql-formatter`: + +```json + "languages": { + "SQL": { + "formatter": { + "external": { + "command": "sql-formatter", + "arguments": ["--language", "mysql"] + } + } + } + }, +``` + +Substitute your preferred [SQL Dialect] for `mysql` above (`duckdb`, `hive`, `mariadb`, `postgresql`, `redshift`, `snowflake`, `sqlite`, `spark`, etc). + +You can add this to Zed project settings (`.zed/settings.json`) or via your Zed user settings (`~/.config/zed/settings.json`). + +### Advanced Formatting + +Sql-formatter also allows more precise control by providing [sql-formatter configuration options](https://github.com/sql-formatter-org/sql-formatter#configuration-options). To provide these, create a `.sql-formatter.json` file in your project: + +```json +{ + "language": "postgresql", + "tabWidth": 2, + "keywordCase": "upper", + "linesBetweenQueries": 2 +} +``` + +When using a `.sql-formatter.json` file you can use a more simplified set of Zed settings since the language need not be specified inline: + +```json + "languages": { + "SQL": { + "formatter": { + "external": { + "command": "sql-formatter" + } + } + } + }, +``` diff --git a/docs/src/languages/svelte.md b/docs/src/languages/svelte.md index e52e7c98926023073e21f9f6e9a0d7592f9b024e..66d0d0cb50611c765a751552ece6620251daf28c 100644 --- a/docs/src/languages/svelte.md +++ b/docs/src/languages/svelte.md @@ -7,7 +7,7 @@ Svelte support is available through the [Svelte extension](https://github.com/ze ## Extra theme styling configuration -You can modify how certain styles such as directives and modifiers appear in attributes: +You can modify how certain styles, such as directives and modifiers, appear in attributes: ```json "syntax": { @@ -24,7 +24,7 @@ You can modify how certain styles such as directives and modifiers appear in att ## Inlay Hints -Zed sets the following initialization options for inlay hints: +When inlay hints is enabled in Zed, to make the language server send them back, Zed sets the following initialization options: ```json "inlayHints": { @@ -51,9 +51,7 @@ Zed sets the following initialization options for inlay hints: } ``` -to make the language server send back inlay hints when Zed has them enabled in the settings. - -Use +To override these settings, use the following: ```json "lsp": { @@ -72,6 +70,4 @@ Use } ``` -to override these settings. - -See https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/package.json for more information. +See [the TypeScript language server `package.json`](https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/package.json) for more information. diff --git a/docs/src/languages/swift.md b/docs/src/languages/swift.md index c3d5cfaa1a579455d3ef4fb9b354df63f7471199..9b056be5bc8869b18b78e9a2e64ea43db3d8ea90 100644 --- a/docs/src/languages/swift.md +++ b/docs/src/languages/swift.md @@ -5,7 +5,34 @@ Report issues to: [https://github.com/zed-extensions/swift/issues](https://githu - Tree-sitter: [alex-pinkus/tree-sitter-swift](https://github.com/alex-pinkus/tree-sitter-swift) - Language Server: [swiftlang/sourcekit-lsp](https://github.com/swiftlang/sourcekit-lsp) +- Debug Adapter: [`lldb-dap`](https://github.com/swiftlang/llvm-project/blob/next/lldb/tools/lldb-dap/README.md) -## Configuration +## Language Server Configuration You can modify the behavior of SourceKit LSP by creating a `.sourcekit-lsp/config.json` under your home directory or in your project root. See [SourceKit-LSP configuration file](https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Configuration%20File.md) for complete documentation. + +## Debugging + +The Swift extension provides a debug adapter for debugging Swift code. +Zed's name for the adapter (in the UI and `debug.json`) is `Swift`, and under the hood it uses [`lldb-dap`](https://github.com/swiftlang/llvm-project/blob/next/lldb/tools/lldb-dap/README.md), as provided by the Swift toolchain. +The extension tries to find an `lldb-dap` binary using `swiftly`, using `xcrun`, and by searching `$PATH`, in that order of preference. +The extension doesn't attempt to download `lldb-dap` if it's not found. + +### Examples + +#### Build and debug a Swift binary + +```json +[ + { + "label": "Debug Swift", + "build": { + "command": "swift", + "args": ["build"] + }, + "program": "$ZED_WORKTREE_ROOT/swift-app/.build/arm64-apple-macosx/debug/swift-app", + "request": "launch", + "adapter": "Swift" + } +] +``` diff --git a/docs/src/languages/tailwindcss.md b/docs/src/languages/tailwindcss.md index 5f2117466f9d69cb567e9630875bffff7c2a5515..bf15829b4f6704240166b97dd6ba1c290428b80b 100644 --- a/docs/src/languages/tailwindcss.md +++ b/docs/src/languages/tailwindcss.md @@ -1,6 +1,6 @@ # Tailwind CSS -Tailwind CSS support is built into Zed. +Zed has built-in support for Tailwind CSS autocomplete, linting, and hover previews. - Language Server: [tailwindlabs/tailwindcss-intellisense](https://github.com/tailwindlabs/tailwindcss-intellisense) @@ -22,3 +22,14 @@ Languages which can be used with Tailwind CSS in Zed: - [PHP](./php.md) - [Svelte](./svelte.md) - [Vue](./vue.md) + +### Prettier Plugin + +Zed supports Prettier out of the box, which means that if you have the [Tailwind CSS Prettier plugin](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) installed, adding it to your Prettier configuration will make it work automatically: + +```json +// .prettierrc +{ + "plugins": ["prettier-plugin-tailwindcss"] +} +``` diff --git a/docs/src/languages/typescript.md b/docs/src/languages/typescript.md index d14210febffeb21995f460109876c9733ab9b6b2..8e6a437cdb0722a9c45e20cb4d1a5b6f76a4562d 100644 --- a/docs/src/languages/typescript.md +++ b/docs/src/languages/typescript.md @@ -12,7 +12,7 @@ TBD: Document the difference between Language servers ## Language servers -By default Zed uses [vtsls](https://github.com/yioneko/vtsls) for TypeScript, TSX and JavaScript files. +By default Zed uses [vtsls](https://github.com/yioneko/vtsls) for TypeScript, TSX, and JavaScript files. You can configure the use of [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server) per language in your settings file: ```json @@ -65,12 +65,9 @@ Prettier will also be used for TypeScript files by default. To disable this: ## Inlay Hints -Zed sets the following initialization options to make the language server send back inlay hints -(that is, when Zed has inlay hints enabled in the settings). +Zed sets the following initialization options to make the language server send back inlay hints (that is, when Zed has inlay hints enabled in the settings). -You can override these settings in your Zed settings file. - -When using `typescript-language-server`: +You can override these settings in your Zed `settings.json` when using `typescript-language-server`: ```json { diff --git a/docs/src/languages/yaml.md b/docs/src/languages/yaml.md index bb11a9181d2aa3bed16b67fd39217248267c5fc3..68167e873430970f2a871065da740659965e2df1 100644 --- a/docs/src/languages/yaml.md +++ b/docs/src/languages/yaml.md @@ -32,11 +32,11 @@ Note, settings keys must be nested, so `yaml.keyOrdering` becomes `{"yaml": { "k ## Formatting -By default Zed will use prettier for formatting YAML files. +By default, Zed uses Prettier for formatting YAML files. ### Prettier Formatting -You can customize the formatting behavior of Prettier. For example to use single-quotes in yaml files add the following to a `.prettierrc`: +You can customize the formatting behavior of Prettier. For example to use single-quotes in yaml files add the following to your `.prettierrc` configuration file: ```json { @@ -53,7 +53,7 @@ You can customize the formatting behavior of Prettier. For example to use single ### yaml-language-server Formatting -To use `yaml-language-server` instead of Prettier for YAML formatting, add the following to your Zed settings.json: +To use `yaml-language-server` instead of Prettier for YAML formatting, add the following to your Zed `settings.json`: ```json "languages": { diff --git a/docs/src/linux.md b/docs/src/linux.md index 6bc1e28c4176b68a9b677ac8dcab21e5b29d3655..ca65da29695c71659650edad8fde60523b4fd029 100644 --- a/docs/src/linux.md +++ b/docs/src/linux.md @@ -49,7 +49,8 @@ There are several third-party Zed packages for various Linux distributions and p - ALT Linux (Sisyphus): [`zed`](https://packages.altlinux.org/en/sisyphus/srpms/zed/) - AOSC OS: [`zed`](https://packages.aosc.io/packages/zed) - openSUSE Tumbleweed: [`zed`](https://en.opensuse.org/Zed) -- Please add others to this list! + +See [Repology](https://repology.org/project/zed-editor/versions) for a list of Zed packages in various repositories. When installing a third-party package please be aware that it may not be completely up to date and may be slightly different from the Zed we package (a common change is to rename the binary to `zedit` or `zeditor` to avoid conflicting with other packages). @@ -125,16 +126,18 @@ If you see an error like "/lib64/libc.so.6: version 'GLIBC_2.29' not found" it m ### Graphics issues -### Zed fails to open windows +#### Zed fails to open windows Zed requires a GPU to run effectively. Under the hood, we use [Vulkan](https://www.vulkan.org/) to communicate with your GPU. If you are seeing problems with performance, or Zed fails to load, it is possible that Vulkan is the culprit. -If you see a notification saying `Zed failed to open a window: NoSupportedDeviceFound` this means that Vulkan cannot find a compatible GPU. You can begin troubleshooting Vulkan by installing the `vulkan-tools` package and running: +If you see a notification saying `Zed failed to open a window: NoSupportedDeviceFound` this means that Vulkan cannot find a compatible GPU. you can try running [vkcube](https://github.com/krh/vkcube) (usually available as part of the `vulkaninfo` or `vulkan-tools` package on various distributions) to try to troubleshoot where the issue is coming from like so: -```sh +``` vkcube ``` +> **_Note_**: Try running in both X11 and wayland modes by running `vkcube -m [x11|wayland]`. Some versions of `vkcube` use `vkcube` to run in X11 and `vkcube-wayland` to run in wayland. + This should output a line describing your current graphics setup and show a rotating cube. If this does not work, you should be able to fix it by installing Vulkan compatible GPU drivers, however in some cases (for example running Linux on an Arm-based MacBook) there is no Vulkan support yet. You can find out which graphics card Zed is using by looking in the Zed log (`~/.local/share/zed/logs/Zed.log`) for `Using GPU: ...`. @@ -146,16 +149,89 @@ On some systems the file `/etc/prime-discrete` can be used to enforce the use of On others, you may be able to the environment variable `DRI_PRIME=1` when running Zed to force the use of the discrete GPU. If you're using an AMD GPU and Zed crashes when selecting long lines, try setting the `ZED_PATH_SAMPLE_COUNT=0` environment variable. (See [#26143](https://github.com/zed-industries/zed/issues/26143)) -If you're using an AMD GPU, you might get a 'Broken Pipe' error. Try using the RADV or Mesa drivers. (See [#13880](https://github.com/zed-industries/zed/issues/13880)) -If you are using Mesa, and want more control over which GPU is selected you can run `MESA_VK_DEVICE_SELECT=list zed --foreground` to get a list of available GPUs and then export `MESA_VK_DEVICE_SELECT=xxxx:yyyy` to choose a specific device. +If you're using an AMD GPU, you might get a 'Broken Pipe' error. Try using the RADV or Mesa drivers. (See [#13880](https://github.com/zed-industries/zed/issues/13880)) If you are using `amdvlk` you may find that zed only opens when run with `sudo $(which zed)`. To fix this, remove the `amdvlk` and `lib32-amdvlk` packages and install mesa/vulkan instead. ([#14141](https://github.com/zed-industries/zed/issues/14141)). For more information, the [Arch guide to Vulkan](https://wiki.archlinux.org/title/Vulkan) has some good steps that translate well to most distributions. +#### Forcing Zed to use a specific GPU + +There are a few different ways to force Zed to use a specific GPU: + +##### Option A + +You can use the `ZED_DEVICE_ID={device_id}` environment variable to specify the device ID of the GPU you wish to have Zed use. + +You can obtain the device ID of your GPU by running `lspci -nn | grep VGA` which will output each GPU on one line like: + +``` +08:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA104 [GeForce RTX 3070] [10de:2484] (rev a1) +``` + +where the device ID here is `2484`. This value is in hexadecimal, so to force Zed to use this specific GPU you would set the environment variable like so: + +``` +ZED_DEVICE_ID=0x2484 zed +``` + +Make sure to export the variable if you choose to define it globally in a `.bashrc` or similar. + +##### Option B + +If you are using Mesa, you can run `MESA_VK_DEVICE_SELECT=list zed --foreground` to get a list of available GPUs and then export `MESA_VK_DEVICE_SELECT=xxxx:yyyy` to choose a specific device. + +##### Option C + +Using [vkdevicechooser](https://github.com/jiriks74/vkdevicechooser). + +#### Reporting graphics issues + If Vulkan is configured correctly, and Zed is still not working for you, please [file an issue](https://github.com/zed-industries/zed) with as much information as possible. +When reporting issues where Zed fails to start due to graphics initialization errors on GitHub, it can be impossible to run the `zed: copy system specs into clipboard` command like we instruct you to in our issue template. We provide an alternative way to collect the system specs specifically for this situation. + +Passing the `--system-specs` flag to Zed like + +```sh +zed --system-specs +``` + +will print the system specs to the terminal like so. It is strongly recommended to copy the output verbatim into the issue on GitHub, as it uses markdown formatting to ensure the output is readable. + +Additionally, it is extremely beneficial to provide the contents of your Zed log when reporting such issues. The log is usually located at `~/.local/share/zed/logs/Zed.log`. The recommended process for producing a helpful log file is as follows: + +```sh +truncate -s 0 ~/.local/share/zed/logs/Zed.log # Clear the log file +ZED_LOG=blade_graphics=info zed . +cat ~/.local/share/zed/logs/Zed.log +# copy the output +``` + +Or, if you have the Zed cli setup, you can do + +```sh +ZED_LOG=blade_graphics=info /path/to/zed/cli --foreground . +# copy the output +``` + +It is also highly recommended when pasting the log into a github issue, to do so with the following template: + +> **_Note_**: The whitespace in the template is important, and will cause incorrect formatting if not preserved. + +```` +
Zed Log + +``` +{zed log contents} +``` + +
+```` + +This will cause the logs to be collapsed by default, making it easier to read the issue. + ### I can't open any files ### Clicking links isn't working diff --git a/docs/src/remote-development.md b/docs/src/remote-development.md index 7738442c5e3596aa8ce0fad5b271dce3194b8543..e597e7a6c5743f47947bba1b3a068e497ee51faa 100644 --- a/docs/src/remote-development.md +++ b/docs/src/remote-development.md @@ -158,6 +158,8 @@ Depending on the kind of setting you want to make, which settings file you shoul - Server settings should be used for things that affect the server: paths to language servers, etc. - Local settings should be used for things that affect the UI: font size, etc. +In addition any extensions you have installed locally will be propagated to the remote server. This means that language servers, etc. will run correctly. + ## Initializing the remote server Once you provide the SSH options, Zed shells out to `ssh` on your local machine to create a ControlMaster connection with the options you provide. @@ -168,7 +170,7 @@ Once the master connection is established, Zed will check to see if the remote s If it is not there or the version mismatches, Zed will try to download the latest version. By default, it will download from `https://zed.dev` directly, but if you set: `{"upload_binary_over_ssh":true}` in your settings for that server, it will download the binary to your local machine and then upload it to the remote server. -If you'd like to maintain the server binary yourself you can. You can either download our prebuilt versions from [Github](https://github.com/zed-industries/zed/releases), or [build your own](https://zed.dev/docs/development) with `cargo build -p remote_server --release`. If you do this, you must upload it to `~/.zed_server/zed-remote-server-{RELEASE_CHANNEL}-{VERSION}` on the server, for example `~/.zed_server/zed-remote-server-stable-0.181.6`. The version must exactly match the version of Zed itself you are using. +If you'd like to maintain the server binary yourself you can. You can either download our prebuilt versions from [GitHub](https://github.com/zed-industries/zed/releases), or [build your own](https://zed.dev/docs/development) with `cargo build -p remote_server --release`. If you do this, you must upload it to `~/.zed_server/zed-remote-server-{RELEASE_CHANNEL}-{VERSION}` on the server, for example `~/.zed_server/zed-remote-server-stable-0.181.6`. The version must exactly match the version of Zed itself you are using. ## Maintaining the SSH connection @@ -200,7 +202,6 @@ Note that we deliberately disallow some options (for example `-t` or `-T`) that ## Known Limitations -- Zed extensions are not yet supported on remotes, so languages that need them for support do not work. - You can't open files from the remote Terminal by typing the `zed` command. ## Feedback diff --git a/docs/src/system-requirements.md b/docs/src/system-requirements.md index fd96bd7c47b77601d7bd3ed3d9d3e508d4421eb4..46c559c507acc27ebe30094adc99bdaf28f8e0b8 100644 --- a/docs/src/system-requirements.md +++ b/docs/src/system-requirements.md @@ -45,6 +45,10 @@ Zed requires a Vulkan 1.3 driver, and the following desktop portals: Not yet available as an official download. Can be built [from source](./development/windows.md). +## FreeBSD + +Not yet available as an official download. Can be built [from source](./development/freebsd.md). + ## Web Not supported at this time. See our [Platform Support issue](https://github.com/zed-industries/zed/issues/5391). diff --git a/docs/src/tasks.md b/docs/src/tasks.md index 557bedb118927434156c6c864c2fa34467f1d4e4..95505634327c297b795846cceea63d70aa068008 100644 --- a/docs/src/tasks.md +++ b/docs/src/tasks.md @@ -80,6 +80,7 @@ These variables allow you to pull information from the current editor and use it - `ZED_FILENAME`: filename of the currently opened file (e.g. `main.rs`) - `ZED_DIRNAME`: absolute path of the currently opened file with file name stripped (e.g. `/Users/my-user/path/to/project/src`) - `ZED_RELATIVE_FILE`: path of the currently opened file, relative to `ZED_WORKTREE_ROOT` (e.g. `src/main.rs`) +- `ZED_RELATIVE_DIR`: path of the currently opened file's directory, relative to `ZED_WORKTREE_ROOT` (e.g. `src`) - `ZED_STEM`: stem (filename without extension) of the currently opened file (e.g. `main`) - `ZED_SYMBOL`: currently selected symbol; should match the last symbol shown in a symbol breadcrumb (e.g. `mod tests > fn test_task_contexts`) - `ZED_SELECTED_TEXT`: currently selected text diff --git a/docs/src/vim.md b/docs/src/vim.md index f5c2367f7c46f2a89a4991fbc4e91dbd1d1c8f7b..a1c79b531da21533ba6467ae46f65d3eba4bbeb8 100644 --- a/docs/src/vim.md +++ b/docs/src/vim.md @@ -288,6 +288,7 @@ These ex commands open Zed's various panels and windows. | Open the chat panel | `:Ch[at]` | | Open the AI panel | `:A[I]` | | Open the git panel | `:G[it]` | +| Open the debug panel | `:D[ebug]` | | Open the notifications panel | `:No[tif]` | | Open the feedback window | `:fe[edback]` | | Open the diagnostics window | `:cl[ist]` | @@ -547,6 +548,7 @@ If you're using vim mode on Linux or Windows, you may find it overrides keybindi "ctrl-y": "editor::Undo", // vim default: line up "ctrl-f": "buffer_search::Deploy", // vim default: page down "ctrl-o": "workspace::Open", // vim default: go back + "ctrl-s": "workspace::Save", // vim default: show signature "ctrl-a": "editor::SelectAll", // vim default: increment } }, @@ -560,7 +562,7 @@ You can change the following settings to modify vim mode's behavior: | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | default_mode | The default mode to start in. One of "normal", "insert", "replace", "visual", "visual_line", "visual_block", "helix_normal". | "normal" | | use_system_clipboard | Determines how system clipboard is used:
  • "always": use for all operations
  • "never": only use when explicitly specified
  • "on_yank": use for yank operations
| "always" | -| use_multiline_find | If `true`, `f` and `t` motions extend across multiple lines. | false | +| use_multiline_find | deprecated | | use_smartcase_find | If `true`, `f` and `t` motions are case-insensitive when the target letter is lowercase. | false | | toggle_relative_line_numbers | If `true`, line numbers are relative in normal mode and absolute in insert mode, giving you the best of both options. | false | | custom_digraphs | An object that allows you to add custom digraphs. Read below for an example. | {} | @@ -585,7 +587,6 @@ Here's an example of these settings changed: "vim": { "default_mode": "insert", "use_system_clipboard": "never", - "use_multiline_find": true, "use_smartcase_find": true, "toggle_relative_line_numbers": true, "highlight_on_yank_duration": 50, diff --git a/docs/src/visual-customization.md b/docs/src/visual-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..e68e7ffabf52a6fc1ae88dedfd8abf89342fc453 --- /dev/null +++ b/docs/src/visual-customization.md @@ -0,0 +1,544 @@ +# Visual Customization + +Various aspects of Zed's visual layout can be configured via Zed settings.json which you can access via {#action zed::OpenSettings} ({#kb zed::OpenSettings}). + +See [Configuring Zed](./configuring-zed.md) for additional information and other non-visual settings. + +## Themes + +Use may install zed extensions providing [Themes](./themes.md) and [Icon Themes](./icon-themes.md) via {#action zed::Extensions} from the command palette or menu. + +You can preview/choose amongsts your installed themes and icon themes with {#action theme_selector::Toggle} ({#kb theme_selector::Toggle}) and ({#action icon_theme_selector::Toggle}) which will modify the following settings: + +```json +{ + "theme": "One Dark", + "icon_theme": "Zed (Default)" +} +``` + +If you would like to use distinct themes for light mode/dark mode that can be set with: + +```json +{ + "theme": { + "dark": "One Dark" + "light": "One Light", + // Mode to use (dark, light) or "system" to follow the OS's light/dark mode (default) + "mode": "system", + }, + "icon_theme": { + "dark": "Zed (Default)" + "light": "Zed (Default)", + // Mode to use (dark, light) or "system" to follow the OS's light/dark mode (default) + "mode": "system", + } +} +``` + +## Fonts + +```json + // UI Font. Use ".SystemUIFont" to use the default system font (SF Pro on macOS) + "ui_font_family": "Zed Plex Sans", + "ui_font_weight": 400, // Font weight in standard CSS units from 100 to 900. + "ui_font_size": 16, + + // Buffer Font - Used by editor buffers + "buffer_font_family": "Zed Plex Mono", // Font name for editor buffers + "buffer_font_size": 15, // Font size for editor buffers + "buffer_font_weight": 400, // Font weight in CSS units [100-900] + // Line height "comfortable" (1.618), "standard" (1.3) or custom: `{ "custom": 2 }` + "buffer_line_height": "comfortable", + + // Terminal Font Settings + "terminal": { + "font_family": "Zed Plex Mono", + "font_size": 15, + // Terminal line height: comfortable (1.618), standard(1.3) or `{ "custom": 2 }` + "line_height": "comfortable", + }, + + // Agent Panel Font Settings + "agent_font_size": 15 +``` + +### Font ligatures + +By default Zed enable font ligatures which will visually combines certain adjacent characters. + +For example `=>` will be displayed as `→` and `!=` will be `≠`. This is purely cosmetic and the individual characters remain unchanged. + +To disable this behavior use: + +```json +{ + "buffer_font_features": { + "calt": false // Disable ligatures + } +} +``` + +### Status Bar + +```json +{ + // Whether to show full labels in line indicator or short ones + // - `short`: "2 s, 15 l, 32 c" + // - `long`: "2 selections, 15 lines, 32 characters" + "line_indicator_format": "long" + + // Individual status bar icons can be hidden: + // "project_panel": {"button": false }, + // "outline_panel": {"button": false }, + // "collaboration_panel": {"button": false }, + // "chat_panel": {"button": "never" }, + // "git_panel": {"button": false }, + // "notification_panel": {"button": false }, + // "agent": {"button": false }, + // "debugger": {"button": false }, + // "diagnostics": {"button": false }, + // "search": {"button": false }, +} +``` + +### Titlebar + +```json + // Control which items are shown/hidden in the title bar + "title_bar": { + "show_branch_icon": false, // Show/hide branch icon beside branch switcher + "show_branch_name": true, // Show/hide branch name + "show_project_items": true, // Show/hide project host and name + "show_onboarding_banner": true, // Show/hide onboarding banners + "show_user_picture": true, // Show/hide user avatar + "show_sign_in": true // Show/hide sign-in button + }, +``` + +## Workspace + +```json +{ + // Force usage of Zed build in path prompts (file and directory pickers) + // instead of OS native pickers (false). + "use_system_path_prompts": true, + // Force usage of Zed built in confirmation prompts ("Do you want to save?") + // instead of OS native prompts (false). On linux this is ignored (always false). + "use_system_prompts": true, + + // Whether to use the system provided dialogs for Open and Save As (true) or + // Zed's built-in keyboard-first pickers (false) + "use_system_path_prompts": true, + + // Active pane styling settings. + "active_pane_modifiers": { + // Inset border size of the active pane, in pixels. + "border_size": 0.0, + // Opacity of the inactive panes. 0 means transparent, 1 means opaque. + "inactive_opacity": 1.0 + }, + + // Layout mode of the bottom dock: contained, full, left_aligned, right_aligned + "bottom_dock_layout": "contained", + + // Whether to resize all the panels in a dock when resizing the dock. + // Can be a combination of "left", "right" and "bottom". + "resize_all_panels_in_dock": ["left"] +} +``` + + + +## Editor + +```json + // Whether the cursor blinks in the editor. + "cursor_blink": true, + + // Cursor shape for the default editor: bar, block, underline, hollow + "cursor_shape": null, + + // Highlight the current line in the editor: none, gutter, line, all + "current_line_highlight": "all", + + // When does the mouse cursor hide: never, on_typing, on_typing_and_movement + "hide_mouse": "on_typing_and_movement", + + // Whether to highlight all occurrences of the selected text in an editor. + "selection_highlight": true, + + // Visually show tabs and spaces (none, all, selection, boundary, trailing) + "show_whitespaces": "selection", + + "unnecessary_code_fade": 0.3, // How much to fade out unused code. + + // Hide the values of in variables from visual display in private files + "redact_private_values": false, + + // Soft-wrap and rulers + "soft_wrap": "none", // none, editor_width, preferred_line_length, bounded + "preferred_line_length": 80, // Column to soft-wrap + "show_wrap_guides": true, // Show/hide wrap guides (vertical rulers) + "wrap_guides": [], // Where to position wrap_guides (character counts) + + // Gutter Settings + "gutter": { + "line_numbers": true, // Show/hide line numbers in the gutter. + "runnables": true, // Show/hide runnables buttons in the gutter. + "breakpoints": true, // Show/hide show breakpoints in the gutter. + "folds": true, // Show/hide show fold buttons in the gutter. + "min_line_number_digits": 4 // Reserve space for N digit line numbers + }, + "relative_line_numbers": false, // Show relative line numbers in gutter + + // Indent guides + "indent_guides": { + "enabled": true, + "line_width": 1, // Width of guides in pixels [1-10] + "active_line_width": 1, // Width of active guide in pixels [1-10] + "coloring": "fixed", // disabled, fixed, indent_aware + "background_coloring": "disabled" // disabled, indent_aware + } +``` + +### Git Blame {#editor-blame} + +```json + "git": { + "inline_blame": { + "enabled": true, // Show/hide inline blame + "delay": 0, // Show after delay (ms) + "min_column": 0, // Minimum column to inline display blame + "show_commit_summary": false // Show/hide commit summary + }, + "hunk_style": "staged_hollow" // staged_hollow, unstaged_hollow + } +``` + +### Editor Toolbar + +```json + // Editor toolbar related settings + "toolbar": { + "breadcrumbs": true, // Whether to show breadcrumbs. + "quick_actions": true, // Whether to show quick action buttons. + "selections_menu": true, // Whether to show the Selections menu + "agent_review": true, // Whether to show agent review buttons + "code_actions": false // Whether to show code action buttons + } +``` + +### Editor Scrollbar and Minimap {#editor-scrollbar} + +```json + // Scrollbar related settings + "scrollbar": { + // When to show the scrollbar in the editor (auto, system, always, never) + "show": "auto", + "cursors": true, // Show cursor positions in the scrollbar. + "git_diff": true, // Show git diff indicators in the scrollbar. + "search_results": true, // Show buffer search results in the scrollbar. + "selected_text": true, // Show selected text occurrences in the scrollbar. + "selected_symbol": true, // Show selected symbol occurrences in the scrollbar. + "diagnostics": "all", // Show diagnostics (none, error, warning, information, all) + "axes": { + "horizontal": true, // Show/hide the horizontal scrollbar + "vertical": true // Show/hide the vertical scrollbar + } + }, + + // Minimap related settings + "minimap": { + "show": "never", // When to show (auto, always, never) + "display_in": "active_editor", // Where to show (active_editor, all_editor) + "thumb": "always", // When to show thumb (always, hover) + "thumb_border": "left_open", // Thumb border (left_open, right_open, full, none) + "max_width_columns": 80 // Maximum width of minimap + "current_line_highlight": null // Highlight current line (null, line, gutter) + }, + + // Control Editor scroll beyond the last line: off, one_page, vertical_scroll_margin + "scroll_beyond_last_line": "one_page", + // Lines to keep above/below the cursor when scrolling with the keyboard + "vertical_scroll_margin": 3, + // The number of characters to keep on either side when scrolling with the mouse + "horizontal_scroll_margin": 5, + // Scroll sensitivity multiplier + "scroll_sensitivity": 1.0, + // Scroll sensitivity multiplier for fast scrolling (hold alt while scrolling) + "fast_scroll_sensitivity": 4.0, +``` + +### Editor Tabs + +```json + // Maximum number of tabs per pane. Unset for unlimited. + "max_tabs": null, + + // Customize the tab bar appearance + "tab_bar": { + "show": true, // Show/hide the tab bar + "show_nav_history_buttons": true, // Show/hide history buttons on tab bar + "show_tab_bar_buttons": true // Show hide buttons (new, split, zoom) + }, + "tabs": { + "git_status": false, // Color to show git status + "close_position": "right", // Close button position (left, right, hidden) + "show_close_button": "hover", // Close button shown (hover, always, hidden) + "file_icons": false, // Icon showing file type + // Show diagnostics in file icon (off, errors, all). Requires file_icons=true + "show_diagnostics": "off" + } +``` + +### Multibuffer + +```json +{ + // The default number of lines to expand excerpts in the multibuffer by. + "expand_excerpt_lines": 5 +} +``` + +### Editor Completions, Snippets, Actions, Diagnostics {#editor-lsp} + +```json + "snippet_sort_order": "inline", // Snippets completions: top, inline, bottom + "show_completions_on_input": true, // Show completions while typing + "show_completion_documentation": true, // Show documentation in completions + "auto_signature_help": false, // Show method signatures inside parentheses + + // Whether to show the signature help after completion or a bracket pair inserted. + // If `auto_signature_help` is enabled, this setting will be treated as enabled also. + "show_signature_help_after_edits": false, + + // Whether to show code action button at start of buffer line. + "inline_code_actions": true, + + // Which level to use to filter out diagnostics displayed in the editor: + "diagnostics_max_severity": null, // off, error, warning, info, hint, null (all) + + // How to render LSP `textDocument/documentColor` colors in the editor. + "lsp_document_colors": "inlay", // none, inlay, border, background +``` + +### Edit Predictions {#editor-ai} + +```json + "edit_predictions": { + "mode": "eager", // Automatically show (eager) or hold-alt (subtle) + "enabled_in_text_threads": true // Show/hide predictions in agent text threads + }, + "show_edit_predictions": true // Show/hide predictions in editor +``` + +### Editor Inlay Hints + +```json +{ + "inlay_hints": { + "enabled": false, + // Toggle certain types of hints on and off, all switched on by default. + "show_type_hints": true, + "show_parameter_hints": true, + "show_other_hints": true, + + // Whether to show a background for inlay hints (theme `hint.background`) + "show_background": false, // + + // Time to wait after editing before requesting hints (0 to disable debounce) + "edit_debounce_ms": 700, + // Time to wait after scrolling before requesting hints (0 to disable debounce) + "scroll_debounce_ms": 50, + + // A set of modifiers which, when pressed, will toggle the visibility of inlay hints. + "toggle_on_modifiers_press": { + "control": false, + "shift": false, + "alt": false, + "platform": false, + "function": false + } + } +} +``` + +## File Finder + +```json + // File Finder Settings + "file_finder": { + "file_icons": true, // Show/hide file icons + "modal_max_width": "small", // Horizontal size: small, medium, large, xlarge, full + "git_status": true, // Show the git status for each entry + "include_ignored": null // gitignored files in results: true, false, null + }, +``` + +## Project Panel + +Project panel can be shown/hidden with {#action project_panel::ToggleFocus} ({#kb project_panel::ToggleFocus}) or with {#action pane::RevealInProjectPanel} ({#kb pane::RevealInProjectPanel}). + +```json + // Project Panel Settings + "project_panel": { + "button": true, // Show/hide button in the status bar + "default_width": 240, // Default panel width + "dock": "left", // Position of the dock (left, right) + "entry_spacing": "comfortable", // Vertical spacing (comfortable, standard) + "file_icons": true, // Show/hide file icons + "folder_icons": true, // Show/hide folder icons + "git_status": true, // Indicate new/updated files + "indent_size": 20, // Pixels for each successive indent + "auto_reveal_entries": true, // Show file in panel when activating its buffer + "auto_fold_dirs": true, // Fold dirs with single subdir + "scrollbar": { // Project panel scrollbar settings + "show": null // Show/hide: (auto, system, always, never) + }, + "show_diagnostics": "all", // + // Settings related to indent guides in the project panel. + "indent_guides": { + // When to show indent guides in the project panel. (always, never) + "show": "always" + }, + // Whether to hide the root entry when only one folder is open in the window. + "hide_root": false + }. +``` + +## Agent Panel + +```json + "agent": { + "version": "2", + "enabled": true, // Enable/disable the agent + "button": true, // Show/hide the icon in the status bar + "dock": "right", // Where to dock: left, right, bottom + "default_width": 640, // Default width (left/right docked) + "default_height": 320, // Default height (bottom dockeed) + }, + "agent_font_size": 16 +``` + +See [Zed AI Documentation](./ai/overview.md) for additional non-visual AI settings. + +## Terminal Panel + +```json + // Terminal Panel Settings + "terminal": { + "dock": "bottom", // Where to dock: left, right, bottom + "button": true, // Show/hide status bar icon + "default_width": 640, // Default width (left/right docked) + "default_height": 320, // Default height (bottom dockeed) + + // Set the cursor blinking behavior in the terminal (on, off, terminal_controlled) + "blinking": "terminal_controlled", + // Default cursor shape for the terminal (block, bar, underline, hollow) + "cursor_shape": "block", + + // Environment variables to add to terminal's process environment + "env": { + // "KEY": "value" + }, + + // Terminal scrollbar + "scrollbar": { + "show": null // Show/hide: (auto, system, always, never) + }, + // Terminal Font Settings + "font_family": "Zed Plex Mono", + "font_size": 15, + "font_weight": 400, + // Terminal line height: comfortable (1.618), standard(1.3) or `{ "custom": 2 }` + "line_height": "comfortable", + + "max_scroll_history_lines": 10000, // Scrollback history (0=disable, max=100000) + } +``` + +See [Terminal settings](./configuring-zed.md#terminal) for additional non-visual customization options. + +### Other Panels + +```json + // Git Panel + "git_panel": { + "button": true, // Show/hide status bar icon + "dock": "left", // Where to dock: left, right + "default_width": 360, // Default width of the git panel. + "status_style": "icon", // label_color, icon + "sort_by_path": false, // Sort by path (false) or status (true) + "scrollbar": { + "show": null // Show/hide: (auto, system, always, never) + } + }, + + // Debugger Panel + "debugger": { + "dock": "bottom", // Where to dock: left, right, bottom + "button": true // Show/hide status bar icon + }, + + // Outline Panel + "outline_panel": { + "button": true, // Show/hide status bar icon + "default_width": 300, // Default width of the git panel + "dock": "left", // Where to dock: left, right + "file_icons": true, // Show/hide file_icons + "folder_icons": true, // Show file_icons (true), chevrons (false) for dirs + "git_status": true, // Show git status + "indent_size": 20, // Indentation for nested items (pixels) + "indent_guides": { + "show": "always" // Show indent guides (always, never) + }, + "auto_reveal_entries": true, // Show file in panel when activating its buffer + "auto_fold_dirs": true, // Fold dirs with single subdir + "scrollbar": { // Project panel scrollbar settings + "show": null // Show/hide: (auto, system, always, never) + } + } +``` + +## Collaboration Panels + +```json +{ + // Collaboration Panel + "collaboration_panel": { + "button": true, // Show/hide status bar icon + "dock": "left", // Where to dock: left, right + "default_width": 240 // Default width of the collaboration panel. + }, + "show_call_status_icon": true, // Shown call status in the OS status bar. + + // Chat Panel + "chat_panel": { + "button": "when_in_call", // status bar icon (true, false, when_in_call) + "dock": "right", // Where to dock: left, right + "default_width": 240 // Default width of the chat panel + }, + + // Notification Panel + "notification_panel": { + // Whether to show the notification panel button in the status bar. + "button": true, + // Where to dock the notification panel. Can be 'left' or 'right'. + "dock": "right", + // Default width of the notification panel. + "default_width": 380 + } +``` diff --git a/docs/src/workspace-persistence.md b/docs/src/workspace-persistence.md index e2ff232a627eeb740291e91957ee3280b06e1bc1..9e87e2743427c8db249ac174bd17a076a4a2fdea 100644 --- a/docs/src/workspace-persistence.md +++ b/docs/src/workspace-persistence.md @@ -3,7 +3,7 @@ Zed creates local SQLite databases to persist data relating to its workspace and your projects. These databases store, for instance, the tabs and panes you have open in a project, the scroll position of each open file, the list of all projects you've opened (for the recent projects modal picker), etc. You can find and explore these databases in the following locations: - macOS: `~/Library/Application Support/Zed` -- Linux: `~/.local/share/Zed` +- Linux and FreeBSD: `~/.local/share/zed` (or within `XDG_DATA_HOME` or `FLATPAK_XDG_DATA_HOME`) - Windows: `%LOCALAPPDATA%\Zed` The naming convention of these databases takes on the form of `0-`: @@ -12,3 +12,20 @@ The naming convention of these databases takes on the form of `0-`: - Preview: `0-preview` **If you encounter workspace persistence issues in Zed, deleting the database and restarting Zed often resolves the problem, as the database may have been corrupted at some point.** If your issue continues after restarting Zed and regenerating a new database, please [file an issue](https://github.com/zed-industries/zed/issues/new?template=10_bug_report.yml). + +## Settings + +You can customize workspace restoration behavior with the following settings: + +```json +{ + // Workspace restoration behavior. + // All workspaces ("last_session"), last workspace ("last_workspace") or "none" + "restore_on_startup": "last_session", + // Whether to attempt to restore previous file's state when opening it again. + // E.g. for editors, selections, folds and scroll positions are restored + "restore_on_file_reopen": true, + // Whether to automatically close files that have been deleted on disk. + "close_on_file_delete": false +} +``` diff --git a/docs/theme/css/chrome.css b/docs/theme/css/chrome.css index 8e5c286a067b01face7c884082cabbde62270dc8..c66982a2126373c2c4e27503e5b69eeceb56f92b 100644 --- a/docs/theme/css/chrome.css +++ b/docs/theme/css/chrome.css @@ -177,34 +177,35 @@ a > .hljs { display: none; } -.nav-wrapper { - margin-block-start: 50px; - display: block; -} - -.nav-buttons { +.footer-buttons { display: flex; justify-content: space-between; align-items: center; - margin: 20px 0; - padding: 0 10px; + gap: 1rem; + padding: 24px 0; } -.nav-button { +.footer-button { + width: 100%; + padding: 12px; + display: flex; align-items: center; - padding: 8px 12px; - background-color: var(--bg); - color: var(--fg) !important; - text-decoration: none; + justify-content: center; + gap: 0.5rem; + background-color: var(--footer-btn-bg); + border: 1px solid var(--footer-btn-border); + border-radius: 0.5rem; + font-size: 0.9em; } -.nav-button:hover { - background-color: var(--theme-hover); - color: var(--icons-hover) !important; +.footer-button:hover { + background-color: var(--footer-btn-bg-hover); + border-color: var(--footer-btn-border-hover); } -.nav-button i { - padding: 0 6px; +.footer-button i { + text-decoration: underline !important; + text-decoration-color: transparent !important; } .mobile-nav-chapters { diff --git a/docs/theme/css/variables.css b/docs/theme/css/variables.css index bd3b42522e0f59a6c632839f86d24461b1e3274f..1fe0e7dc8514d46acf202c6c995a7f50f5acab2b 100644 --- a/docs/theme/css/variables.css +++ b/docs/theme/css/variables.css @@ -86,6 +86,11 @@ --download-btn-border: hsla(220, 60%, 40%, 0.2); --download-btn-border-hover: hsla(220, 60%, 50%, 0.2); --download-btn-shadow: hsla(220, 40%, 60%, 0.1); + + --footer-btn-bg: hsl(220, 60%, 98%, 0.4); + --footer-btn-bg-hover: hsl(220, 60%, 93%, 0.5); + --footer-btn-border: hsla(220, 60%, 40%, 0.15); + --footer-btn-border-hover: hsla(220, 60%, 50%, 0.2); } .dark { @@ -160,4 +165,9 @@ --download-btn-border: hsla(220, 90%, 80%, 0.2); --download-btn-border-hover: hsla(220, 90%, 80%, 0.4); --download-btn-shadow: hsla(220, 50%, 60%, 0.15); + + --footer-btn-bg: hsl(220, 90%, 95%, 0.01); + --footer-btn-bg-hover: hsl(220, 90%, 50%, 0.05); + --footer-btn-border: hsla(220, 90%, 90%, 0.05); + --footer-btn-border-hover: hsla(220, 90%, 80%, 0.2); } diff --git a/docs/theme/index.hbs b/docs/theme/index.hbs index cc999ad4b5ff8fb942ce7668d480488447c1f0dc..8ab4f21cf167668ef3fb2f905dafb6b57496b88e 100644 --- a/docs/theme/index.hbs +++ b/docs/theme/index.hbs @@ -199,24 +199,21 @@ {{{ content }}} +
- - - diff --git a/docs/theme/page-toc.js b/docs/theme/page-toc.js index 62af2e7dc438a51c350faed04a0df62a3371d98f..647a3810586b694582ac4a912b56092338324d2f 100644 --- a/docs/theme/page-toc.js +++ b/docs/theme/page-toc.js @@ -59,6 +59,19 @@ const updateFunction = () => { window.addEventListener("load", () => { const pagetoc = getPagetoc(); const headers = [...document.getElementsByClassName("header")]; + + const nonH1Headers = headers.filter( + (header) => !header.parentElement.tagName.toLowerCase().startsWith("h1"), + ); + const sidetoc = document.querySelector(".sidetoc"); + + if (nonH1Headers.length === 0) { + if (sidetoc) { + sidetoc.style.display = "none"; + } + return; + } + headers.forEach((header) => { const link = Object.assign(document.createElement("a"), { textContent: header.text, diff --git a/extensions/glsl/languages/glsl/config.toml b/extensions/glsl/languages/glsl/config.toml index 72353cfbf524c5a8519990eb56c707c5be843e41..0144e981cc4d446192c4e433c6c5cc2c3929bb4a 100644 --- a/extensions/glsl/languages/glsl/config.toml +++ b/extensions/glsl/languages/glsl/config.toml @@ -10,6 +10,7 @@ path_suffixes = [ # Other "glsl" ] +first_line_pattern = '^#version \d+' line_comments = ["// "] block_comment = ["/* ", " */"] brackets = [ diff --git a/extensions/toml/Cargo.toml b/extensions/toml/Cargo.toml index 0a87337ddab77721f77df149aa82bf0f180adb77..25c2c418084dc89fe4c402c1abe13d5535bf6447 100644 --- a/extensions/toml/Cargo.toml +++ b/extensions/toml/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zed_toml" -version = "0.1.3" +version = "0.1.4" edition.workspace = true publish.workspace = true license = "Apache-2.0" diff --git a/extensions/toml/extension.toml b/extensions/toml/extension.toml index a608eb1c86cb6f8aedd6749bb90090d87db573a7..5be7213c40362ec4bbeba8cb0846a507d9ec9e7e 100644 --- a/extensions/toml/extension.toml +++ b/extensions/toml/extension.toml @@ -1,7 +1,7 @@ id = "toml" name = "TOML" description = "TOML support." -version = "0.1.3" +version = "0.1.4" schema_version = 1 authors = [ "Max Brunsfeld ", diff --git a/extensions/toml/src/toml.rs b/extensions/toml/src/toml.rs index 66057904b739821f94e01b033cd1e87fae946fd9..20f27b6d97ee2793d00152aacc37997be6f404a9 100644 --- a/extensions/toml/src/toml.rs +++ b/extensions/toml/src/toml.rs @@ -62,7 +62,7 @@ impl TomlExtension { let (platform, arch) = zed::current_platform(); let asset_name = format!( - "taplo-full-{os}-{arch}.gz", + "taplo-{os}-{arch}.gz", arch = match arch { zed::Architecture::Aarch64 => "aarch64", zed::Architecture::X86 => "x86", diff --git a/flake.lock b/flake.lock index c09eb90d2defe0c3134d06fbf9060115d66949de..fa0d51d90de9a6a9929241f6be212ea32e1432a2 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1742394900, - "narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=", + "lastModified": 1750266157, + "narHash": "sha256-tL42YoNg9y30u7zAqtoGDNdTyXTi8EALDeCB13FtbQA=", "owner": "ipetkov", "repo": "crane", - "rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd", + "rev": "e37c943371b73ed87faf33f7583860f81f1d5a48", "type": "github" }, "original": { @@ -17,11 +17,11 @@ }, "flake-compat": { "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "type": "github" }, "original": { @@ -32,18 +32,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1743095683, - "narHash": "sha256-gWd4urRoLRe8GLVC/3rYRae1h+xfQzt09xOfb0PaHSk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5e5402ecbcb27af32284d4a62553c019a3a49ea6", - "type": "github" + "lastModified": 315532800, + "narHash": "sha256-j+zO+IHQ7VwEam0pjPExdbLT2rVioyVS3iq4bLO3GEc=", + "rev": "61c0f513911459945e2cb8bf333dc849f1b976ff", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-25.11pre821324.61c0f5139114/nixexprs.tar.xz" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz" } }, "root": { @@ -61,11 +58,11 @@ ] }, "locked": { - "lastModified": 1743906877, - "narHash": "sha256-Thah1oU8Vy0gs9bh5QhNcQh1iuQiowMnZPbrkURonZA=", + "lastModified": 1750964660, + "narHash": "sha256-YQ6EyFetjH1uy5JhdhRdPe6cuNXlYpMAQePFfZj4W7M=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9d00c6b69408dd40d067603012938d9fbe95cfcd", + "rev": "04f0fcfb1a50c63529805a798b4b5c21610ff390", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 834b9aa9f2f3c649c679fcba18b3807829b447bd..fe7a09701beb714506742f2712cb3a74b676bc19 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "High-performance, multiplayer code editor from the creators of Atom and Tree-sitter"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; @@ -55,10 +55,12 @@ nixConfig = { extra-substituters = [ - "https://zed-industries.cachix.org" + "https://zed.cachix.org" + "https://cache.garnix.io" ]; extra-trusted-public-keys = [ - "zed-industries.cachix.org-1:QW3RoXK0Lm4ycmU5/3bmYRd3MLf4RbTGPqRulGlX5W0=" + "zed.cachix.org-1:/pHQ6dpMsAZk2DiP4WCL0p9YDNKWj2Q5FL20bNmw1cU=" + "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; }; } diff --git a/legal/terms.md b/legal/terms.md index 20fc638dc5c7b6bd5f38f483b2b8a421fbf54f43..88afa36aa9cb17c55b1b2fe50a26893c4e5a3389 100644 --- a/legal/terms.md +++ b/legal/terms.md @@ -94,11 +94,11 @@ Output is provided "as is" without any warranties or guarantees of functionality When using Zed AI Services to provide Edit Predictions in connection with certain open source software projects, You may elect to share requests, responses and feedback comments (collectively "Model Improvement Feedback") with Zed, and Zed may use the same to improve Zed Edit Predictions models. You may opt-out of sharing Model Improvement Feedback at any time. -For more information on Zed Edit Predictions please see: [https://zed.dev/docs/ai-improvement](https://zed.dev/docs/ai-improvement) +For more information on Zed Edit Predictions please see: [https://zed.dev/docs/ai/ai-improvement](https://zed.dev/docs/ai/ai-improvement) When using Zed AI Services in connection with the Agent Panel, You may elect to share with Zed requests, responses and feedback regarding the Agent Panel and related Output (the “Agent Improvement Feedback”) with Zed, and Zed may use the same to improve the Agent Panel and related Output. Zed will only collect Agent Improvement Feedback when You elect to share the same. -For more information regarding the Agent Panel please see: [https://zed.dev/docs/ai-improvement](https://zed.dev/docs/ai-improvement) +For more information regarding the Agent Panel please see: [https://zed.dev/docs/ai/ai-improvement](https://zed.dev/docs/ai/ai-improvement) #### 3.4. Privacy Policy diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 0000000000000000000000000000000000000000..a769ae3b201bad4ef9743f3dbcca3dcc06e75b2d --- /dev/null +++ b/lychee.toml @@ -0,0 +1,29 @@ +retry_wait_time = 5 + +accept = ["200..=204", "429"] + +max_retries = 5 + +timeout = 45 + +exclude = [ + # Don't fail CI check if collab is down + 'https://staging-collab.zed.dev/', + "https://collab.zed.dev", + + # Slow and unreliable server. + 'https://repology.org', + + # The following websites are rate limited or use bot detection and aren't nice enough to respond with 429: + 'https://openai.com', + 'https://claude.ai/download', + 'https://www.perplexity.ai', + 'https://platform.deepseek.com', + 'https://console.anthropic.com', + 'https://platform.openai.com', + 'https://linux.die.net/man/1/sed', + 'https://allaboutcookies.org', + 'https://www.gnu.org', + 'https://auth.mistral.ai', + 'https://console.mistral.ai', +] diff --git a/nix/build.nix b/nix/build.nix index 21ff060afb27b13e4fd11e142740ab587d9414d7..873431a42768d86b28ce43f0202da713dae5ef52 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -191,6 +191,8 @@ let wayland ] }"; + + NIX_OUTPATH_USED_AS_RANDOM_SEED = "norebuilds"; }; # prevent nix from removing the "unused" wayland/gpu-lib rpaths @@ -278,7 +280,9 @@ craneLib.buildPackage ( mkdir -p $out/bin $out/libexec cp $TARGET_DIR/zed $out/libexec/zed-editor - cp $TARGET_DIR/cli $out/bin/zed + cp $TARGET_DIR/cli $out/bin/zed + ln -s $out/bin/zed $out/bin/zeditor # home-manager expects the CLI binary to be here + install -D "crates/zed/resources/app-icon-nightly@2x.png" \ "$out/share/icons/hicolor/1024x1024@2x/apps/zed.png" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f819e3b78ed376ec0fdf62aa5e6ae443a0b43b42..f80eab8fbcbd78e5bbf3bf4e8757bc6872146e1b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,12 +1,13 @@ [toolchain] -channel = "1.86" +channel = "1.88" profile = "minimal" components = [ "rustfmt", "clippy" ] targets = [ "x86_64-apple-darwin", "aarch64-apple-darwin", + "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", - "wasm32-wasip1", # extensions + "wasm32-wasip2", # extensions "x86_64-unknown-linux-musl", # remote server ] diff --git a/script/bootstrap b/script/bootstrap index 454daf46e27f108180685a79dd511b95bce8bfb7..68888e04c1e70bfcb831cf873b7017765ac2dd82 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -2,6 +2,12 @@ set -e +# if root or if sudo/unavailable, define an empty variable +if [ "$(id -u)" -eq 0 ] +then maysudo='' +else maysudo="$(command -v sudo || command -v doas || true)" +fi + if [[ "$OSTYPE" == "linux-gnu"* ]]; then echo "Linux dependencies..." script/linux @@ -10,6 +16,27 @@ else which foreman > /dev/null || brew install foreman fi +# Install minio if needed +if ! which minio > /dev/null; then + if command -v brew > /dev/null; then + echo "minio not found. Installing via brew" + brew install minio/stable/minio + elif command -v apt > /dev/null; then + echo "minio not found. Installing via apt from https://dl.min.io/server/minio/release/linux-amd64/minio.deb" + wget -q https://dl.min.io/server/minio/release/linux-amd64/minio.deb -O /tmp/minio.deb + $maysudo apt install /tmp/minio.deb + rm -f /tmp/minio.deb + elif command -v dnf > /dev/null; then + echo "minio not found. Installing via dnf from https://dl.min.io/server/minio/release/linux-amd64/minio.rpm" + wget -q https://dl.min.io/server/minio/release/linux-amd64/minio.rpm -O /tmp/minio.rpm + $maysudo dnf install /tmp/minio.rpm + rm -f /tmp/minio.rpm + else + echo "No supported package manager found (brew, apt, or dnf)" + exit 1 + fi +fi + # Install sqlx-cli if needed if ! [[ "$(command -v sqlx)" && "$(sqlx --version)" == "sqlx-cli 0.7.2" ]]; then echo "sqlx-cli not found or not the required version, installing version 0.7.2..." diff --git a/script/bump-zed-minor-versions b/script/bump-zed-minor-versions index 4e59b293ff6ab0a9d4038ac5af02b2599bfa62b7..10535ce79b12f1820986fcbaa4062def0c9ec856 100755 --- a/script/bump-zed-minor-versions +++ b/script/bump-zed-minor-versions @@ -97,7 +97,7 @@ Prepared new Zed versions locally. You will need to push the branches and open a # To push and open a PR to update main: - git push origin \\ + git push -u origin \\ ${preview_tag_name} \\ ${stable_tag_name} \\ ${minor_branch_name} \\ diff --git a/script/bundle-freebsd b/script/bundle-freebsd new file mode 100755 index 0000000000000000000000000000000000000000..7222a0625692c06606aad64d1420fbfa7daae943 --- /dev/null +++ b/script/bundle-freebsd @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +set -euxo pipefail +source script/lib/blob-store.sh + +# Function for displaying help info +help_info() { + echo " +Usage: ${0##*/} [options] +Build a release .tar.gz for FreeBSD. + +Options: + -h Display this help and exit. + " +} + +while getopts 'h' flag; do + case "${flag}" in + h) + help_info + exit 0 + ;; + esac +done + +export ZED_BUNDLE=true + +channel=$(/dev/null 2>&1; then +# rustup_installed=true +# fi +# Generate the licenses first, so they can be baked into the binaries +# script/generate-licenses +# if "$rustup_installed"; then +# rustup target add "$remote_server_triple" +# fi + +# export CC=$(which clang) + +# Build binary in release mode +export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib" +# cargo build --release --target "${target_triple}" --package zed --package cli + +# Build remote_server in separate invocation to prevent feature unification from other crates +# from influencing dynamic libraries required by it. +# if [[ "$remote_server_triple" == "$musl_triple" ]]; then +# export RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static" +# fi +cargo build --release --target "${remote_server_triple}" --package remote_server + +# Strip debug symbols and save them for upload to DigitalOcean +# objcopy --only-keep-debug "${target_dir}/${target_triple}/release/zed" "${target_dir}/${target_triple}/release/zed.dbg" +# objcopy --only-keep-debug "${target_dir}/${remote_server_triple}/release/remote_server" "${target_dir}/${remote_server_triple}/release/remote_server.dbg" +# objcopy --strip-debug "${target_dir}/${target_triple}/release/zed" +# objcopy --strip-debug "${target_dir}/${target_triple}/release/cli" +# objcopy --strip-debug "${target_dir}/${remote_server_triple}/release/remote_server" + +# gzip -f "${target_dir}/${target_triple}/release/zed.dbg" +# gzip -f "${target_dir}/${remote_server_triple}/release/remote_server.dbg" + +# if [[ -n "${DIGITALOCEAN_SPACES_SECRET_KEY:-}" && -n "${DIGITALOCEAN_SPACES_ACCESS_KEY:-}" ]]; then +# upload_to_blob_store_public \ +# "zed-debug-symbols" \ +# "${target_dir}/${target_triple}/release/zed.dbg.gz" \ +# "$channel/zed-$version-${target_triple}.dbg.gz" +# upload_to_blob_store_public \ +# "zed-debug-symbols" \ +# "${target_dir}/${remote_server_triple}/release/remote_server.dbg.gz" \ +# "$channel/remote_server-$version-${remote_server_triple}.dbg.gz" +# fi + +# Ensure that remote_server does not depend on libssl nor libcrypto, as we got rid of these deps. +if ldd "${target_dir}/${remote_server_triple}/release/remote_server" | grep -q 'libcrypto\|libssl'; then + echo "Error: remote_server still depends on libssl or libcrypto" && exit 1 +fi + +suffix="" +if [ "$channel" != "stable" ]; then + suffix="-$channel" +fi + +# Move everything that should end up in the final package +# into a temp directory. +# temp_dir=$(mktemp -d) +# zed_dir="${temp_dir}/zed$suffix.app" + +# Binary +# mkdir -p "${zed_dir}/bin" "${zed_dir}/libexec" +# cp "${target_dir}/${target_triple}/release/zed" "${zed_dir}/libexec/zed-editor" +# cp "${target_dir}/${target_triple}/release/cli" "${zed_dir}/bin/zed" + +# Libs +# find_libs() { +# ldd ${target_dir}/${target_triple}/release/zed | +# cut -d' ' -f3 | +# grep -v '\<\(libstdc++.so\|libc.so\|libgcc_s.so\|libm.so\|libpthread.so\|libdl.so\|libasound.so\)' +# } + +# mkdir -p "${zed_dir}/lib" +# rm -rf "${zed_dir}/lib/*" +# cp $(find_libs) "${zed_dir}/lib" + +# Icons +# mkdir -p "${zed_dir}/share/icons/hicolor/512x512/apps" +# cp "crates/zed/resources/app-icon$suffix.png" "${zed_dir}/share/icons/hicolor/512x512/apps/zed.png" +# mkdir -p "${zed_dir}/share/icons/hicolor/1024x1024/apps" +# cp "crates/zed/resources/app-icon$suffix@2x.png" "${zed_dir}/share/icons/hicolor/1024x1024/apps/zed.png" + +# .desktop +# export DO_STARTUP_NOTIFY="true" +# export APP_CLI="zed" +# export APP_ICON="zed" +# export APP_ARGS="%U" +# if [[ "$channel" == "preview" ]]; then +# export APP_NAME="Zed Preview" +# elif [[ "$channel" == "nightly" ]]; then +# export APP_NAME="Zed Nightly" +# elif [[ "$channel" == "dev" ]]; then +# export APP_NAME="Zed Devel" +# else +# export APP_NAME="Zed" +# fi + +# mkdir -p "${zed_dir}/share/applications" +# envsubst <"crates/zed/resources/zed.desktop.in" >"${zed_dir}/share/applications/zed$suffix.desktop" + +# Copy generated licenses so they'll end up in archive too +# cp "assets/licenses.md" "${zed_dir}/licenses.md" + +# Create archive out of everything that's in the temp directory +arch=$(uname -m) +# target="freebsd-${arch}" +# if [[ "$channel" == "dev" ]]; then +# archive="zed-${commit}-${target}.tar.gz" +# else +# archive="zed-${target}.tar.gz" +# fi + +# rm -rf "${archive}" +# remove_match="zed(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz" +# ls "${target_dir}/release" | grep -E ${remove_match} | xargs -d "\n" -I {} rm -f "${target_dir}/release/{}" || true +# tar -czvf "${target_dir}/release/$archive" -C ${temp_dir} "zed$suffix.app" + +gzip -f --stdout --best "${target_dir}/${remote_server_triple}/release/remote_server" \ + > "${target_dir}/zed-remote-server-freebsd-x86_64.gz" diff --git a/script/bundle-linux b/script/bundle-linux index e40eb33c93a8fff3aa099a089a71d23b76811360..c52312015bed92cad021a187c59146ae8aeb9800 100755 --- a/script/bundle-linux +++ b/script/bundle-linux @@ -10,17 +10,36 @@ Usage: ${0##*/} [options] Build a release .tar.gz for Linux. Options: - -h Display this help and exit. + -h, --help Display this help and exit. + --flatpak Set ZED_BUNDLE_TYPE=flatpak so that this can be included in system info " } -while getopts 'h' flag -do - case "${flag}" in - h) - help_info - exit 0 - ;; +# Parse all arguments manually +while [[ $# -gt 0 ]]; do + case $1 in + -h|--help) + help_info + exit 0 + ;; + --flatpak) + export ZED_BUNDLE_TYPE=flatpak + shift + ;; + --) + shift + break + ;; + -*) + echo "Unknown option: $1" >&2 + help_info + exit 1 + ;; + *) + echo "Error: Unexpected argument: $1" >&2 + help_info + exit 1 + ;; esac done @@ -87,7 +106,11 @@ fi # Ensure that remote_server does not depend on libssl nor libcrypto, as we got rid of these deps. if ldd "${target_dir}/${remote_server_triple}/release/remote_server" | grep -q 'libcrypto\|libssl'; then - echo "Error: remote_server still depends on libssl or libcrypto" && exit 1 + if [[ "$remote_server_triple" == *-musl ]]; then + echo "Error: remote_server still depends on libssl or libcrypto" && exit 1 + else + echo "Info: Using non-musl remote-server build." + fi fi suffix="" diff --git a/script/check-keymaps b/script/check-keymaps new file mode 100755 index 0000000000000000000000000000000000000000..44745fa8b81985e4c84019867d3e56095a71f6dc --- /dev/null +++ b/script/check-keymaps @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +pattern='cmd-' +result=$(git grep --no-color --line-number --fixed-strings -e "$pattern" -- \ + 'assets/keymaps/' \ + ':(exclude)assets/keymaps/storybook.json' \ + ':(exclude)assets/keymaps/default-macos.json' \ + ':(exclude)assets/keymaps/macos/*.json' || true) + +if [[ -n "${result}" ]]; then + echo "${result}" + echo "Error: Found 'cmd-' in non-macOS keymap files." + exit 1 +fi + +pattern='super-|win-|fn-' +result=$(git grep --no-color --line-number --fixed-strings -e "$pattern" -- \ + 'assets/keymaps/' || true) + +if [[ -n "${result}" ]]; then + echo "${result}" + echo "Error: Found 'super-', 'win-', or 'fn-' in keymap files. Currently these aren't used." + exit 1 +fi diff --git a/script/check-links b/script/check-links new file mode 100755 index 0000000000000000000000000000000000000000..259ce1d1b9be33749df6c1391ef3910e757e90aa --- /dev/null +++ b/script/check-links @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -euo pipefail + +usage() { + echo "Usage: $0 [local|all] [--help]" + echo " local Only check local links (default)" + echo " all Check all links including remote ones" + exit 1 +} + +check_mode="local" +if [ $# -eq 1 ]; then + case "$1" in + "local") check_mode="local" ;; + "all") check_mode="all" ;; + "--help") usage ;; + *) echo "Invalid argument: $1" && usage ;; + esac +else + usage +fi + +cargo install lychee +cd "$(dirname "$0")/.." + +if [ "$check_mode" = "all" ]; then + lychee --no-progress './docs/src/**/*' +else + lychee --exclude '^http' './docs/src/**/*' +fi +# diff --git a/script/check-todos b/script/check-todos index f6edb849bdb4ff54260f4943e1aa47f42a10f0e9..4bdf3283297b39a6139dc7949d6a6af9fa9a5038 100755 --- a/script/check-todos +++ b/script/check-todos @@ -8,7 +8,7 @@ result=$(git grep --no-color --ignore-case --line-number --extended-regexp -e $p ':(exclude).github/workflows/ci.yml' \ ':(exclude)*criteria.md' \ ':(exclude)*prompt.md' || true) -echo "${result}" if [[ -n "${result}" ]]; then + echo "${result}" exit 1 fi diff --git a/script/clear-target-dir-if-larger-than.ps1 b/script/clear-target-dir-if-larger-than.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..8bb77997d6309a9a41791b8c6de364a649795316 --- /dev/null +++ b/script/clear-target-dir-if-larger-than.ps1 @@ -0,0 +1,22 @@ +param ( + [Parameter(Mandatory = $true)] + [int]$MAX_SIZE_IN_GB +) + +$ErrorActionPreference = "Stop" +$PSNativeCommandUseErrorActionPreference = $true +$ProgressPreference = "SilentlyContinue" + +if (-Not (Test-Path -Path "target")) { + Write-Host "target directory does not exist yet" + exit 0 +} + +$current_size_gb = (Get-ChildItem -Recurse -Force -File -Path "target" | Measure-Object -Property Length -Sum).Sum / 1GB + +Write-Host "target directory size: ${current_size_gb}GB. max size: ${MAX_SIZE_IN_GB}GB" + +if ($current_size_gb -gt $MAX_SIZE_IN_GB) { + Write-Host "clearing target directory" + Remove-Item -Recurse -Force -Path "target\*" +} diff --git a/script/clippy.ps1 b/script/clippy.ps1 index 329ff599f2ee5b0c14e2c9f5ec1d3e8a57f6b0ae..afb1611d83c274deb64b918a8c2a17d55a3c0eaf 100644 --- a/script/clippy.ps1 +++ b/script/clippy.ps1 @@ -1,21 +1,32 @@ $ErrorActionPreference = "Stop" +Write-Host "Your PATH entries:" +$env:Path -split ";" | ForEach-Object { Write-Host " $_" } + $needAddWorkspace = $false -if ($args -notcontains "-p" -and $args -notcontains "--package") { +if ($args -notcontains "-p" -and $args -notcontains "--package") +{ $needAddWorkspace = $true } # https://stackoverflow.com/questions/41324882/how-to-run-a-powershell-script-with-verbose-output/70020655#70020655 -Set-PSDebug -Trace 2 +# Set-PSDebug -Trace 2 -$Cargo = $env:CARGO -if (-not $Cargo) { +if ($env:CARGO) +{ + $Cargo = $env:CARGO +} elseif (Get-Command "cargo" -ErrorAction SilentlyContinue) +{ $Cargo = "cargo" +} else +{ + Write-Error "Could not find cargo in path." -ErrorAction Stop } -if ($needAddWorkspace) { +if ($needAddWorkspace) +{ & $Cargo clippy @args --workspace --release --all-targets --all-features -- --deny warnings -} -else { +} else +{ & $Cargo clippy @args --release --all-targets --all-features -- --deny warnings } diff --git a/script/danger/dangerfile.ts b/script/danger/dangerfile.ts index 227e57482358b9c03efa890edb0560e940785e33..3f9c80586ee30b33c9539f2665614f23122248a0 100644 --- a/script/danger/dangerfile.ts +++ b/script/danger/dangerfile.ts @@ -1,4 +1,4 @@ -import { danger, message, warn } from "danger"; +import { danger, message, warn, fail } from "danger"; const { prHygiene } = require("danger-plugin-pr-hygiene"); prHygiene({ @@ -38,7 +38,7 @@ if (!hasReleaseNotes) { } const ISSUE_LINK_PATTERN = - /(? + PROMPT_PATHS.some((promptPath) => file.includes(promptPath)), +); + +for (const promptPath of modifiedPrompts) { + if (body.includes(PROMPT_CHANGE_ATTESTATION)) { + message( + [ + `This PR contains changes to "${promptPath}".`, + "The author has attested the LLM Worker works with the changes to this prompt.", + ].join("\n"), + ); + } else { + fail( + [ + `Modifying the "${promptPath}" prompt may require corresponding changes in the LLM Worker.`, + "If you are ensure what this entails, talk to @maxdeviant or another AI team member.", + `Once you have made the changes—or determined that none are necessary—add "${PROMPT_CHANGE_ATTESTATION}" to the PR description.`, + ].join("\n"), + ); + } +} diff --git a/script/debug-cli b/script/debug-cli new file mode 100755 index 0000000000000000000000000000000000000000..1a40e703381441e87ab621837f4a61fa4741a6ce --- /dev/null +++ b/script/debug-cli @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cargo build; cargo run -p cli -- --foreground --zed=target/debug/zed "$@" diff --git a/script/digital-ocean-db.sh b/script/digital-ocean-db.sh new file mode 100755 index 0000000000000000000000000000000000000000..fd441e593e1741b5f8c8e06c3ec0e9e2058efd3e --- /dev/null +++ b/script/digital-ocean-db.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +# Check if database name is provided +if [ $# -eq 0 ]; then + echo "Usage: $0 " + doctl databases list + exit 1 +fi + +DATABASE_NAME="$1" +DATABASE_ID=$(doctl databases list --format ID,Name --no-header | grep "$DATABASE_NAME" | awk '{print $1}') + +if [ -z "$DATABASE_ID" ]; then + echo "Error: Database '$DATABASE_NAME' not found" + exit 1 +fi +CURRENT_IP=$(curl -s https://api.ipify.org) +if [ -z "$CURRENT_IP" ]; then + echo "Error: Failed to get current IP address" + exit 1 +fi + +EXISTING_RULE=$(doctl databases firewalls list "$DATABASE_ID" | grep "ip_addr" | grep "$CURRENT_IP") + +if [ -z "$EXISTING_RULE" ]; then + echo "IP not found in whitelist. Adding $CURRENT_IP to database firewall..." + doctl databases firewalls append "$DATABASE_ID" --rule ip_addr:"$CURRENT_IP" +fi + +CONNECTION_URL=$(doctl databases connection "$DATABASE_ID" --format URI --no-header) + +if [ -z "$CONNECTION_URL" ]; then + echo "Error: Failed to get database connection details" + exit 1 +fi + +psql "$CONNECTION_URL" diff --git a/script/flatpak/bundle-flatpak b/script/flatpak/bundle-flatpak index 28a45380404cba3d69f9bc2b25fb9b179c462222..c9196ed4b8534f6faf87748704bfaceeb396304d 100755 --- a/script/flatpak/bundle-flatpak +++ b/script/flatpak/bundle-flatpak @@ -4,7 +4,7 @@ set -euo pipefail cd "$(dirname "$0")/../.." shopt -s extglob -script/bundle-linux +script/bundle-linux --flatpak archive_match="zed(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz" archive=$(ls "target/release" | grep -E ${archive_match}) channel=$(/dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "Finished installing FreeBSD dependencies with script/freebsd" +} + +# FreeBSD +# https://www.freebsd.org/ports/ +pkg=$(command -v pkg || true) +if [[ -n $pkg ]]; then + deps=( + cmake + gcc + git + llvm + protobuf + rustup-init + libx11 + alsa-lib + ) + $maysudo "$pkg" install "${deps[@]}" + finalize + exit 0 +fi diff --git a/script/github-pr-status b/script/github-pr-status new file mode 100755 index 0000000000000000000000000000000000000000..b3b0463165243e8b82f40b622d7b267d522460aa --- /dev/null +++ b/script/github-pr-status @@ -0,0 +1,210 @@ +#!/usr/bin/env python3 +""" +GitHub PR Analyzer for zed-industries/zed repository +Downloads all PRs and groups them by first assignee with status, open date, and last updated date. +""" + +import urllib.request +import urllib.parse +import urllib.error +import json +from datetime import datetime +from collections import defaultdict +import sys +import os + +# GitHub API configuration +GITHUB_API_BASE = "https://api.github.com" +REPO_OWNER = "zed-industries" +REPO_NAME = "zed" +GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") + +def make_github_request(url, params=None): + """Make a request to GitHub API with proper headers and pagination support.""" + if params: + url_parts = list(urllib.parse.urlparse(url)) + query = dict(urllib.parse.parse_qsl(url_parts[4])) + query.update(params) + url_parts[4] = urllib.parse.urlencode(query) + url = urllib.parse.urlunparse(url_parts) + + req = urllib.request.Request(url) + req.add_header("Accept", "application/vnd.github.v3+json") + req.add_header("User-Agent", "GitHub-PR-Analyzer") + + if GITHUB_TOKEN: + req.add_header("Authorization", f"token {GITHUB_TOKEN}") + + try: + response = urllib.request.urlopen(req) + return response + except urllib.error.URLError as e: + print(f"Error making request to {url}: {e}") + return None + except urllib.error.HTTPError as e: + print(f"HTTP error {e.code} for {url}: {e.reason}") + return None + +def fetch_all_prs(): + """Fetch all PRs from the repository using pagination.""" + prs = [] + page = 1 + per_page = 100 + + print("Fetching PRs from GitHub API...") + + while True: + url = f"{GITHUB_API_BASE}/repos/{REPO_OWNER}/{REPO_NAME}/pulls" + params = { + "state": "open", + "sort": "updated", + "direction": "desc", + "per_page": per_page, + "page": page + } + + response = make_github_request(url, params) + if not response: + break + + try: + data = response.read().decode('utf-8') + page_prs = json.loads(data) + except (json.JSONDecodeError, UnicodeDecodeError) as e: + print(f"Error parsing response: {e}") + break + + if not page_prs: + break + + prs.extend(page_prs) + print(f"Fetched page {page}: {len(page_prs)} PRs (Total: {len(prs)})") + + # Check if we have more pages + link_header = response.getheader('Link', '') + if 'rel="next"' not in link_header: + break + + page += 1 + + print(f"Total PRs fetched: {len(prs)}") + return prs + +def format_date_as_days_ago(date_string): + """Format ISO date string as 'X days ago'.""" + if not date_string: + return "N/A days ago" + + try: + dt = datetime.fromisoformat(date_string.replace('Z', '+00:00')) + now = datetime.now(dt.tzinfo) + days_diff = (now - dt).days + + if days_diff == 0: + return "today" + elif days_diff == 1: + return "1 day ago" + else: + return f"{days_diff} days ago" + except: + return "N/A days ago" + +def get_first_assignee(pr): + """Get the first assignee from a PR, or return 'Unassigned' if none.""" + assignees = pr.get('assignees', []) + if assignees: + return assignees[0].get('login', 'Unknown') + return 'Unassigned' + +def get_pr_status(pr): + """Determine if PR is draft or ready for review.""" + if pr.get('draft', False): + return "Draft" + return "Ready" + +def analyze_prs(prs): + """Group PRs by first assignee and organize the data.""" + grouped_prs = defaultdict(list) + + for pr in prs: + assignee = get_first_assignee(pr) + + pr_info = { + 'number': pr['number'], + 'title': pr['title'], + 'status': get_pr_status(pr), + 'state': pr['state'], + 'created_at': format_date_as_days_ago(pr['created_at']), + 'updated_at': format_date_as_days_ago(pr['updated_at']), + 'updated_at_raw': pr['updated_at'], + 'url': pr['html_url'], + 'author': pr['user']['login'] + } + + grouped_prs[assignee].append(pr_info) + + # Sort PRs within each group by update date (newest first) + for assignee in grouped_prs: + grouped_prs[assignee].sort(key=lambda x: x['updated_at_raw'], reverse=True) + + return dict(grouped_prs) + +def print_pr_report(grouped_prs): + """Print formatted report of PRs grouped by assignee.""" + print(f"OPEN PR REPORT FOR {REPO_OWNER}/{REPO_NAME}") + print() + + # Sort assignees alphabetically, but put 'Unassigned' last + assignees = sorted(grouped_prs.keys()) + if 'Unassigned' in assignees: + assignees.remove('Unassigned') + assignees.append('Unassigned') + + total_prs = sum(len(prs) for prs in grouped_prs.values()) + print(f"Total Open PRs: {total_prs}") + print() + + for assignee in assignees: + prs = grouped_prs[assignee] + assignee_display = f"@{assignee}" if assignee != 'Unassigned' else assignee + print(f"assigned to {assignee_display} ({len(prs)} PRs):") + + for pr in prs: + print(f"- {pr['author']}: [{pr['title']}]({pr['url']}) opened:{pr['created_at']} updated:{pr['updated_at']}") + + print() + +def save_json_report(grouped_prs, filename="pr_report.json"): + """Save the PR data to a JSON file.""" + try: + with open(filename, 'w') as f: + json.dump(grouped_prs, f, indent=2) + print(f"📄 Report saved to {filename}") + except Exception as e: + print(f"Error saving JSON report: {e}") + +def main(): + """Main function to orchestrate the PR analysis.""" + print("GitHub PR Analyzer") + print("==================") + + if not GITHUB_TOKEN: + print("⚠️ Warning: GITHUB_TOKEN not set. You may hit rate limits.") + print(" Set GITHUB_TOKEN environment variable for authenticated requests.") + print() + + # Fetch all PRs + prs = fetch_all_prs() + + if not prs: + print("❌ Failed to fetch PRs. Please check your connection and try again.") + sys.exit(1) + + # Analyze and group PRs + grouped_prs = analyze_prs(prs) + + # Print report + print_pr_report(grouped_prs) + +if __name__ == "__main__": + main() diff --git a/script/install-rustup.ps1 b/script/install-rustup.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..70ee410239a11433d545784b2122c7a305323ca3 --- /dev/null +++ b/script/install-rustup.ps1 @@ -0,0 +1,39 @@ +# Checks if cargo is in the user's path or in default install path +# If not, download with rustup-installer (which respects CARGO_HOME / RUSTUP_HOME) + +# Like 'set -e' in bash +$ErrorActionPreference = "Stop" + +$cargoHome = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { "$env:USERPROFILE\.cargo" } +$rustupPath = "$cargoHome\bin\rustup.exe" +$cargoPath = "$cargoHome\bin\cargo.exe" + +# Check if cargo is already available in path +if (Get-Command cargo -ErrorAction SilentlyContinue) +{ + cargo --version + exit +} +# Check if rustup and cargo are available in CARGO_HOME +elseif (-not ((Test-Path $rustupPath) -and (Test-Path $cargoPath))) { + Write-Output "Rustup or Cargo not found in $cargoHome, installing..." + + $tempDir = [System.IO.Path]::GetTempPath() + + # Download and install rustup + $RustupInitPath = "$tempDir\rustup-init.exe" + Write-Output "Downloading rustup installer..." + Invoke-WebRequest ` + -OutFile $RustupInitPath ` + -Uri https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe + + Write-Output "Installing rustup..." + & $RustupInitPath -y --default-toolchain none + Remove-Item -Force $RustupInitPath + + Write-Output "Rust installation complete." + # This is necessary +} + +& $rustupPath --version +& $cargoPath --version diff --git a/script/run-local-minio b/script/run-local-minio index 3454eedae5387f04d7723237b2c669267152eb8e..61266abb21c0774b576aa3c88b7dd641586d890d 100755 --- a/script/run-local-minio +++ b/script/run-local-minio @@ -2,7 +2,11 @@ set -e -which minio > /dev/null || (echo "installing minio..."; brew install minio/stable/minio) +if ! which minio > /dev/null; then + echo "minio not found - run script/bootstrap to install it and do other setup" + exit 1 +fi + mkdir -p .blob_store/the-extensions-bucket mkdir -p .blob_store/zed-crash-reports diff --git a/script/update_top_ranking_issues/main.py b/script/update_top_ranking_issues/main.py index eb08725e1df1d28d29dd5fd78cc204c5b408bae4..fb193d65643bd11180e5acf03425568cd153b6a4 100644 --- a/script/update_top_ranking_issues/main.py +++ b/script/update_top_ranking_issues/main.py @@ -47,29 +47,29 @@ def main( # GitHub Workflow will pass in the token as an environment variable, # but we can place it in our env when running the script locally, for convenience github_token = github_token or os.getenv("GITHUB_ACCESS_TOKEN") - github = Github(github_token) - remaining_requests_before: int = github.rate_limiting[0] - print(f"Remaining requests before: {remaining_requests_before}") + with Github(github_token, per_page=100) as github: + remaining_requests_before: int = github.rate_limiting[0] + print(f"Remaining requests before: {remaining_requests_before}") - repo_name: str = "zed-industries/zed" - repository: Repository = github.get_repo(repo_name) + repo_name: str = "zed-industries/zed" + repository: Repository = github.get_repo(repo_name) - label_to_issue_data: dict[str, list[IssueData]] = get_issue_maps( - github, repository, start_date - ) + label_to_issue_data: dict[str, list[IssueData]] = get_issue_maps( + github, repository, start_date + ) - issue_text: str = get_issue_text(label_to_issue_data) + issue_text: str = get_issue_text(label_to_issue_data) - if issue_reference_number: - top_ranking_issues_issue: Issue = repository.get_issue(issue_reference_number) - top_ranking_issues_issue.edit(body=issue_text) - else: - print(issue_text) + if issue_reference_number: + top_ranking_issues_issue: Issue = repository.get_issue(issue_reference_number) + top_ranking_issues_issue.edit(body=issue_text) + else: + print(issue_text) - remaining_requests_after: int = github.rate_limiting[0] - print(f"Remaining requests after: {remaining_requests_after}") - print(f"Requests used: {remaining_requests_before - remaining_requests_after}") + remaining_requests_after: int = github.rate_limiting[0] + print(f"Remaining requests after: {remaining_requests_after}") + print(f"Requests used: {remaining_requests_before - remaining_requests_after}") run_duration: timedelta = datetime.now() - start_time print(run_duration) @@ -80,14 +80,11 @@ def get_issue_maps( repository: Repository, start_date: datetime | None = None, ) -> dict[str, list[IssueData]]: - label_to_issues: defaultdict[str, list[Issue]] = get_label_to_issues( + label_to_issue_data: dict[str, list[IssueData]] = get_label_to_issue_data( github, repository, start_date, ) - label_to_issue_data: dict[str, list[IssueData]] = get_label_to_issue_data( - label_to_issues - ) # Create a new dictionary with labels ordered by the summation the of likes on the associated issues labels = list(label_to_issue_data.keys()) @@ -104,11 +101,11 @@ def get_issue_maps( return label_to_issue_data -def get_label_to_issues( +def get_label_to_issue_data( github: Github, repository: Repository, start_date: datetime | None = None, -) -> defaultdict[str, list[Issue]]: +) -> dict[str, list[IssueData]]: common_filters = [ f"repo:{repository.full_name}", "is:open", @@ -126,36 +123,37 @@ def get_label_to_issues( common_filter_string = " ".join(common_filters) - section_queries = { - "bug": "label:bug,type:Bug", - "crash": "label:crash,type:Crash", - "feature": "label:feature", - "meta": "type:Meta", - "unlabeled": "no:label no:type", + # Because PyGithub doesn't seem to support logical operators `AND` and `OR` + # that GitHub issue queries can use, we use lists as values, rather than + # using `(label:bug OR type:Bug)`. This is not as efficient, as we might + # query the same issue multiple times. Issues that are potentially queried + # multiple times are deduplicated in the `label_to_issues` dictionary. If + # PyGithub ever supports logical operators, we should definitely make the + # switch. + section_queries: dict[str, list[str]] = { + "bug": ["label:bug", "type:Bug"], + "crash": ["label:crash", "type:Crash"], + "feature": ["label:feature", "type:Feature"], + "meta": ["type:Meta"], + "unlabeled": ["no:label no:type"], } - label_to_issues: defaultdict[str, list[Issue]] = defaultdict(list) - - for section, section_query in section_queries.items(): - label_query: str = f"{common_filter_string} {section_query}" - - issues = github.search_issues(label_query) + label_to_issue_data: dict[str, list[IssueData]] = {} - if issues.totalCount > 0: - for issue in issues[0:ISSUES_PER_LABEL]: - label_to_issues[section].append(issue) + for section, section_queries in section_queries.items(): + unique_issues = set() - return label_to_issues + for section_query in section_queries: + query: str = f"{common_filter_string} {section_query}" + issues = github.search_issues(query) + for issue in issues: + unique_issues.add(issue) -def get_label_to_issue_data( - label_to_issues: defaultdict[str, list[Issue]], -) -> dict[str, list[IssueData]]: - label_to_issue_data: dict[str, list[IssueData]] = {} + if len(unique_issues) <= 0: + continue - for label in label_to_issues: - issues: list[Issue] = label_to_issues[label] - issue_data: list[IssueData] = [IssueData(issue) for issue in issues] + issue_data: list[IssueData] = [IssueData(issue) for issue in unique_issues] issue_data.sort( key=lambda issue_data: ( -issue_data.like_count, @@ -163,8 +161,7 @@ def get_label_to_issue_data( ) ) - if issue_data: - label_to_issue_data[label] = issue_data + label_to_issue_data[section] = issue_data[0:ISSUES_PER_LABEL] return label_to_issue_data diff --git a/script/upload-nightly b/script/upload-nightly index 87ad712ae4789ab08b0e3de1b8ceb7078a068699..2fcb2994383842d53ccb8bf6b63f847ef76a7d12 100755 --- a/script/upload-nightly +++ b/script/upload-nightly @@ -4,7 +4,7 @@ bash -euo pipefail source script/lib/blob-store.sh -allowed_targets=("linux-targz" "macos") +allowed_targets=("linux-targz" "macos" "freebsd") is_allowed_target() { for val in "${allowed_targets[@]}"; do if [[ "$1" == "$val" ]]; then @@ -55,6 +55,9 @@ case "$target" in upload_to_blob_store $bucket_name "target/latest-sha" "nightly/latest-sha-linux-targz" rm -f "target/latest-sha" ;; + freebsd) + echo "No freebsd client build (yet)." + ;; *) echo "Error: Unknown target '$target'" exit 1 diff --git a/tooling/workspace-hack/Cargo.toml b/tooling/workspace-hack/Cargo.toml index 2fab62d79ff604b479b01a922834ae6c51febc7e..347d59e293130e03b1539a028ea8dc2fa82c061d 100644 --- a/tooling/workspace-hack/Cargo.toml +++ b/tooling/workspace-hack/Cargo.toml @@ -45,13 +45,16 @@ chrono = { version = "0.4", features = ["serde"] } clap = { version = "4", features = ["cargo", "derive", "string", "wrap_help"] } clap_builder = { version = "4", default-features = false, features = ["cargo", "color", "std", "string", "suggestions", "usage", "wrap_help"] } concurrent-queue = { version = "2" } +cranelift-codegen = { version = "0.116", default-features = false, features = ["host-arch", "incremental-cache", "std", "timing", "unwind"] } crc32fast = { version = "1" } +crossbeam-epoch = { version = "0.9" } crossbeam-utils = { version = "0.8" } deranged = { version = "0.4", default-features = false, features = ["powerfmt", "serde", "std"] } digest = { version = "0.10", features = ["mac", "oid", "std"] } either = { version = "1", features = ["serde", "use_std"] } euclid = { version = "0.22" } event-listener = { version = "5" } +flate2 = { version = "1", features = ["zlib-rs"] } form_urlencoded = { version = "1" } futures = { version = "0.3", features = ["io-compat"] } futures-channel = { version = "0.3", features = ["sink"] } @@ -70,6 +73,7 @@ hmac = { version = "0.12", default-features = false, features = ["reset"] } hyper = { version = "0.14", features = ["client", "http1", "http2", "runtime", "server", "stream"] } idna = { version = "1" } indexmap = { version = "2", features = ["serde"] } +jiff = { version = "0.2" } lazy_static = { version = "1", default-features = false, features = ["spin_no_std"] } libc = { version = "0.2", features = ["extra_traits"] } libsqlite3-sys = { version = "0.30", features = ["bundled", "unlock_notify"] } @@ -92,7 +96,9 @@ phf_shared = { version = "0.11" } prost = { version = "0.9" } prost-types = { version = "0.9" } rand-c38e5c1d305a1b54 = { package = "rand", version = "0.8", features = ["small_rng"] } +rand_chacha = { version = "0.3" } rand_core = { version = "0.6", default-features = false, features = ["std"] } +regalloc2 = { version = "0.11", features = ["checker", "enable-serde"] } regex = { version = "1" } regex-automata = { version = "0.4" } regex-syntax = { version = "0.8" } @@ -106,8 +112,9 @@ sea-query-binder = { version = "0.7", default-features = false, features = ["pos semver = { version = "1", features = ["serde"] } serde = { version = "1", features = ["alloc", "derive", "rc"] } serde_json = { version = "1", features = ["preserve_order", "raw_value", "unbounded_depth"] } +sha1 = { version = "0.10", features = ["compress"] } simd-adler32 = { version = "0.3" } -smallvec = { version = "1", default-features = false, features = ["const_new", "serde", "union"] } +smallvec = { version = "1", default-features = false, features = ["const_new", "serde", "union", "write"] } spin = { version = "0.9" } sqlx = { version = "0.8", features = ["bigdecimal", "chrono", "postgres", "runtime-tokio-rustls", "rust_decimal", "sqlite", "time", "uuid"] } sqlx-postgres = { version = "0.8", default-features = false, features = ["any", "bigdecimal", "chrono", "json", "migrate", "offline", "rust_decimal", "time", "uuid"] } @@ -119,17 +126,19 @@ time = { version = "0.3", features = ["local-offset", "macros", "serde-well-know tokio = { version = "1", features = ["full"] } tokio-rustls = { version = "0.26", default-features = false, features = ["tls12"] } tokio-util = { version = "0.7", features = ["codec", "compat", "io"] } +toml_edit = { version = "0.22", features = ["serde"] } tracing = { version = "0.1", features = ["log"] } tracing-core = { version = "0.1" } tungstenite = { version = "0.26", default-features = false, features = ["__rustls-tls", "handshake"] } +unicode-normalization = { version = "0.1" } unicode-properties = { version = "0.1" } url = { version = "2", features = ["serde"] } uuid = { version = "1", features = ["serde", "v4", "v5", "v7"] } -wasm-encoder = { version = "0.221", features = ["wasmparser"] } wasmparser = { version = "0.221" } -wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc"] } -wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc"] } +wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc", "incremental-cache", "parallel-compilation"] } +wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc", "incremental-cache"] } wasmtime-environ = { version = "29", default-features = false, features = ["compile", "component-model", "demangle", "gc-drc"] } +winnow = { version = "0.7", features = ["simd"] } [build-dependencies] ahash = { version = "0.8", features = ["serde"] } @@ -163,13 +172,16 @@ chrono = { version = "0.4", features = ["serde"] } clap = { version = "4", features = ["cargo", "derive", "string", "wrap_help"] } clap_builder = { version = "4", default-features = false, features = ["cargo", "color", "std", "string", "suggestions", "usage", "wrap_help"] } concurrent-queue = { version = "2" } +cranelift-codegen = { version = "0.116", default-features = false, features = ["host-arch", "incremental-cache", "std", "timing", "unwind"] } crc32fast = { version = "1" } +crossbeam-epoch = { version = "0.9" } crossbeam-utils = { version = "0.8" } deranged = { version = "0.4", default-features = false, features = ["powerfmt", "serde", "std"] } digest = { version = "0.10", features = ["mac", "oid", "std"] } either = { version = "1", features = ["serde", "use_std"] } euclid = { version = "0.22" } event-listener = { version = "5" } +flate2 = { version = "1", features = ["zlib-rs"] } form_urlencoded = { version = "1" } futures = { version = "0.3", features = ["io-compat"] } futures-channel = { version = "0.3", features = ["sink"] } @@ -190,6 +202,7 @@ hyper = { version = "0.14", features = ["client", "http1", "http2", "runtime", " idna = { version = "1" } indexmap = { version = "2", features = ["serde"] } itertools-594e8ee84c453af0 = { package = "itertools", version = "0.13" } +jiff = { version = "0.2" } lazy_static = { version = "1", default-features = false, features = ["spin_no_std"] } libc = { version = "0.2", features = ["extra_traits"] } libsqlite3-sys = { version = "0.30", features = ["bundled", "unlock_notify"] } @@ -215,7 +228,9 @@ prost = { version = "0.9" } prost-types = { version = "0.9" } quote = { version = "1" } rand-c38e5c1d305a1b54 = { package = "rand", version = "0.8", features = ["small_rng"] } +rand_chacha = { version = "0.3" } rand_core = { version = "0.6", default-features = false, features = ["std"] } +regalloc2 = { version = "0.11", features = ["checker", "enable-serde"] } regex = { version = "1" } regex-automata = { version = "0.4" } regex-syntax = { version = "0.8" } @@ -230,8 +245,9 @@ semver = { version = "1", features = ["serde"] } serde = { version = "1", features = ["alloc", "derive", "rc"] } serde_derive = { version = "1", features = ["deserialize_in_place"] } serde_json = { version = "1", features = ["preserve_order", "raw_value", "unbounded_depth"] } +sha1 = { version = "0.10", features = ["compress"] } simd-adler32 = { version = "0.3" } -smallvec = { version = "1", default-features = false, features = ["const_new", "serde", "union"] } +smallvec = { version = "1", default-features = false, features = ["const_new", "serde", "union", "write"] } spin = { version = "0.9" } sqlx = { version = "0.8", features = ["bigdecimal", "chrono", "postgres", "runtime-tokio-rustls", "rust_decimal", "sqlite", "time", "uuid"] } sqlx-macros = { version = "0.8", features = ["_rt-tokio", "_tls-rustls-ring-webpki", "bigdecimal", "chrono", "derive", "json", "macros", "migrate", "postgres", "rust_decimal", "sqlite", "time", "uuid"] } @@ -248,32 +264,34 @@ time-macros = { version = "0.2", default-features = false, features = ["formatti tokio = { version = "1", features = ["full"] } tokio-rustls = { version = "0.26", default-features = false, features = ["tls12"] } tokio-util = { version = "0.7", features = ["codec", "compat", "io"] } +toml_edit = { version = "0.22", features = ["serde"] } tracing = { version = "0.1", features = ["log"] } tracing-core = { version = "0.1" } tungstenite = { version = "0.26", default-features = false, features = ["__rustls-tls", "handshake"] } +unicode-normalization = { version = "0.1" } unicode-properties = { version = "0.1" } url = { version = "2", features = ["serde"] } uuid = { version = "1", features = ["serde", "v4", "v5", "v7"] } -wasm-encoder = { version = "0.221", features = ["wasmparser"] } wasmparser = { version = "0.221" } -wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc"] } -wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc"] } +wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc", "incremental-cache", "parallel-compilation"] } +wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc", "incremental-cache"] } wasmtime-environ = { version = "29", default-features = false, features = ["compile", "component-model", "demangle", "gc-drc"] } +winnow = { version = "0.7", features = ["simd"] } [target.x86_64-apple-darwin.dependencies] codespan-reporting = { version = "0.12" } core-foundation = { version = "0.9" } core-foundation-sys = { version = "0.8" } coreaudio-sys = { version = "0.2", default-features = false, features = ["audio_toolbox", "audio_unit", "core_audio", "core_midi", "open_al"] } -flate2 = { version = "1" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } gimli = { version = "0.31", default-features = false, features = ["read", "std", "write"] } hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "native-tokio", "ring", "tls12"] } itertools-5ef9efb8ec2df382 = { package = "itertools", version = "0.12" } naga = { version = "25", features = ["msl-out", "wgsl-in"] } -nix = { version = "0.29", features = ["fs", "pthread", "signal"] } +nix = { version = "0.29", features = ["fs", "pthread", "signal", "user"] } objc2 = { version = "0.6" } +objc2-core-foundation = { version = "0.3", default-features = false, features = ["CFArray", "CFCGTypes", "CFData", "CFDate", "CFDictionary", "CFRunLoop", "CFString", "CFURL", "objc2", "std"] } objc2-foundation = { version = "0.3", default-features = false, features = ["NSArray", "NSAttributedString", "NSBundle", "NSCoder", "NSData", "NSDate", "NSDictionary", "NSEnumerator", "NSError", "NSGeometry", "NSNotification", "NSNull", "NSObjCRuntime", "NSObject", "NSProcessInfo", "NSRange", "NSRunLoop", "NSString", "NSURL", "NSUndoManager", "NSValue", "objc2-core-foundation", "std"] } objc2-metal = { version = "0.3" } object = { version = "0.36", default-features = false, features = ["archive", "read_core", "unaligned", "write"] } @@ -295,15 +313,15 @@ codespan-reporting = { version = "0.12" } core-foundation = { version = "0.9" } core-foundation-sys = { version = "0.8" } coreaudio-sys = { version = "0.2", default-features = false, features = ["audio_toolbox", "audio_unit", "core_audio", "core_midi", "open_al"] } -flate2 = { version = "1" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } gimli = { version = "0.31", default-features = false, features = ["read", "std", "write"] } hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "native-tokio", "ring", "tls12"] } itertools-5ef9efb8ec2df382 = { package = "itertools", version = "0.12" } naga = { version = "25", features = ["msl-out", "wgsl-in"] } -nix = { version = "0.29", features = ["fs", "pthread", "signal"] } +nix = { version = "0.29", features = ["fs", "pthread", "signal", "user"] } objc2 = { version = "0.6" } +objc2-core-foundation = { version = "0.3", default-features = false, features = ["CFArray", "CFCGTypes", "CFData", "CFDate", "CFDictionary", "CFRunLoop", "CFString", "CFURL", "objc2", "std"] } objc2-foundation = { version = "0.3", default-features = false, features = ["NSArray", "NSAttributedString", "NSBundle", "NSCoder", "NSData", "NSDate", "NSDictionary", "NSEnumerator", "NSError", "NSGeometry", "NSNotification", "NSNull", "NSObjCRuntime", "NSObject", "NSProcessInfo", "NSRange", "NSRunLoop", "NSString", "NSURL", "NSUndoManager", "NSValue", "objc2-core-foundation", "std"] } objc2-metal = { version = "0.3" } object = { version = "0.36", default-features = false, features = ["archive", "read_core", "unaligned", "write"] } @@ -325,15 +343,15 @@ codespan-reporting = { version = "0.12" } core-foundation = { version = "0.9" } core-foundation-sys = { version = "0.8" } coreaudio-sys = { version = "0.2", default-features = false, features = ["audio_toolbox", "audio_unit", "core_audio", "core_midi", "open_al"] } -flate2 = { version = "1" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } gimli = { version = "0.31", default-features = false, features = ["read", "std", "write"] } hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "native-tokio", "ring", "tls12"] } itertools-5ef9efb8ec2df382 = { package = "itertools", version = "0.12" } naga = { version = "25", features = ["msl-out", "wgsl-in"] } -nix = { version = "0.29", features = ["fs", "pthread", "signal"] } +nix = { version = "0.29", features = ["fs", "pthread", "signal", "user"] } objc2 = { version = "0.6" } +objc2-core-foundation = { version = "0.3", default-features = false, features = ["CFArray", "CFCGTypes", "CFData", "CFDate", "CFDictionary", "CFRunLoop", "CFString", "CFURL", "objc2", "std"] } objc2-foundation = { version = "0.3", default-features = false, features = ["NSArray", "NSAttributedString", "NSBundle", "NSCoder", "NSData", "NSDate", "NSDictionary", "NSEnumerator", "NSError", "NSGeometry", "NSNotification", "NSNull", "NSObjCRuntime", "NSObject", "NSProcessInfo", "NSRange", "NSRunLoop", "NSString", "NSURL", "NSUndoManager", "NSValue", "objc2-core-foundation", "std"] } objc2-metal = { version = "0.3" } object = { version = "0.36", default-features = false, features = ["archive", "read_core", "unaligned", "write"] } @@ -355,15 +373,15 @@ codespan-reporting = { version = "0.12" } core-foundation = { version = "0.9" } core-foundation-sys = { version = "0.8" } coreaudio-sys = { version = "0.2", default-features = false, features = ["audio_toolbox", "audio_unit", "core_audio", "core_midi", "open_al"] } -flate2 = { version = "1" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } gimli = { version = "0.31", default-features = false, features = ["read", "std", "write"] } hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "native-tokio", "ring", "tls12"] } itertools-5ef9efb8ec2df382 = { package = "itertools", version = "0.12" } naga = { version = "25", features = ["msl-out", "wgsl-in"] } -nix = { version = "0.29", features = ["fs", "pthread", "signal"] } +nix = { version = "0.29", features = ["fs", "pthread", "signal", "user"] } objc2 = { version = "0.6" } +objc2-core-foundation = { version = "0.3", default-features = false, features = ["CFArray", "CFCGTypes", "CFData", "CFDate", "CFDictionary", "CFRunLoop", "CFString", "CFURL", "objc2", "std"] } objc2-foundation = { version = "0.3", default-features = false, features = ["NSArray", "NSAttributedString", "NSBundle", "NSCoder", "NSData", "NSDate", "NSDictionary", "NSEnumerator", "NSError", "NSGeometry", "NSNotification", "NSNull", "NSObjCRuntime", "NSObject", "NSProcessInfo", "NSRange", "NSRunLoop", "NSString", "NSURL", "NSUndoManager", "NSValue", "objc2-core-foundation", "std"] } objc2-metal = { version = "0.3" } object = { version = "0.36", default-features = false, features = ["archive", "read_core", "unaligned", "write"] } @@ -388,7 +406,6 @@ cipher = { version = "0.4", default-features = false, features = ["block-padding codespan-reporting = { version = "0.12" } crypto-common = { version = "0.1", default-features = false, features = ["rand_core", "std"] } event-listener-strategy = { version = "0.5" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -411,14 +428,12 @@ ring = { version = "0.17", features = ["std"] } rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event", "mm", "param", "pipe", "process", "pty", "shm", "stdio", "system", "termios", "time"] } rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] } scopeguard = { version = "1" } -smallvec = { version = "1", default-features = false, features = ["write"] } syn-f595c2ba2a3f28df = { package = "syn", version = "2", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] } sync_wrapper = { version = "1", default-features = false, features = ["futures"] } tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] } tokio-socks = { version = "0.5", features = ["futures-io"] } tokio-stream = { version = "0.1", features = ["fs"] } toml_datetime = { version = "0.6", default-features = false, features = ["serde"] } -toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] } tower = { version = "0.5", default-features = false, features = ["timeout", "util"] } zeroize = { version = "1", features = ["zeroize_derive"] } zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] } @@ -431,7 +446,6 @@ cipher = { version = "0.4", default-features = false, features = ["block-padding codespan-reporting = { version = "0.12" } crypto-common = { version = "0.1", default-features = false, features = ["rand_core", "std"] } event-listener-strategy = { version = "0.5" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -453,13 +467,11 @@ ring = { version = "0.17", features = ["std"] } rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event", "mm", "param", "pipe", "process", "pty", "shm", "stdio", "system", "termios", "time"] } rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] } scopeguard = { version = "1" } -smallvec = { version = "1", default-features = false, features = ["write"] } sync_wrapper = { version = "1", default-features = false, features = ["futures"] } tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] } tokio-socks = { version = "0.5", features = ["futures-io"] } tokio-stream = { version = "0.1", features = ["fs"] } toml_datetime = { version = "0.6", default-features = false, features = ["serde"] } -toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] } tower = { version = "0.5", default-features = false, features = ["timeout", "util"] } zeroize = { version = "1", features = ["zeroize_derive"] } zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] } @@ -472,7 +484,6 @@ cipher = { version = "0.4", default-features = false, features = ["block-padding codespan-reporting = { version = "0.12" } crypto-common = { version = "0.1", default-features = false, features = ["rand_core", "std"] } event-listener-strategy = { version = "0.5" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -495,14 +506,12 @@ ring = { version = "0.17", features = ["std"] } rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event", "mm", "param", "pipe", "process", "pty", "shm", "stdio", "system", "termios", "time"] } rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] } scopeguard = { version = "1" } -smallvec = { version = "1", default-features = false, features = ["write"] } syn-f595c2ba2a3f28df = { package = "syn", version = "2", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] } sync_wrapper = { version = "1", default-features = false, features = ["futures"] } tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] } tokio-socks = { version = "0.5", features = ["futures-io"] } tokio-stream = { version = "0.1", features = ["fs"] } toml_datetime = { version = "0.6", default-features = false, features = ["serde"] } -toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] } tower = { version = "0.5", default-features = false, features = ["timeout", "util"] } zeroize = { version = "1", features = ["zeroize_derive"] } zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] } @@ -515,7 +524,6 @@ cipher = { version = "0.4", default-features = false, features = ["block-padding codespan-reporting = { version = "0.12" } crypto-common = { version = "0.1", default-features = false, features = ["rand_core", "std"] } event-listener-strategy = { version = "0.5" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -537,20 +545,17 @@ ring = { version = "0.17", features = ["std"] } rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event", "mm", "param", "pipe", "process", "pty", "shm", "stdio", "system", "termios", "time"] } rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] } scopeguard = { version = "1" } -smallvec = { version = "1", default-features = false, features = ["write"] } sync_wrapper = { version = "1", default-features = false, features = ["futures"] } tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] } tokio-socks = { version = "0.5", features = ["futures-io"] } tokio-stream = { version = "0.1", features = ["fs"] } toml_datetime = { version = "0.6", default-features = false, features = ["serde"] } -toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] } tower = { version = "0.5", default-features = false, features = ["timeout", "util"] } zeroize = { version = "1", features = ["zeroize_derive"] } zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] } [target.x86_64-pc-windows-msvc.dependencies] codespan-reporting = { version = "0.12" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -570,12 +575,11 @@ winapi = { version = "0.3", default-features = false, features = ["cfg", "commap windows-core = { version = "0.61" } windows-numerics = { version = "0.2" } windows-sys-73dcd821b1037cfd = { package = "windows-sys", version = "0.59", features = ["Wdk_Foundation", "Wdk_Storage_FileSystem", "Win32_Globalization", "Win32_NetworkManagement_IpHelper", "Win32_Networking_WinSock", "Win32_Security_Authentication_Identity", "Win32_Security_Credentials", "Win32_Security_Cryptography", "Win32_Storage_FileSystem", "Win32_System_Com", "Win32_System_Console", "Win32_System_Diagnostics_Debug", "Win32_System_IO", "Win32_System_Ioctl", "Win32_System_Kernel", "Win32_System_LibraryLoader", "Win32_System_Memory", "Win32_System_Performance", "Win32_System_Pipes", "Win32_System_Registry", "Win32_System_SystemInformation", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_Time", "Win32_System_WindowsProgramming", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] } -windows-sys-b21d60becc0929df = { package = "windows-sys", version = "0.52", features = ["Wdk_Foundation", "Wdk_Storage_FileSystem", "Wdk_System_IO", "Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_WindowsProgramming"] } +windows-sys-b21d60becc0929df = { package = "windows-sys", version = "0.52", features = ["Wdk_Foundation", "Wdk_Storage_FileSystem", "Wdk_System_IO", "Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security_Authorization", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_Memory", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_WindowsProgramming"] } windows-sys-c8eced492e86ede7 = { package = "windows-sys", version = "0.48", features = ["Win32_Foundation", "Win32_Globalization", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Com", "Win32_System_Diagnostics_Debug", "Win32_System_IO", "Win32_System_Pipes", "Win32_System_Registry", "Win32_System_Threading", "Win32_System_Time", "Win32_UI_Shell"] } [target.x86_64-pc-windows-msvc.build-dependencies] codespan-reporting = { version = "0.12" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -596,7 +600,7 @@ winapi = { version = "0.3", default-features = false, features = ["cfg", "commap windows-core = { version = "0.61" } windows-numerics = { version = "0.2" } windows-sys-73dcd821b1037cfd = { package = "windows-sys", version = "0.59", features = ["Wdk_Foundation", "Wdk_Storage_FileSystem", "Win32_Globalization", "Win32_NetworkManagement_IpHelper", "Win32_Networking_WinSock", "Win32_Security_Authentication_Identity", "Win32_Security_Credentials", "Win32_Security_Cryptography", "Win32_Storage_FileSystem", "Win32_System_Com", "Win32_System_Console", "Win32_System_Diagnostics_Debug", "Win32_System_IO", "Win32_System_Ioctl", "Win32_System_Kernel", "Win32_System_LibraryLoader", "Win32_System_Memory", "Win32_System_Performance", "Win32_System_Pipes", "Win32_System_Registry", "Win32_System_SystemInformation", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_Time", "Win32_System_WindowsProgramming", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] } -windows-sys-b21d60becc0929df = { package = "windows-sys", version = "0.52", features = ["Wdk_Foundation", "Wdk_Storage_FileSystem", "Wdk_System_IO", "Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_WindowsProgramming"] } +windows-sys-b21d60becc0929df = { package = "windows-sys", version = "0.52", features = ["Wdk_Foundation", "Wdk_Storage_FileSystem", "Wdk_System_IO", "Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security_Authorization", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_Memory", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_WindowsProgramming"] } windows-sys-c8eced492e86ede7 = { package = "windows-sys", version = "0.48", features = ["Win32_Foundation", "Win32_Globalization", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Com", "Win32_System_Diagnostics_Debug", "Win32_System_IO", "Win32_System_Pipes", "Win32_System_Registry", "Win32_System_Threading", "Win32_System_Time", "Win32_UI_Shell"] } [target.x86_64-unknown-linux-musl.dependencies] @@ -607,7 +611,6 @@ cipher = { version = "0.4", default-features = false, features = ["block-padding codespan-reporting = { version = "0.12" } crypto-common = { version = "0.1", default-features = false, features = ["rand_core", "std"] } event-listener-strategy = { version = "0.5" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -630,14 +633,12 @@ ring = { version = "0.17", features = ["std"] } rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event", "mm", "param", "pipe", "process", "pty", "shm", "stdio", "system", "termios", "time"] } rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] } scopeguard = { version = "1" } -smallvec = { version = "1", default-features = false, features = ["write"] } syn-f595c2ba2a3f28df = { package = "syn", version = "2", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] } sync_wrapper = { version = "1", default-features = false, features = ["futures"] } tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] } tokio-socks = { version = "0.5", features = ["futures-io"] } tokio-stream = { version = "0.1", features = ["fs"] } toml_datetime = { version = "0.6", default-features = false, features = ["serde"] } -toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] } tower = { version = "0.5", default-features = false, features = ["timeout", "util"] } zeroize = { version = "1", features = ["zeroize_derive"] } zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] } @@ -650,7 +651,6 @@ cipher = { version = "0.4", default-features = false, features = ["block-padding codespan-reporting = { version = "0.12" } crypto-common = { version = "0.1", default-features = false, features = ["rand_core", "std"] } event-listener-strategy = { version = "0.5" } -flate2 = { version = "1" } flume = { version = "0.11" } foldhash = { version = "0.1", default-features = false, features = ["std"] } getrandom-468e82937335b1c9 = { package = "getrandom", version = "0.3", default-features = false, features = ["std"] } @@ -672,13 +672,11 @@ ring = { version = "0.17", features = ["std"] } rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event", "mm", "param", "pipe", "process", "pty", "shm", "stdio", "system", "termios", "time"] } rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] } scopeguard = { version = "1" } -smallvec = { version = "1", default-features = false, features = ["write"] } sync_wrapper = { version = "1", default-features = false, features = ["futures"] } tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] } tokio-socks = { version = "0.5", features = ["futures-io"] } tokio-stream = { version = "0.1", features = ["fs"] } toml_datetime = { version = "0.6", default-features = false, features = ["serde"] } -toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] } tower = { version = "0.5", default-features = false, features = ["timeout", "util"] } zeroize = { version = "1", features = ["zeroize_derive"] } zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] } diff --git a/tooling/xtask/src/tasks/clippy.rs b/tooling/xtask/src/tasks/clippy.rs index 32574a907e371e251da1e0d177c5c6cd14aa59ea..5d3fd5095bb109fa5ce942f8e8a4ab7f20618510 100644 --- a/tooling/xtask/src/tasks/clippy.rs +++ b/tooling/xtask/src/tasks/clippy.rs @@ -1,6 +1,6 @@ use std::process::Command; -use anyhow::{Context, Result, bail}; +use anyhow::{Context as _, Result, bail}; use clap::Parser; #[derive(Parser)] diff --git a/tooling/xtask/src/tasks/licenses.rs b/tooling/xtask/src/tasks/licenses.rs index 943b36cb289307200963d33418415e4bfaa85464..449c774d458145c399c7b261211651483503572f 100644 --- a/tooling/xtask/src/tasks/licenses.rs +++ b/tooling/xtask/src/tasks/licenses.rs @@ -1,6 +1,6 @@ use std::path::{Path, PathBuf}; -use anyhow::{Result, anyhow}; +use anyhow::{Context as _, Result}; use clap::Parser; use crate::workspace::load_workspace; @@ -17,7 +17,7 @@ pub fn run_licenses(_args: LicensesArgs) -> Result<()> { let crate_dir = package .manifest_path .parent() - .ok_or_else(|| anyhow!("no crate directory for {}", package.name))?; + .with_context(|| format!("no crate directory for {}", package.name))?; if let Some(license_file) = first_license_file(crate_dir, LICENSE_FILES) { if !license_file.is_symlink() { diff --git a/tooling/xtask/src/tasks/package_conformity.rs b/tooling/xtask/src/tasks/package_conformity.rs index b594798d260a05d939fd1f3459146d6d5fa7100a..c82b9cdf845b594fa0571a45839bc3fb5bed3582 100644 --- a/tooling/xtask/src/tasks/package_conformity.rs +++ b/tooling/xtask/src/tasks/package_conformity.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; use std::fs; use std::path::Path; -use anyhow::{Context as _, Result, anyhow}; +use anyhow::{Context as _, Result}; use cargo_toml::{Dependency, Manifest}; use clap::Parser; @@ -78,5 +78,5 @@ fn read_cargo_toml(path: impl AsRef) -> Result { let path = path.as_ref(); let cargo_toml_bytes = fs::read(path)?; Manifest::from_slice(&cargo_toml_bytes) - .with_context(|| anyhow!("failed to read Cargo.toml at {path:?}")) + .with_context(|| format!("reading Cargo.toml at {path:?}")) } diff --git a/typos.toml b/typos.toml index 29828bda89ba8011135892443978d73bb95e3e94..83d1f2967d4bb8872d27efa2932533defca0a708 100644 --- a/typos.toml +++ b/typos.toml @@ -47,7 +47,9 @@ extend-exclude = [ # Eval examples for prompts and criteria "crates/eval/src/examples/", # typos-cli doesn't understand our `vˇariable` markup - "crates/editor/src/hover_links.rs" + "crates/editor/src/hover_links.rs", + # typos-cli doesn't understand `setis` is intentional test case + "crates/editor/src/code_completion_tests.rs" ] [default]