From f9792d8571f684179995da5c295de5989a5455f8 Mon Sep 17 00:00:00 2001 From: Katie Geer Date: Thu, 18 Dec 2025 08:58:25 -0800 Subject: [PATCH] More reconciling? --- docs/src/SUMMARY.md | 116 ++++++++++++------------------ docs/src/dev-containers.md | 49 +++++++++++++ docs/src/languages/javascript.md | 30 +++++++- docs/src/languages/ruby.md | 11 +-- docs/src/languages/tailwindcss.md | 30 ++++---- docs/src/languages/typescript.md | 30 +++++++- docs/src/worktree-trust.md | 18 ++--- 7 files changed, 177 insertions(+), 107 deletions(-) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index d8a821c176713e8a154b167494918f602bffefb5..1f9c5750ea76b35a2f7f5464b7b6684401108d2b 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -6,8 +6,55 @@ - [Installation](./installation.md) - [Update](./update.md) - [Uninstall](./uninstall.md) +- [Authenticate](./authentication.md) +- [Telemetry](./telemetry.md) - [Troubleshooting](./troubleshooting.md) +# Configuration + +- [Configuring Zed](./configuring-zed.md) +- [Configuring Languages](./configuring-languages.md) + - [Toolchains](./toolchains.md) +- [Key bindings](./key-bindings.md) + - [All Actions](./all-actions.md) +- [Snippets](./snippets.md) +- [Themes](./themes.md) +- [Icon Themes](./icon-themes.md) +- [Visual Customization](./visual-customization.md) +- [Vim Mode](./vim.md) +- [Helix Mode](./helix.md) +- [Privacy and Security](./ai/privacy-and-security.md) + - [Worktree Trust](./worktree-trust.md) + - [AI Improvement](./ai/ai-improvement.md) + + + + +# Using Zed + +- [Multibuffers](./multibuffers.md) +- [Command Palette](./command-palette.md) +- [Command-line Interface](./command-line-interface.md) +- [Outline Panel](./outline-panel.md) +- [Code Completions](./completions.md) +- [Collaboration](./collaboration/overview.md) + - [Channels](./collaboration/channels.md) + - [Contacts and Private Calls](./collaboration/contacts-and-private-calls.md) +- [Git](./git.md) +- [Debugger](./debugger.md) +- [Diagnostics](./diagnostics.md) +- [Tasks](./tasks.md) +- [Tab Switcher](./tab-switcher.md) +- [Remote Development](./remote-development.md) +- [Dev Containers](./dev-containers.md) +- [Environment Variables](./environment.md) +- [REPL](./repl.md) + +# Platform Support + +- [Windows](./windows.md) +- [Linux](./linux.md) + # AI - [Overview](./ai/overview.md) @@ -27,56 +74,6 @@ - [Plans and Usage](./ai/plans-and-usage.md) - [Billing](./ai/billing.md) -# Working with Code - -- [Editing Code](./completions.md) - - [Code Completions](./completions.md) - - [Diagnostics & Quick Fixes](./diagnostics.md) - - [Multibuffers](./multibuffers.md) -- [Finding & Navigating](./command-palette.md) - - [Command Palette](./command-palette.md) - - [Outline Panel](./outline-panel.md) - - [Tab Switcher](./tab-switcher.md) -- [Running & Testing](./tasks.md) - - [Tasks](./tasks.md) - - [Debugger](./debugger.md) - - [REPL](./repl.md) -- [Git](./git.md) - -# Collaboration - -- [Overview](./collaboration/overview.md) - - [Channels](./collaboration/channels.md) - - [Contacts and Private Calls](./collaboration/contacts-and-private-calls.md) - -# Remote Development - -- [Remote Development](./remote-development.md) -- [Environment Variables](./environment.md) - - -# Customization - -- [Appearance](./themes.md) - - [Themes](./themes.md) - - [Icon Themes](./icon-themes.md) - - [Fonts & Visual Tweaks](./visual-customization.md) -- [Keybindings](./key-bindings.md) - - [Custom Key Bindings](./key-bindings.md) - - [Vim Mode](./vim.md) - - [Helix Mode](./helix.md) -- [Snippets](./snippets.md) - - - - - - -# Platform Support - -- [Windows](./windows.md) -- [Linux](./linux.md) - # Extensions - [Overview](./extensions.md) @@ -102,8 +99,6 @@ # Language Support - [All Languages](./languages.md) -- [Configuring Languages](./configuring-languages.md) - - [Toolchains](./toolchains.md) - [Ansible](./languages/ansible.md) - [AsciiDoc](./languages/asciidoc.md) - [Astro](./languages/astro.md) @@ -175,23 +170,6 @@ - [Yarn](./languages/yarn.md) - [Zig](./languages/zig.md) -# Reference - -- [All Settings](./reference/all-settings.md) -- [All Actions](./reference/all-actions.md) -- [Default Key Bindings](./reference/default-key-bindings.md) -- [CLI Reference](./reference/cli.md) -- [Environment Variables](./reference/environment-variables.md) -- [Glob Patterns](./reference/glob-patterns.md) - -# Account & Privacy - -- [Sign In](./authentication.md) -- [Privacy and Security](./ai/privacy-and-security.md) - - [Worktree Trust](./worktree-trust.md) - - [AI Improvement](./ai/ai-improvement.md) -- [Telemetry](./telemetry.md) - # Developing Zed - [Developing Zed](./development.md) diff --git a/docs/src/dev-containers.md b/docs/src/dev-containers.md index f00c0394b27ab983236db6b8bd195df04204c4d4..c87b204ee9cded48edb95752dd234fa55df71338 100644 --- a/docs/src/dev-containers.md +++ b/docs/src/dev-containers.md @@ -1 +1,50 @@ # Dev Containers + +Dev Containers provide a consistent, reproducible development environment by defining your project's dependencies, tools, and settings in a container configuration. + +If your repository includes a `.devcontainer/devcontainer.json` file, Zed can open a project inside a development container. + +## Requirements + +- Docker must be installed and available in your `PATH`. Zed requires the `docker` command to be present. If you use Podman, you can alias it to `docker` (e.g., `alias docker=podman`). +- Your project must contain a `.devcontainer/devcontainer.json` directory/file. + +## Using Dev Containers in Zed + +### Automatic prompt + +When you open a project that contains the `.devcontainer/devcontainer.json` directory/file, Zed will display a prompt asking whether to open the project inside the dev container. Choosing "Open in Container" will: + +1. Build the dev container image (if needed). +2. Launch the container. +3. Reopen the project connected to the container environment. + +### Manual open + +If you dismiss the prompt or want to reopen the project inside a container later, you can use Zed's command palette to run the "Project: Open Remote" command and select the option to open the project in a dev container. +Alternatively, you can reach for the Remote Projects modal (through the {#kb projects::OpenRemote} binding) and choose the "Connect Dev Container" option. + +## Editing the dev container configuration + +If you modify `.devcontainer/devcontainer.json`, Zed does not currently rebuild or reload the container automatically. After changing configuration: + +- Stop or kill the existing container manually (e.g., via `docker kill `). +- Reopen the project in the container. + +## Working in a Dev Container + +Once connected, Zed operates inside the container environment for tasks, terminals, and language servers. +Files are linked from your workspace into the container according to the dev container specification. + +## Known Limitations + +> **Note:** This feature is still in development. + +- **Extensions:** Zed does not yet manage extensions separately for container environments. The host's extensions are used as-is. +- **Port forwarding:** Only the `appPort` field is supported. `forwardPorts` and other advanced port-forwarding features are not implemented. +- **Configuration changes:** Updates to `devcontainer.json` do not trigger automatic rebuilds or reloads; containers must be manually restarted. + +## See also + +- [Remote Development](./remote-development.md) for connecting to remote servers over SSH. +- [Tasks](./tasks.md) for running commands in the integrated terminal. diff --git a/docs/src/languages/javascript.md b/docs/src/languages/javascript.md index 1b87dac5553f0dc44153d4706be1dd4bd2e341d5..f043c642b305a8dba2b0985a75954438bb024c4c 100644 --- a/docs/src/languages/javascript.md +++ b/docs/src/languages/javascript.md @@ -175,6 +175,34 @@ You can configure ESLint's `workingDirectory` setting: } ``` +## Using the Tailwind CSS Language Server with JavaScript + +To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in vanilla JavaScript files (`.js`), you can customize the `classRegex` field under it in your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "experimental": { + "classRegex": [ + "\\.className\\s*[+]?=\\s*['\"]([^'\"]*)['\"]", + "\\.setAttributeNS\\(.*,\\s*['\"]class['\"],\\s*['\"]([^'\"]*)['\"]", + "\\.setAttribute\\(['\"]class['\"],\\s*['\"]([^'\"]*)['\"]", + "\\.classList\\.add\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.remove\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.toggle\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.contains\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.replace\\(\\s*['\"]([^'\"]*)['\"]", + "\\.classList\\.replace\\([^,)]+,\\s*['\"]([^'\"]*)['\"]" + ] + } + } + } + } +} +``` + ## Debugging Zed supports debugging JavaScript code out of the box with `vscode-js-debug`. @@ -186,7 +214,7 @@ The following can be debugged without writing additional configuration: Run {#action debugger::Start} ({#kb debugger::Start}) to see a contextual list of these predefined debug tasks. > **Note:** Bun test is automatically detected when `@types/bun` is present in `package.json`. -> + > **Note:** Node test is automatically detected when `@types/node` is present in `package.json` (requires Node.js 20+). As for all languages, configurations from `.vscode/launch.json` are also available for debugging in Zed. diff --git a/docs/src/languages/ruby.md b/docs/src/languages/ruby.md index 7e072ac5d32ab990584a2c2b0be57eb3076b1ec9..f7f0ccce83354fb24372f6916f27c63156f8cb3c 100644 --- a/docs/src/languages/ruby.md +++ b/docs/src/languages/ruby.md @@ -258,17 +258,10 @@ To enable Steep, add `\"steep\"` to the `language_servers` list for Ruby in your ## 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. - -In order to do that, you need to configure the language server so that it knows about where to look for CSS classes in Ruby/ERB files by adding the following to your `settings.json`: +To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in Ruby/ERB files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`: ```json [settings] { - "languages": { - "Ruby": { - "language_servers": ["tailwindcss-language-server", "..."] - } - }, "lsp": { "tailwindcss-language-server": { "settings": { @@ -281,7 +274,7 @@ In order to do that, you need to configure the language server so that it knows } ``` -With these settings you will get completions for Tailwind CSS classes in HTML attributes inside ERB files and inside Ruby/ERB strings that are coming after a `class:` key. Examples: +With these settings, you will get completions for Tailwind CSS classes in HTML attributes inside ERB files and inside Ruby/ERB strings that are coming after a `class:` key. Examples: ```rb # Ruby file: diff --git a/docs/src/languages/tailwindcss.md b/docs/src/languages/tailwindcss.md index be9c9437d1382dfd356120663ebea2c1fe012684..457c71f9768610f5bfdf345e72c27311632f1bef 100644 --- a/docs/src/languages/tailwindcss.md +++ b/docs/src/languages/tailwindcss.md @@ -4,9 +4,23 @@ Zed has built-in support for Tailwind CSS autocomplete, linting, and hover previ - Language Server: [tailwindlabs/tailwindcss-intellisense](https://github.com/tailwindlabs/tailwindcss-intellisense) +Languages which can be used with Tailwind CSS in Zed: + +- [Astro](./astro.md) +- [CSS](./css.md) +- [ERB](./ruby.md) +- [Gleam](./gleam.md) +- [HEEx](./elixir.md#heex) +- [HTML](./html.md) +- [TypeScript](./typescript.md) +- [JavaScript](./javascript.md) +- [PHP](./php.md) +- [Svelte](./svelte.md) +- [Vue](./vue.md) + ## Configuration -To configure the Tailwind CSS language server, refer [to the extension settings](https://github.com/tailwindlabs/tailwindcss-intellisense?tab=readme-ov-file#extension-settings) and add them to the `lsp` section of your `settings.json`: +If by default the language server isn't enough to make Tailwind work for a given language, you can configure the language server settings and add them to the `lsp` section of your `settings.json`: ```json [settings] { @@ -23,19 +37,7 @@ To configure the Tailwind CSS language server, refer [to the extension settings] } ``` -Languages which can be used with Tailwind CSS in Zed: - -- [Astro](./astro.md) -- [CSS](./css.md) -- [ERB](./ruby.md) -- [Gleam](./gleam.md) -- [HEEx](./elixir.md#heex) -- [HTML](./html.md) -- [TypeScript](./typescript.md) -- [JavaScript](./javascript.md) -- [PHP](./php.md) -- [Svelte](./svelte.md) -- [Vue](./vue.md) +Refer to [the Tailwind CSS language server settings docs](https://github.com/tailwindlabs/tailwindcss-intellisense?tab=readme-ov-file#extension-settings) for more information. ### Prettier Plugin diff --git a/docs/src/languages/typescript.md b/docs/src/languages/typescript.md index a6ec5b71ecb1815aeb4ff3811eec6f9a5c57a54b..d4fccc38f8a460e9ec097dee249a6441bd34a344 100644 --- a/docs/src/languages/typescript.md +++ b/docs/src/languages/typescript.md @@ -45,6 +45,34 @@ Prettier will also be used for TypeScript files by default. To disable this: } ``` +## Using the Tailwind CSS Language Server with TypeScript + +To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in vanilla TypeScript files (`.ts`), you can customize the `classRegex` field under it in your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "experimental": { + "classRegex": [ + "\\.className\\s*[+]?=\\s*['\"]([^'\"]*)['\"]", + "\\.setAttributeNS\\(.*,\\s*['\"]class['\"],\\s*['\"]([^'\"]*)['\"]", + "\\.setAttribute\\(['\"]class['\"],\\s*['\"]([^'\"]*)['\"]", + "\\.classList\\.add\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.remove\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.toggle\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.contains\\(['\"]([^'\"]*)['\"]", + "\\.classList\\.replace\\(\\s*['\"]([^'\"]*)['\"]", + "\\.classList\\.replace\\([^,)]+,\\s*['\"]([^'\"]*)['\"]" + ] + } + } + } + } +} +``` + ## Large projects `vtsls` may run out of memory on very large projects. We default the limit to 8092 (8 GiB) vs. the default of 3072 but this may not be sufficient for you: @@ -167,7 +195,7 @@ The following can be debugged without writing additional configuration: Run {#action debugger::Start} ({#kb debugger::Start}) to see a contextual list of these predefined debug tasks. > **Note:** Bun test is automatically detected when `@types/bun` is present in `package.json`. -> + > **Note:** Node test is automatically detected when `@types/node` is present in `package.json` (requires Node.js 20+). As for all languages, configurations from `.vscode/launch.json` are also available for debugging in Zed. diff --git a/docs/src/worktree-trust.md b/docs/src/worktree-trust.md index 158851117bfdc4d00746594d74e1e6dae0bb84dc..590f063a75ac5d77e60d50f03af4795d6ec2961f 100644 --- a/docs/src/worktree-trust.md +++ b/docs/src/worktree-trust.md @@ -4,11 +4,11 @@ A worktree in Zed is either a directory or a single file that Zed opens as a sta Zed opens a worktree every time `zed some/path` is invoked, on drag and dropping a file or directory into Zed, on opening user settings.json, etc. Every worktree opened may contain a `.zed/settings.json` file with extra configuration options that may require installing and spawning language servers or MCP servers. -Note that the Zed workspace itself may also perform user-configured MCP server installation and spawning, even if no worktrees are open. +In order to provide users the opportunity to make their own choices according to their unique threat model and risk tolerance, all worktrees will be started in Restricted mode, which prevents download and execution of any related items from `.zed/settings.json`. Until configured to trust the worktree(s), Zed will not perform any related untrusted actions and will wait for user confirmation. This gives users a chance to review and understand any pre-configured settings, MCP servers, or language servers associated with a project. -In order to provide users the opportunity to make their own choices according to their unique threat model and risk tolerance, the workspace and all worktrees will be started in Restricted mode, which prevents download and execution of any related items. Until configured to trust the workspace and/or worktrees, Zed will not perform any untrusted actions and will wait for user confirmation. This gives users a chance to review and understand any pre-configured settings, MCP servers, or language servers associated with a project. +Note that at this point, Zed trusts the tools it installs itself, hence global entities such as global MCP servers, language servers like prettier and copilot are still in installed and started as usual, independent of worktree trust. -If a worktree is not trusted, Zed will indicate this with an exclamation mark icon in the title bar and a message in the Agent panel. Clicking this icon or using `workspace::ToggleWorktreeSecurity` action will bring up the security modal that allows the user to trust the worktree. +If a worktree is not trusted, Zed will indicate this with an exclamation mark icon in the title bar. Clicking this icon or using `workspace::ToggleWorktreeSecurity` action will bring up the security modal that allows the user to trust the worktree. Trusting any worktree will persist this information between restarts. It's possible to clear all trusted worktrees with `workspace::ClearTrustedWorktrees` command. This command will restart Zed, to ensure no untrusted settings, language servers or MCP servers persist. @@ -25,7 +25,7 @@ Restricted Mode prevents: ## Configuring broad worktree trust -By default, Zed won't trust any new worktrees and users will be required to trust each new worktree. Though not recommended, users may elect to trust all worktrees and the current workspace for a given session by configuring the following setting: +By default, Zed won't trust any new worktrees and users will be required to trust each new worktree. Though not recommended, users may elect to trust all worktrees by configuring the following setting: ```json [settings] "session": { @@ -47,20 +47,12 @@ A typical scenario where a directory might be open and a single file is subseque Spawning a language server presents a risk should the language server experience a supply-chain attack; therefore, Zed restricts that by default. Each single file worktree requires a separate trust grant, unless the directory containing it is trusted or all worktrees are trusted. -- "workspace" - -Even an empty Zed workspace with no files or directories open presents a risk if new MCP servers are locally configured by the user without review. For instance, opening an Assistant Panel and creating a new external agent thread might require installing and running new user-configured [Model Context Protocol servers](./ai/mcp.md). By default, zed will restrict a new MCP server until the user elects to trust the local workspace. Users may also disable the entire Agent panel if preferred; see [AI Configuration](./ai/configuration.md) for more details. - -Workspace trust, permitted by trusting Zed with no worktrees open, allows locally configured resources to be downloaded and executed. Workspace trust is per host and also trusts all single file worktrees from the same host in order to permit all local user-configured MCP and language servers to start. - - "directory worktree" If a directory is open in Zed, it's a full worktree which may spawn multiple language servers associated with it or spawn MCP servers if contained in a project settings file.Therefore, each directory worktree requires a separate trust grant unless a parent directory worktree trust is granted (see below). -When a directory worktree is trusted, language and MCP servers are permitted to be downloaded and started, hence we also enable workspace trust for the host in question automatically when this occurs. +When a directory worktree is trusted, language and MCP servers are permitted to be downloaded and started, hence we also enable single file worktree trust for the host in question automatically when this occurs: this helps when opening single files when using language server features in the trusted directory worktree. - "parent directory worktree" To permit trust decisions for multiple directory worktrees at once, it's possible to trust all subdirectories of a given parent directory worktree opened in Zed by checking the appropriate checkbox. This will grant trust to all its subdirectories, including all current and potential directory worktrees. - -This also automatically enables workspace trust to permit the newly trusted resources to download and start.