diff --git a/crates/collab/README.md b/crates/collab/README.md index 4e73f4b416..345e82aefe 100644 --- a/crates/collab/README.md +++ b/crates/collab/README.md @@ -10,7 +10,7 @@ It contains our back-end logic for collaboration, to which we connect from the Z Before you can run the collab server locally, you'll need to set up a zed Postgres database. -``` +```sh script/bootstrap ``` @@ -32,13 +32,13 @@ To use a different set of admin users, create `crates/collab/seed.json`. In one terminal, run Zed's collaboration server and the livekit dev server: -``` +```sh foreman start ``` In a second terminal, run two or more instances of Zed. -``` +```sh script/zed-local -2 ``` @@ -64,7 +64,7 @@ You can tell what is currently deployed with `./script/what-is-deployed`. To create a new migration: -``` +```sh ./script/create-migration ``` diff --git a/crates/gpui/README.md b/crates/gpui/README.md index eecbf8a606..f1cbebadcb 100644 --- a/crates/gpui/README.md +++ b/crates/gpui/README.md @@ -7,7 +7,7 @@ for Rust, designed to support a wide variety of applications. GPUI is still in active development as we work on the Zed code editor and isn't yet on crates.io. You'll also need to use the latest version of stable rust and be on macOS. Add the following to your Cargo.toml: -``` +```toml gpui = { git = "https://github.com/zed-industries/zed" } ``` diff --git a/crates/gpui/docs/key_dispatch.md b/crates/gpui/docs/key_dispatch.md index 804a0b5761..3198e12443 100644 --- a/crates/gpui/docs/key_dispatch.md +++ b/crates/gpui/docs/key_dispatch.md @@ -4,7 +4,7 @@ GPUI is designed for keyboard-first interactivity. To expose functionality to the mouse, you render a button with a click handler. -To expose functionality to the keyboard, you bind an *action* in a *key context*. +To expose functionality to the keyboard, you bind an _action_ in a _key context_. Actions are similar to framework-level events like `MouseDown`, `KeyDown`, etc, but you can define them yourself: @@ -55,7 +55,7 @@ impl Render for Menu { } ``` -In order to bind keys to actions, you need to declare a *key context* for part of the element tree by calling `key_context`. +In order to bind keys to actions, you need to declare a _key context_ for part of the element tree by calling `key_context`. ```rust impl Render for Menu { @@ -97,5 +97,4 @@ If you had opted for the more complex type definition, you'd provide the seriali "shift-down": ["menu::Move", {direction: "down", select: true}] } } - ``` diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index b3b35172b3..d68392cf51 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -623,7 +623,7 @@ pub trait InputHandler: 'static { ); /// Replace the text in the given document range with the given text, - /// and mark the given text as part of of an IME 'composing' state + /// and mark the given text as part of an IME 'composing' state /// Corresponds to [setMarkedText(_:selectedRange:replacementRange:)](https://developer.apple.com/documentation/appkit/nstextinputclient/1438246-setmarkedtext) /// /// range_utf16 is in terms of UTF-16 characters diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs index ebf1d0d0e3..36246a2264 100644 --- a/crates/languages/src/rust.rs +++ b/crates/languages/src/rust.rs @@ -626,7 +626,7 @@ fn human_readable_package_name(package_directory: &Path) -> Option { // For providing local `cargo check -p $pkgid` task, we do not need most of the information we have returned. // Output example in the root of Zed project: -// ```bash +// ```sh // ❯ cargo pkgid zed // path+file:///absolute/path/to/project/zed/crates/zed#0.131.0 // ``` diff --git a/crates/storybook/docs/thoughts.md b/crates/storybook/docs/thoughts.md index 9416f25933..cdeef621f3 100644 --- a/crates/storybook/docs/thoughts.md +++ b/crates/storybook/docs/thoughts.md @@ -1,6 +1,5 @@ Much of element styling is now handled by an external engine. - How do I make an element hover. There's a hover style. @@ -15,11 +14,8 @@ struct Hoverable { impl Element for Hoverable { } - ``` - - ```rs #[derive(Styled, Interactive)] pub struct Div { @@ -50,23 +46,12 @@ pub trait Interactive { struct Interactions { click: SmallVec<[; 1]>, } - - ``` - ```rs - - trait Stylable { type Style; fn with_style(self, style: Self::Style) -> Self; } - - - - - - ``` diff --git a/crates/theme/theme.md b/crates/theme/theme.md index d19d147597..4cb19eb3c4 100644 --- a/crates/theme/theme.md +++ b/crates/theme/theme.md @@ -7,7 +7,7 @@ This crate provides the theme system for Zed. A theme is a collection of colors used to build a consistent appearance for UI components across the application. To produce a theme in Zed, -A theme is made of of two parts: A [ThemeFamily] and one or more [Theme]s. +A theme is made of two parts: A [ThemeFamily] and one or more [Theme]s. // A [ThemeFamily] contains metadata like theme name, author, and theme-specific [ColorScales] as well as a series of themes. diff --git a/crates/vim/README.md b/crates/vim/README.md index 7533b0697f..67e97a4a0b 100644 --- a/crates/vim/README.md +++ b/crates/vim/README.md @@ -24,7 +24,7 @@ async fn test_visual_star_hash(cx: &mut gpui::TestAppContext) { To keep CI runs fast, by default the neovim tests use a cached JSON file that records what neovim did (see crates/vim/test_data), but while developing this test you'll need to run it with the neovim flag enabled: -``` +```sh cargo test -p vim --features neovim test_visual_star_hash ``` diff --git a/docs/README.md b/docs/README.md index 194b973ff2..e510cb2589 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,9 +4,9 @@ Welcome to Zed's documentation. This is built on push to `main` and published automatically to [https://zed.dev/docs](https://zed.dev/docs). -To preview the docs locally you will need to install [mdBook](https://rust-lang.github.io/mdBook/), and then run: +To preview the docs locally you will need to install [mdBook](https://rust-lang.github.io/mdBook/) (`cargo install mdbook`) and then run: -``` +```sh mdbook serve docs ``` diff --git a/docs/book.toml b/docs/book.toml index 1f439be205..c2b152c2dd 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -20,3 +20,4 @@ enable = false "/javascript.html" = "/docs/languages/javascript.html" "/ruby.html" = "/docs/languages/ruby.html" "/python.html" = "/docs/languages/python.html" +"/adding-new-languages.html" = "/docs/extensions/languages.html" diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index ac9d54c76e..4d222f3d64 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -5,21 +5,25 @@ - [Getting Started](./getting-started.md) - [System Requirements](./system-requirements.md) - [Linux](./linux.md) + - [Windows](./windows.md) - [Telemetry](./telemetry.md) - [Additional Learning Materials](./additional-learning-materials.md) # Configuration - [Configuring Zed](./configuring-zed.md) +- [Configuring Languages](./configuring-languages.md) - [Key bindings](./key-bindings.md) - [Snippets](./snippets.md) - [Themes](./themes.md) + - [Vim](./vim.md) # Using Zed - [Multibuffers](./multibuffers.md) - [Language model integration](./language-model-integration.md) +- [Code Completions](./completions.md) - [Channels](./channels.md) - [Collaboration](./collaboration.md) - [Git](./git.md) @@ -27,9 +31,21 @@ - [Remote Development](./remote-development.md) - [REPL](./repl.md) +# Extensions + +- [Overview](./extensions.md) +- [Installing Extensions](./extensions/installing-extensions.md) +- [Developing Extensions](./extensions/developing-extensions.md) +- [Language Extensions](./extensions/languages.md) +- [Theme Extensions](./extensions/themes.md) + # Language Support +- [All Languages](./languages.md) +- [AsciiDoc](./languages/asciidoc.md) - [Astro](./languages/astro.md) +- [Bash](./languages/bash.md) +- [Biome](./languages/biome.md) - [C](./languages/c.md) - [C++](./languages/cpp.md) - [C#](./languages/csharp.md) @@ -37,17 +53,29 @@ - [CSS](./languages/css.md) - [Dart](./languages/dart.md) - [Deno](./languages/deno.md) +- [Docker](./languages/docker.md) - [Elixir](./languages/elixir.md) - [Elm](./languages/elm.md) +- [Emmet](./languages/emmet.md) - [Erlang](./languages/erlang.md) +- [Fish](./languages/fish.md) +- [GDScript](./languages/gdscript.md) - [Gleam](./languages/gleam.md) +- [GLSL](./languages/glsl.md) - [Go](./languages/go.md) +- [Groovy](./languages/groovy.md) - [Haskell](./languages/haskell.md) - [HTML](./languages/html.md) +- [Java](./languages/java.md) - [JavaScript](./languages/javascript.md) +- [Julia](./languages/julia.md) - [JSON](./languages/json.md) +- [Kotlin](./languages/kotlin.md) - [Lua](./languages/lua.md) +- [Luau](./languages/luau.md) +- [Makefile](./languages/makefile.md) - [Markdown](./languages/markdown.md) +- [Nim](./languages/nim.md) - [OCaml](./languages/ocaml.md) - [PHP](./languages/php.md) - [Prisma](./languages/prisma.md) @@ -55,11 +83,16 @@ - [PureScript](./languages/purescript.md) - [Python](./languages/python.md) - [R](./languages/r.md) +- [ReStructuredText](./languages/rst.md) - [Racket](./languages/racket.md) +- [Roc](./languages/roc.md) - [Ruby](./languages/ruby.md) - [Rust](./languages/rust.md) +- [Scala](./languages/scala.md) - [Scheme](./languages/scheme.md) - [Svelte](./languages/svelte.md) +- [Swift](./languages/swift.md) +- [TailwindCSS](./languages/tailwindcss.md) - [Terraform](./languages/terraform.md) - [TOML](./languages/toml.md) - [TypeScript](./languages/typescript.md) @@ -71,8 +104,7 @@ # Developing Zed -- [Adding New Languages](./adding-new-languages.md) -- [Developing Zed](./developing-zed.md) +- [Developing Zed](./development.md) - [macOS](./development/macos.md) - [Linux](./development/linux.md) - [Windows](./development/windows.md) diff --git a/docs/src/adding-new-languages.md b/docs/src/adding-new-languages.md deleted file mode 100644 index 28ffd714b2..0000000000 --- a/docs/src/adding-new-languages.md +++ /dev/null @@ -1,83 +0,0 @@ -# Adding New Languages to Zed - -## LSP - -Zed uses the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) to provide language support. This means, in theory, we can support any language that has an LSP server. - -## Syntax Highlighting - -### Defining syntax highlighting rules - -We use tree-sitter queries to match certain properties to highlight. - -#### Simple Example: - -```scheme -(property_identifier) @property -``` - -```ts -const font: FontFamily = { - weight: "normal", - underline: false, - italic: false, -}; -``` - -Match a property identifier and highlight it using the identifier `@property`. In the above example, `weight`, `underline`, and `italic` would be highlighted. - -#### Complex example: - -```scheme -(_ - return_type: (type_annotation - [ - (type_identifier) @type.return - (generic_type - name: (type_identifier) @type.return) - ])) -``` - -```ts -function buildDefaultSyntax(colorScheme: Theme): Partial { - // ... -} -``` - -Match a function return type, and highlight the type using the identifier `@type.return`. In the above example, `Partial` would be highlighted. - -#### Example - Typescript - -Here is an example portion of our `highlights.scm` for TypeScript: - -```scheme -; crates/zed/src/languages/typescript/highlights.scm - -; Variables - -(identifier) @variable - -; Properties - -(property_identifier) @property - -; Function and method calls - -(call_expression - function: (identifier) @function) - -(call_expression - function: (member_expression - property: (property_identifier) @function.method)) - -; Function and method definitions - -(function - name: (identifier) @function) -(function_declaration - name: (identifier) @function) -(method_definition - name: (property_identifier) @function.method) - -; ... -``` diff --git a/docs/src/channels.md b/docs/src/channels.md index 9e2ab37c5c..a794928858 100644 --- a/docs/src/channels.md +++ b/docs/src/channels.md @@ -31,23 +31,19 @@ After joining a channel, you can `Share` a project with the other people there. 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. -### Following +See [our collaboration documentation](./collaboration.md) for more details about how this works. -You can follow someone by clicking on their avatar in the top bar, or their name in the collaboration panel. When following, your pane will show you what they are looking at, even if they are jumping between different files in the project. If you want to stop following them, you can by scrolling around, or clicking in a different part of the file. - -Following is incredibly useful when you’re learning a new codebase, or trying to debug together. Because you can always see what each person is looking at, there’s no confusion as to what is being talked about. - -As a bonus, if the other person is sharing their screen, you can follow them out of Zed and see what is going on, so you can see if the code you wrote together really works. - -### Notes & Chat +### 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.
-The chat is also there for quickly sharing context, or getting questions answered, that are more ephemeral in nature. +This is similar to a Google Doc, except powered by Zed's collaborative software and persisted to our servers. -Between the two, you can use Zed’s collaboration mode for large-scale changes with multiple people tackling different aspects of the problem. Because you’re all working on the same copy of the code, there are no merge conflicts, and because you all have access to the same notes, it’s easy to track progress and keep everyone in the loop. +### 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 diff --git a/docs/src/collaboration.md b/docs/src/collaboration.md index 70be0c354b..2ad347f7dd 100644 --- a/docs/src/collaboration.md +++ b/docs/src/collaboration.md @@ -4,8 +4,6 @@ Only collaborate with people that you trust. Since sharing a project gives them In the future, we will do more to prevent this type of access beyond the shared project and add more control over what collaborators can do, but for now, only collaborate with people you trust. -Note: we are working on a new version of this feature called [Channels](channels/). If you'd like to be part of the private beta, please contact us! - ## Adding a collaborator to a call Before you can collaborate, you'll need to add a collaborator to your contacts. To do this: @@ -26,13 +24,17 @@ When you invite a collaborator to a project not in a call they will receive a no ### Inviting non-Zed users -If someone you want to collaborate with has not yet signed up for Zed, they will need to [download the app](https://zed.dev/download) and sign in for the first time before you can add them. +If someone you want to collaborate with has not yet signed up for Zed, they will need to [download the app](https://zed.dev/download) and sign in for the first time before you can add them. Identity is tied to GitHub accounts, so new users will need to authenticate with GitHub in order to sign into Zed. + +### Voice chat + +When joining a call, Zed will automatically share your microphone with other users in the call, if your OS allows it. This isn't tied to your project. You can disable this for your client via the [`mute_on_join`](./configuring-zed.md#calls) setting. ## Collaborating on a project ### Share a project -When you invite a collaborator to join your project, a new call begins. Your Zed windows will show the call participants in the top right of the window. +When you invite a collaborator to join your project, a new call begins. Your Zed windows will show the call participants in the title bar of the window. ![A new Zed call with two collaborators](https://zed.dev/img/collaboration/new-call.png) diff --git a/docs/src/completions.md b/docs/src/completions.md new file mode 100644 index 0000000000..9663d6f162 --- /dev/null +++ b/docs/src/completions.md @@ -0,0 +1,91 @@ +# Completions + +Zed supports supports two sources for completions: + +1. "Code Completions" provided by Language Servers (LSPs) automatically installed by Zed or via [Zed Language Extensions](languages.md). +2. "Inline Completions" provided by external APIs like [GitHub Copilot](#github-copilot) or [Supermaven](#supermaven). + +## Code Completions + +When there is an appropriate language server available, Zed will by-default provide completions of variable names, functions, and other symbols in the current file. You can disable these by adding the following to your zed settings.json file: + +```json + "show_completions_on_input": false +``` + +You can manually trigger completions with `ctrl-space` or by triggering the `editor::ShowCompletions` action from the command palette. + +For more information, see : + +- [Configuring Supported Languages](./configuring-languages.md) +- [List of Zed Supported Languages](./languages.md). + +## Configuring Inline Completions + +### GitHub Copilot + +To use GitHub Copilot (enabled by default), add the following to your `settings.json`: + +```json +{ + "features": { + "inline_completion_provider": "copilot" + } +} +``` + +You should be able to sign-in to GitHub Copilot by clicking on the Copilot icon in the status bar and following the setup instructions. + +### Supermaven + +To use Supermaven, add the following to your `settings.json`: + +```json +{ + "features": { + "inline_completion_provider": "supermaven" + } +} +``` + +You should be able to sign-in to Supermaven by clicking on the Supermaven icon in the status bar and following the setup instructions. + +## Using Inline completions + +Once you have configured an Inline Completions provider, you can start using inline completions in your code. Inline completions will appear as you type, and you can accept them by pressing `tab` or `enter` or hide them by pressing `esc`. + +There a number of actions/shortcuts available to interact with inline completions: + +- `editor: accept inline completion` (`tab`): To accept the current inline completion +- `editor: accept partial inline completion` (`cmd-right`): To accept the current inline completion up to the next word boundary +- `editor: show inline completion` (`alt-\\`): Trigger a inline completion request manually +- `editor: next inline completion` (`alt-]`): To cycle to the next inline completion +- `editor: previous inline completion` (`alt-[`): To cycle to the previous inline completion + +### Disabling Inline-Completions + +To disable completions that appear automatically as you type, add the following to your `settings.json`: + +```json +{ + "show_inline_completions": false +} +``` + +You can trigger inline completions manually by executing `editor: show inline completion` (`alt-\\`). + +You can also add this as a language-specific setting in your `settings.json` to disable inline completions for a specific language: + +```json +{ + "language": { + "python": { + "show_inline_completions": false + } + } +} +``` + +## See also + +You may also use the Assistant Panel or the Inline Assistant to interact with language models, see [Language Model Integration](language-model-integration.md) documentation for more information. diff --git a/docs/src/configuring-languages.md b/docs/src/configuring-languages.md new file mode 100644 index 0000000000..d8d1860f61 --- /dev/null +++ b/docs/src/configuring-languages.md @@ -0,0 +1,413 @@ +# Configuring supported languages + +Zed offers powerful customization options for each programming language it supports. This guide will walk you through the various ways you can tailor your coding experience to your preferences and project requirements. + +Zed's language support is built on two main technologies: + +1. Tree-sitter: This handles syntax highlighting and structure-based features like the outline panel. +2. Language Server Protocol (LSP): This provides semantic features such as code completion and diagnostics. + +These components work together to provide Zed's language capabilities. + +In this guide, we'll cover: + +- Language-specific settings +- File associations +- Working with language servers +- Formatting and linting configuration +- Customizing syntax highlighting and themes +- Advanced language features + +By the end of this guide, you should know how to configure and customize supported languages in Zed. + +For a comprehensive list of languages supported by Zed and their specific configurations, see our [Supported Languages](./languages.md) page. To go further, you could explore developing your own extensions to add support for additional languages or enhance existing functionality. For more information on creating language extensions, see our [Language Extensions](./extensions/languages.md) guide. + +## Language-specific Settings + +Zed allows you to override global settings for individual languages. These custom configurations are defined in your `settings.json` file under the `languages` key. + +Here's an example of language-specific settings: + +```json +"languages": { + "Python": { + "tab_size": 4, + "formatter": "language_server", + "format_on_save": true + }, + "JavaScript": { + "tab_size": 2, + "formatter": { + "external": { + "command": "prettier", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } + } + } +} +``` + +You can customize a wide range of settings for each language, including: + +- `tab_size`: The number of spaces for each indentation level +- `formatter`: The tool used for code formatting +- `format_on_save`: Whether to automatically format code when saving +- `enable_language_server`: Toggle language server support +- `hard_tabs`: Use tabs instead of spaces for indentation +- `preferred_line_length`: The recommended maximum line length +- `soft_wrap`: How to wrap long lines of code + +These settings allow you to maintain specific coding styles across different languages and projects. + +## File Associations + +Zed automatically detects file types based on their extensions, but you can customize these associations to fit your workflow. + +To set up custom file associations, use the `file_types` setting in your `settings.json`: + +```json +"file_types": { + "C++": ["c"], + "TOML": ["MyLockFile"], + "Dockerfile": ["Dockerfile*"] +} +``` + +This configuration tells Zed to: + +- Treat `.c` files as C++ instead of C +- Recognize files named "MyLockFile" as TOML +- Apply Dockerfile syntax to any file starting with "Dockerfile" + +You can use glob patterns for more flexible matching, allowing you to handle complex naming conventions in your projects. + +## Working with Language Servers + +Language servers are a crucial part of Zed's intelligent coding features, providing capabilities like auto-completion, go-to-definition, and real-time error checking. + +### What are Language Servers? + +Language servers implement the Language Server Protocol (LSP), which standardizes communication between the editor and language-specific tools. This allows Zed to support advanced features for multiple programming languages without implementing each feature separately. + +Some key features provided by language servers include: + +- Code completion +- Error checking and diagnostics +- Code navigation (go to definition, find references) +- Code actions (Rename, extract method) +- Hover information +- Workspace symbol search + +### Managing Language Servers + +Zed simplifies language server management for users: + +1. Automatic Download: When you open a file with a matching file type, Zed automatically downloads the appropriate language server. Zed may prompt you to install an extension for known file types. + +2. Storage Location: + + - macOS: `~/Library/Application Support/Zed/languages` + - Linux: `$XDG_DATA_HOME/languages`, `$FLATPAK_XDG_DATA_HOME/languages`, or `$HOME/.local/share` + +3. Automatic Updates: Zed keeps your language servers up-to-date, ensuring you always have the latest features and improvements. + +### Choosing Language Servers + +Some languages in Zed offer multiple language server options. You might have multiple extensions installed that bundle language servers targeting the same language, potentially leading to overlapping capabilities. To ensure you get the functionality you prefer, Zed allows you to prioritize which language servers are used and in what order. + +You can specify your preference using the `language_servers` setting: + +```json + "languages": { + "PHP": { + "language_servers": ["intelephense", "!phpactor", "..."] + } + } +``` + +In this example: + +- `intelephense` is set as the primary language server +- `phpactor` is disabled (note the `!` prefix) +- `...` preserves any other default language server settings + +This configuration allows you to tailor the language server setup to your specific needs, ensuring that you get the most suitable functionality for your development workflow. + +### Configuring Language Servers + +Many language servers accept custom configuration options. You can set these in the `lsp` section of your `settings.json`: + +```json + "lsp": { + "rust-analyzer": { + "initialization_options": { + "checkOnSave": { + "command": "clippy" + } + } + } + } +``` + +This example configures the Rust Analyzer to use Clippy for additional linting when saving files. + +When configuring language server options in Zed, it's important to use nested objects rather than dot-delimited strings. This is particularly relevant when working with more complex configurations. Let's look at a real-world example using the TypeScript language server: + +Suppose you want to configure the following settings for TypeScript: + +- Enable strict null checks +- Set the target ECMAScript version to ES2020 +- Configure import organization preferences + +Here's how you would structure these settings in Zed's `settings.json`: + +Here's how you might incorrectly attempt to set these options using dot notation: + +```json +"lsp": { + "typescript-language-server": { + "initialization_options": { + // This is not supported: + // "preferences.strictNullChecks": true, + // You express it like this: + "preferences": { + "strictNullChecks": true + } + } + } +} +``` + +### Enabling or Disabling Language Servers + +You can toggle language server support globally or per-language: + +```json + "languages": { + "Markdown": { + "enable_language_server": false + } + } +``` + +This disables the language server for Markdown files, which can be useful for performance in large documentation projects. You can configure this globally in your `~/.zed/settings.json` or inside a `.zed/settings.json` in your project directory. + +## Formatting and Linting + +Zed provides support for code formatting and linting to maintain consistent code style and catch potential issues early. + +### Configuring Formatters + +Zed supports both built-in and external formatters. Configure formatters globally or per-language in your `settings.json`: + +```json +"languages": { + "JavaScript": { + "formatter": { + "external": { + "command": "prettier", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } + }, + "format_on_save": true + }, + "Rust": { + "formatter": "language_server", + "format_on_save": true + } +} +``` + +This example uses Prettier for JavaScript and the language server's formatter for Rust, both set to format on save. + +To disable formatting for a specific language: + +```json +"languages": { + "Markdown": { + "format_on_save": false + } +} +``` + +### Setting Up Linters + +Linting in Zed is typically handled by language servers. Many language servers allow you to configure linting rules: + +```json +"lsp": { + "eslint": { + "settings": { + "codeActionOnSave": { + "rules": ["import/order"] + } + } + } +} +``` + +This configuration sets up ESLint to organize imports on save for JavaScript files. + +To run linter fixes automatically on save: + +```json +"languages": { + "JavaScript": { + "code_actions_on_format": { + "source.fixAll.eslint": true + } + } +} +``` + +### Integrating Formatting and Linting + +Zed allows you to run both formatting and linting on save. Here's an example that uses Prettier for formatting and ESLint for linting JavaScript files: + +```json +"languages": { + "JavaScript": { + "formatter": { + "external": { + "command": "prettier", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } + }, + "code_actions_on_format": { + "source.fixAll.eslint": true + }, + "format_on_save": true + } +} +``` + +### Troubleshooting + +If you encounter issues with formatting or linting: + +1. Check Zed's log file for error messages (Use the command palette: `zed: open log`) +2. Ensure external tools (formatters, linters) are correctly installed and in your PATH +3. Verify configurations in both Zed settings and language-specific config files (e.g., `.eslintrc`, `.prettierrc`) + +## Syntax Highlighting and Themes + +Zed offers customization options for syntax highlighting and themes, allowing you to tailor the visual appearance of your code. + +### Customizing Syntax Highlighting + +Zed uses Tree-sitter grammars for syntax highlighting. Override the default highlighting using the `experimental.theme_overrides` setting: + +```json +"experimental.theme_overrides": { + "syntax": { + "comment": { + "font_style": "italic" + }, + "string": { + "color": "#00AA00" + } + } +} +``` + +This example makes comments italic and changes the color of strings. + +### Language-Specific Theme Overrides + +Apply theme overrides for specific languages: + +```json +"languages": { + "Python": { + "theme_overrides": { + "syntax": { + "function": { + "color": "#0000FF" + } + } + } + } +} +``` + +This configuration changes the color of function names in Python files. + +### Selecting and Customizing Themes + +Change your theme: + +1. Use the theme selector (Cmd+K Cmd+T on macOS, Ctrl+K Ctrl+T on Linux) +2. Or set it in your `settings.json`: + +```json +"theme": { + "mode": "dark", + "dark": "One Dark", + "light": "GitHub Light" +} +``` + +Create custom themes by creating a JSON file in `~/.config/zed/themes/`. Zed will automatically detect and make available any themes in this directory. + +### Using Theme Extensions + +Zed supports theme extensions. Browse and install theme extensions from the Extensions panel (Cmd+Shift+E). + +To create your own theme extension, refer to the [Developing Theme Extensions](./extensions/themes.md) guide. + +## Using Language Server Features + +### Inlay Hints + +Inlay hints provide additional information inline in your code, such as parameter names or inferred types. Configure inlay hints in your `settings.json`: + +```json +"inlay_hints": { + "enabled": true, + "show_type_hints": true, + "show_parameter_hints": true, + "show_other_hints": true +} +``` + +For language-specific inlay hint settings, refer to the documentation for each language. + +### Code Actions + +Code actions provide quick fixes and refactoring options. Access code actions using the `editor: Toggle Code Actions` command or by clicking the lightbulb icon that appears next to your cursor when actions are available. + +### Go To Definition and References + +Use these commands to navigate your codebase: + +- `editor: Go to Definition` (F12) +- `editor: Go to Type Definition` (Cmd+F12 on macOS, Ctrl+F12 on Linux) +- `editor: Find All References` (Shift+F12) + +### Rename Symbol + +To rename a symbol across your project: + +1. Place your cursor on the symbol +2. Use the `editor: Rename Symbol` command (F2) +3. Enter the new name and press Enter + +These features depend on the capabilities of the language server for each language. + +When renaming a symbol that spans multiple files, Zed will open a preview in a multibuffer. This allows you to review all the changes across your project before applying them. To confirm the rename, simply save the multibuffer. If you decide not to proceed with the rename, you can undo the changes or close the multibuffer without saving. + +### Hover Information + +Use the `editor: Show Hover` command to display information about the symbol under the cursor. This often includes type information, documentation, and links to relevant resources. + +### Workspace Symbol Search + +The `workspace: Open Symbol` command allows you to search for symbols (functions, classes, variables) across your entire project. This is useful for quickly navigating large codebases. + +### Code Completion + +Zed provides intelligent code completion suggestions as you type. You can manually trigger completion with the `editor: Show Completions` command. Use Tab or Enter to accept suggestions. + +### Diagnostics + +Language servers provide real-time diagnostics (errors, warnings, hints) as you code. View all diagnostics for your project using the `diagnostics: Toggle` command. diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index 083682fb00..417d1920c7 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -6,6 +6,13 @@ In addition to the settings described here, you may also want to change your [th ## Settings files + + Your settings file can be opened with `cmd-,` (on macOS) or `ctrl-,` (on Linux). By default it is located at `~/.config/zed/settings.json`, though if you have XDG_CONFIG_HOME in your environment on Linux it will be at `$XDG_CONFIG_HOME/zed/settings.json` instead. This configuration is merged with any local configuration inside your projects. You can open the project settings by running `zed: Open Local Settings` from the command palette. This will create a `.zed` directory containing`.zed/settings.json`. @@ -220,7 +227,7 @@ There are two options to choose from: - Description: A list of globs representing files that inline completions should be disabled for. - Setting: `disabled_globs` -- Default: [".env"] +- Default: `[".env"]` **Options** @@ -586,7 +593,7 @@ To override settings for a language, add an entry for that language server's nam } ``` -3. Or to use code actions provided by the connected language servers, use `"code_actions"` (requires Zed `0.130.x`): +3. Or to use code actions provided by the connected language servers, use `"code_actions"`: ```json { @@ -626,6 +633,10 @@ If any of the formatters fails, the subsequent ones will still be executed. **Examples** + + 1. Organize imports on format in TypeScript and TSX buffers: ```json @@ -645,7 +656,7 @@ If any of the formatters fails, the subsequent ones will still be executed. } ``` -2. Run ESLint `fixAll` code action when formatting (requires Zed `0.125.0`): +2. Run ESLint `fixAll` code action when formatting: ```json { @@ -659,7 +670,7 @@ If any of the formatters fails, the subsequent ones will still be executed. } ``` -3. Run only a single ESLint rule when using `fixAll` (requires Zed `0.125.0`): +3. Run only a single ESLint rule when using `fixAll`: ```json { @@ -779,7 +790,7 @@ To interpret all `.c` files as C++, files called `MyLockFile` as TOML and files ### Indent Guides -- Description: Configuration related to indent guides (requires Zed `0.138.0`). Indent guides can be configured separately for each language. +- Description: Configuration related to indent guides. Indent guides can be configured separately for each language. - Setting: `indent_guides` - Default: @@ -848,7 +859,7 @@ To interpret all `.c` files as C++, files called `MyLockFile` as TOML and files ### Inline Git Blame -- Description: Whether or not to show git blame information inline, on the currently focused line (requires Zed `0.132.0`). +- Description: Whether or not to show git blame information inline, on the currently focused line. - Setting: `inline_blame` - Default: @@ -1035,7 +1046,6 @@ These values take in the same options as the root-level settings with the same n ## Preview tabs - Description: - (requires Zed `0.132.x`) \ Preview tabs allow you to open files in preview mode, where they close automatically when you switch to another file unless you explicitly pin them. This is useful for quickly viewing files without cluttering your workspace. Preview tabs display their file names in italics. \ There are several ways to convert a preview tab into a regular tab: @@ -1068,7 +1078,7 @@ These values take in the same options as the root-level settings with the same n ### Enable preview from code navigation -- Description: Determines whether a preview tab gets replaced when code navigation is used to navigate away from the tab (requires Zed `0.134.x`). +- Description: Determines whether a preview tab gets replaced when code navigation is used to navigate away from the tab. - Setting: `enable_preview_from_code_navigation` - Default: `false` @@ -1244,25 +1254,27 @@ List of `integer` column numbers - Default: ```json -"terminal": { - "alternate_scroll": "off", - "blinking": "terminal_controlled", - "copy_on_select": false, - "env": {}, - "font_family": null, - "font_features": null, - "font_size": null, - "option_as_meta": true, - "button": false, - "shell": {}, - "toolbar": { - "title": true - }, - "working_directory": "current_project_directory" +{ + "terminal": { + "alternate_scroll": "off", + "blinking": "terminal_controlled", + "copy_on_select": false, + "env": {}, + "font_family": null, + "font_features": null, + "font_size": null, + "option_as_meta": true, + "button": false, + "shell": {}, + "toolbar": { + "title": true + }, + "working_directory": "current_project_directory" + } } ``` -### Alternate Scroll +### Terminal: Alternate Scroll - Description: Set whether Alternate Scroll mode (DECSET code: `?1007`) is active by default. Alternate Scroll mode converts mouse scroll events into up / down key presses when in the alternate screen (e.g. when running applications like vim or less). The terminal can still set and unset this mode with ANSI escape codes. - Setting: `alternate_scroll` @@ -1274,7 +1286,9 @@ List of `integer` column numbers ```json { - "alternate_scroll": "on" + "terminal": { + "alternate_scroll": "on" + } } ``` @@ -1282,11 +1296,13 @@ List of `integer` column numbers ```json { - "alternate_scroll": "off" + "terminal": { + "alternate_scroll": "off" + } } ``` -### Blinking +### Terminal: Blinking - Description: Set the cursor blinking behavior in the terminal - Setting: `blinking` @@ -1298,7 +1314,9 @@ List of `integer` column numbers ```json { - "blinking": "off" + "terminal": { + "blinking": "off" + } } ``` @@ -1306,17 +1324,23 @@ List of `integer` column numbers ```json { - "blinking": "terminal_controlled" + "terminal": { + "blinking": "terminal_controlled" + } } ``` 3. Always blink the cursor, ignore the terminal mode ```json -"blinking": "on", +{ + "terminal": { + "blinking": "on" + } +} ``` -### Copy On Select +### Terminal: Copy On Select - Description: Whether or not selecting text in the terminal will automatically copy to the system clipboard. - Setting: `copy_on_select` @@ -1326,7 +1350,17 @@ List of `integer` column numbers `boolean` values -### Env +**Example** + +```json +{ + "terminal": { + "copy_on_select": true + } +} +``` + +### Terminal: Env - Description: Any key-value pairs added to this object will be added to the terminal's environment. Keys must be unique, use `:` to separate multiple values in a single variable - Setting: `env` @@ -1335,13 +1369,17 @@ List of `integer` column numbers **Example** ```json -"env": { - "ZED": "1", - "KEY": "value1:value2" +{ + "terminal": { + "env": { + "ZED": "1", + "KEY": "value1:value2" + } + } } ``` -### Font Size +### Terminal: Font Size - Description: What font size to use for the terminal. When not set defaults to matching the editor's font size - Setting: `font_size` @@ -1351,7 +1389,15 @@ List of `integer` column numbers `integer` values -### Font Family +```json +{ + "terminal": { + "font_size": 15 + } +} +``` + +### Terminal: Font Family - Description: What font to use for the terminal. When not set, defaults to matching the editor's font. - Setting: `font_family` @@ -1361,7 +1407,15 @@ List of `integer` column numbers The name of any font family installed on the user's system -### Font Features +```json +{ + "terminal": { + "font_family": "Berkeley Mono" + } +} +``` + +### Terminal: Font Features - Description: What font features to use for the terminal. When not set, defaults to matching the editor's font features. - Setting: `font_features` @@ -1371,7 +1425,18 @@ The name of any font family installed on the user's system See Buffer Font Features -### Option As Meta +```jsonc +{ + "terminal": { + "font_features": { + "calt": false, + // See Buffer Font Features for more features + }, + }, +} +``` + +### Terminal: Option As Meta - Description: Re-interprets the option keys to act like a 'meta' key, like in Emacs. - Setting: `option_as_meta` @@ -1381,7 +1446,15 @@ See Buffer Font Features `boolean` values -### Shell +```json +{ + "terminal": { + "option_as_meta": true + } +} +``` + +### Terminal: Shell - Description: What shell to use when launching the terminal. - Setting: `shell` @@ -1393,46 +1466,60 @@ See Buffer Font Features ```json { - "shell": "system" + "terminal": { + "shell": "system" + } } ``` 2. A program to launch: ```json -"shell": { - "program": "sh" +{ + "terminal": { + "shell": { + "program": "sh" + } + } } ``` 3. A program with arguments: ```json -"shell": { - "with_arguments": { - "program": "/bin/bash", - "args": ["--login"] +{ + "terminal": { + "shell": { + "with_arguments": { + "program": "/bin/bash", + "args": ["--login"] + } + } } } ``` -## Terminal Toolbar +## Terminal: Toolbar - Description: Whether or not to show various elements in the terminal toolbar. It only affects terminals placed in the editor pane. - Setting: `toolbar` - Default: ```json -"toolbar": { - "title": true, -}, +{ + "terminal": { + "toolbar": { + "title": true + } + } +} ``` **Options** At the moment, only the `title` option is available, it controls displaying of the terminal title that can be changed via `PROMPT_COMMAND`. If the title is hidden, the terminal toolbar is not displayed. -### Terminal Button +### Terminal: Button - Description: Control to show or hide the terminal button in the status bar - Setting: `button` @@ -1442,7 +1529,15 @@ At the moment, only the `title` option is available, it controls displaying of t `boolean` values -### Working Directory +```json +{ + "terminal": { + "button": false + } +} +``` + +### Terminal: Working Directory - Description: What working directory to use when launching the terminal. - Setting: `working_directory` @@ -1454,7 +1549,9 @@ At the moment, only the `title` option is available, it controls displaying of t ```json { - "working_directory": "current_project_directory" + "terminal": { + "working_directory": "current_project_directory" + } } ``` @@ -1462,7 +1559,9 @@ At the moment, only the `title` option is available, it controls displaying of t ```json { - "working_directory": "first_project_directory" + "terminal": { + "working_directory": "first_project_directory" + } } ``` @@ -1470,16 +1569,22 @@ At the moment, only the `title` option is available, it controls displaying of t ```json { - "working_directory": "always_home" + "terminal": { + "working_directory": "always_home" + } } ``` 4. Always use a specific directory. This value will be shell expanded. If this path is not a valid directory the terminal will default to this platform's home directory. ```json -"working_directory": { - "always": { - "directory": "~/zed/projects/" +{ + "terminal": { + "working_directory": { + "always": { + "directory": "~/zed/projects/" + } + } } } ``` diff --git a/docs/src/developing-zed.md b/docs/src/development.md similarity index 71% rename from docs/src/developing-zed.md rename to docs/src/development.md index 41130522ad..ecd68a1181 100644 --- a/docs/src/developing-zed.md +++ b/docs/src/development.md @@ -12,5 +12,8 @@ If you'd like to develop collaboration features, additionally see: ## Contributor links +- [CONTRIBUTING.md](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md) - [Releases](./development/releases.md) - [Debugging Crashes](./development/debugging-crashes.md) +- [Code of Conduct](./code-of-conduct.md) +- [Zed Contributor License](https://zed.dev/cla) diff --git a/docs/src/development/debugging-crashes.md b/docs/src/development/debugging-crashes.md index 1c624ecfca..1676237681 100644 --- a/docs/src/development/debugging-crashes.md +++ b/docs/src/development/debugging-crashes.md @@ -2,9 +2,12 @@ ## Crashes -When an app crashes, macOS creates a `.ips` file in `~/Library/Logs/DiagnosticReports`. You can view these using the built in Console app (`cmd-space Console`) under "Crash Reports". +When an app crashes, -If you have enabled Zed's telemetry these will be uploaded to us when you restart the app. They end up in Datadog, and a [Slack channel (internal only)](https://zed-industries.slack.com/archives/C04S6T1T7TQ). +- macOS creates a `.ips` file in `~/Library/Logs/DiagnosticReports`. You can view these using the built in Console app (`cmd-space Console`) under "Crash Reports". +- Linux creates a core dump. See the [man pages](https://man7.org/linux/man-pages/man5/core.5.html) for pointers to how your system might be configured to manage core dumps. + +If you have enabled Zed's telemetry these will be uploaded to us when you restart the app. They end up in a [Slack channel (internal only)](https://zed-industries.slack.com/archives/C04S6T1T7TQ). These crash reports are generated by the crashing binary, and contain a wealth of information; but they are hard to read for a few reasons: @@ -12,9 +15,9 @@ These crash reports are generated by the crashing binary, and contain a wealth o - The symbols are [mangled](https://doc.rust-lang.org/rustc/symbol-mangling/index.html) - Inlined functions are elided -To get a better sense of the backtrace of a crash you can download the `.ips` file locally and run: +On macOS, to get a better sense of the backtrace of a crash you can download the `.ips` file locally and run: -``` +```sh ./script/symbolicate ~/path/zed-XXX-XXX.ips ``` @@ -24,6 +27,6 @@ The output contains the source file and line number, and the demangled symbol in ## Panics -When the app panics at the rust level, Zed creates a file in `~/Library/Logs/Zed` with the text of the panic, and a summary of the backtrace. On boot, if you have telemetry enabled, we upload these panics so we can keep track of them. +When the app panics at the rust level, Zed creates a file in `~/Library/Logs/Zed` or `$XDG_DATA_HOME/logs` with the text of the panic, and a summary of the backtrace. On boot, if you have telemetry enabled, we upload these panics so we can keep track of them. A panic is also considered a crash, and so for most panics we get both the crash report and the panic. diff --git a/docs/src/development/linux.md b/docs/src/development/linux.md index 45e0e941b9..df414ca5b7 100644 --- a/docs/src/development/linux.md +++ b/docs/src/development/linux.md @@ -8,13 +8,13 @@ Clone down the [Zed repository](https://github.com/zed-industries/zed). - Install [Rust](https://www.rust-lang.org/tools/install). If it's already installed, make sure it's up-to-date: - ```bash + ```sh rustup update ``` - Install the necessary system libraries: - ```bash + ```sh script/linux ``` @@ -41,19 +41,19 @@ Once the dependencies are installed, you can build Zed using [Cargo](https://doc For a debug build of the editor: -``` +```sh cargo run ``` And to run the tests: -``` +```sh cargo test --workspace ``` In release mode, the primary user interface is the `cli` crate. You can run it in development with: -``` +```sh cargo run -p cli ``` @@ -61,7 +61,7 @@ cargo run -p cli You can install a local build on your machine with: -``` +```sh ./script/install-linux ``` diff --git a/docs/src/development/local-collaboration.md b/docs/src/development/local-collaboration.md index 41ca04b8cd..177e997af9 100644 --- a/docs/src/development/local-collaboration.md +++ b/docs/src/development/local-collaboration.md @@ -10,7 +10,7 @@ First, make sure you've installed Zed's backend dependencies for your platform: Before you can run the `collab` server locally, you'll need to set up a `zed` Postgres database. -``` +```sh script/bootstrap ``` @@ -18,7 +18,7 @@ This script will set up the `zed` Postgres database, and populate it with some u The script will seed the database with various content defined by: -``` +```sh cat crates/collab/seed.default.json ``` @@ -35,18 +35,14 @@ To use a different set of admin users, you can create your own version of that j In one terminal, run Zed's collaboration server and the `livekit` dev server: -``` - +```sh foreman start - ``` In a second terminal, run two or more instances of Zed. -``` - +```sh script/zed-local -2 - ``` This script starts one to four instances of Zed, depending on the `-2`, `-3` or `-4` flags. Each instance will be connected to the local `collab` server, signed in as a different user from `.admins.json` or `.admins.default.json`. @@ -55,7 +51,7 @@ This script starts one to four instances of Zed, depending on the `-2`, `-3` or If you want to run your own version of the zed collaboration service, you can, but note that this is still under development, and there is no good support for authentication nor extensions. -Configuration is done through environment variables. By default it will read the configuration from [`.env.toml`](../../crates/collab/.env.toml) and you should use that as a guide for setting this up. +Configuration is done through environment variables. By default it will read the configuration from [`.env.toml`](https://github.com/zed-industries/zed/blob/main/crates/collab/.env.toml) and you should use that as a guide for setting this up. By default Zed assumes that the DATABASE_URL is a Postgres database, but you can make it use Sqlite by compiling with `--features sqlite` and using a sqlite DATABASE_URL with `?mode=rwc`. diff --git a/docs/src/development/macos.md b/docs/src/development/macos.md index 6168cb7a3d..89275f37bf 100644 --- a/docs/src/development/macos.md +++ b/docs/src/development/macos.md @@ -13,19 +13,19 @@ Clone down the [Zed repository](https://github.com/zed-industries/zed). - Install [Xcode command line tools](https://developer.apple.com/xcode/resources/) - ```bash + ```sh xcode-select --install ``` - Ensure that the Xcode command line tools are using your newly installed copy of Xcode: - ``` + ```sh sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer ``` * Install the Rust wasm toolchain: - ```bash + ```sh rustup target add wasm32-wasi ``` @@ -36,7 +36,7 @@ If you are developing collaborative features of Zed, you'll need to install the - Install [Postgres](https://postgresapp.com) - Install [Livekit](https://formulae.brew.sh/formula/livekit) and [Foreman](https://formulae.brew.sh/formula/foreman) - ```bash + ```sh brew install livekit foreman ``` @@ -52,19 +52,19 @@ Once you have the dependencies installed, you can build Zed using [Cargo](https: For a debug build: -``` +```sh cargo run ``` For a release build: -``` +```sh cargo run --release ``` And to run the tests: -``` +```sh cargo test --workspace ``` @@ -72,7 +72,7 @@ cargo test --workspace ### Error compiling metal shaders -``` +```sh error: failed to run custom build command for gpui v0.1.0 (/Users/path/to/zed)`** xcrun: error: unable to find utility "metal", not a developer tool or in PATH @@ -88,7 +88,7 @@ Try `cargo clean` and `cargo build`. If you encounter an error similar to: -```bash +```sh src/platform/mac/dispatch.h:1:10: fatal error: 'dispatch/dispatch.h' file not found Caused by: @@ -105,20 +105,20 @@ Caused by: This file is part of Xcode. Ensure you have installed the Xcode command line tools and set the correct path: -```bash +```sh xcode-select --install sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer ``` Additionally, set the `BINDGEN_EXTRA_CLANG_ARGS` environment variable: -```bash +```sh export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=$(xcrun --show-sdk-path)" ``` Then clean and rebuild the project: -```bash +```sh cargo clean cargo run ``` diff --git a/docs/src/development/windows.md b/docs/src/development/windows.md index c159d11dc4..b027721271 100644 --- a/docs/src/development/windows.md +++ b/docs/src/development/windows.md @@ -10,13 +10,13 @@ Clone down the [Zed repository](https://github.com/zed-industries/zed). - Install [Rust](https://www.rust-lang.org/tools/install). If it's already installed, make sure it's up-to-date: - ```bash + ```sh rustup update ``` - Install the Rust wasm toolchain: - ```bash + ```sh rustup target add wasm32-wasi ``` @@ -44,34 +44,36 @@ Once you have the dependencies installed, you can build Zed using [Cargo](https: For a debug build: -``` +```sh cargo run ``` For a release build: -``` +```sh cargo run --release ``` And to run the tests: -``` +```sh cargo test --workspace ``` ## Installing from msys2 -[MSYS2](https://msys2.org/) distribution provides Zed as a package. To download the prebuilt binary, run +[MSYS2](https://msys2.org/) distribution provides Zed as a package [mingw-w64-zed](https://packages.msys2.org/base/mingw-w64-zed). To download the prebuilt binary, run -``` +```sh pacman -Syu pacman -S mingw-w64-ucrt-x86_64-zed ``` then you can run `zed` in a UCRT64 shell. -> Please, report any issue in https://github.com/msys2/MINGW-packages/issues first. +You can see the [build script](https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-zed/PKGBUILD) for more details. + +> Please, report any issue in [msys2/MINGW-packages/issues](https://github.com/msys2/MINGW-packages/issues?q=is%3Aissue+is%3Aopen+zed) first. ## Troubleshooting diff --git a/docs/src/extensions.md b/docs/src/extensions.md new file mode 100644 index 0000000000..060c819ecb --- /dev/null +++ b/docs/src/extensions.md @@ -0,0 +1,8 @@ +# Extensions + +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 Themes](./extensions/themes.md) diff --git a/docs/src/extensions/developing-extensions.md b/docs/src/extensions/developing-extensions.md new file mode 100644 index 0000000000..f6eabab301 --- /dev/null +++ b/docs/src/extensions/developing-extensions.md @@ -0,0 +1,104 @@ +# Developing Extensions + +## Extension Capabilities + +Extensions can add the following capabilities to Zed: + +- [Languages](./languages.md) +- [Themes](./themes.md) + +## Directory Structure of a Zed Extension + +A Zed extension is a Git repository that contains an `extension.toml`. This file must contain some +basic information about the extension: + +```toml +id = "my-extension" +name = "My extension" +version = "0.0.1" +schema_version = 1 +authors = ["Your Name "] +description = "My cool extension" +repository = "https://github.com/your-name/my-zed-extension" +``` + + + +In addition to this, there are several other optional files and directories that can be used to add functionality to a Zed extension. An example directory structure of an extension that provides all capabilities is as follows: + +``` +my-extension/ + extension.toml + Cargo.toml + src/ + lib.rs + languages/ + config.toml + highlights.scm + themes/ + my-theme.json +``` + +## WebAssembly + +Procedural parts of extensions are written in Rust and compiled to WebAssembly. To develop an extension that includes custom code, include a `Cargo.toml` like this: + +```toml +[package] +name = "my-extension" +version = "0.0.1" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +zed_extension_api = "0.0.6" +``` + +Make sure to use the latest version of the [`zed_extension_api`](https://crates.io/crates/zed_extension_api) available on crates.io. + +In the `src/lib.rs` file in your Rust crate you will need to define a struct for your extension and implement the `Extension` trait, as well as use the `register_extension!` macro to register your extension: + +```rs +use zed_extension_api as zed; + +struct MyExtension { + // ... state +} + +impl zed::Extension for MyExtension { + // ... +} + +zed::register_extension!(MyExtension); +``` + +## Developing an Extension Locally + +When developing an extension, you can use it in Zed without needing to publish it by installing it as a _dev extension_. + +From the extensions page, click the `Install Dev Extension` button and select the directory containing your extension. + +If you already have a published extension with the same name installed, your dev extension will override it. + +## Publishing your extension + +To publish an extension, open a PR to [this 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 +2. Add a new entry to the top-level `extensions.toml` file containing your extension: + +```toml +[my-extension] +submodule = "extensions/my-extension" +version = "0.0.1" +``` + +3. Run `pnpm sort-extensions` to ensure `extensions.toml` and `.gitmodules` are sorted + +Once your PR is merged, the extension will be packaged and published to the Zed extension registry. diff --git a/docs/src/extensions/installing-extensions.md b/docs/src/extensions/installing-extensions.md new file mode 100644 index 0000000000..fd629d9f25 --- /dev/null +++ b/docs/src/extensions/installing-extensions.md @@ -0,0 +1,15 @@ +# Installing Extensions + +You can search for extensions by launching the Zed Extension Gallery by pressing `cmd-shift-x` (MacOS) or `ctrl-shift-x` (Linux), opening the command palette and selecting `zed: extensions` or by selecting "Zed > Extensions" from the menu bar. + +Here you can view the extensions that you currently have installed or search and install new ones. + +## Installation Location + +- On macOS, extensions are installed in `~/Library/Application Support/Zed/extensions`. +- On Linux, they are installed in either `$XDG_DATA_HOME/zed/extensions` or `~/.local/share/zed/extensions`. + +This directory contains two subdirectories: + +- `installed`, which contains the source code for each extension. +- `work` which contains files created by the extension itself, such as downloaded language servers. diff --git a/docs/src/extensions/languages.md b/docs/src/extensions/languages.md new file mode 100644 index 0000000000..90de3f658d --- /dev/null +++ b/docs/src/extensions/languages.md @@ -0,0 +1,319 @@ +# Language Extensions + +Language support in Zed has several components: + +- Language metadata and configuration +- Grammar +- Queries +- Language servers + +## Language Metadata + +Each language supported by Zed must be defined in a subdirectory inside the `languages` directory of your extension. + +This subdirectory must contain a file called `config.toml` file with the following structure: + +```toml +name = "My Language" +grammar = "my-language" +path_suffixes = ["myl"] +line_comments = ["# "] +``` + +- `name` is the human readable name that will show up in the Select Language dropdown. +- `grammar` is the name of a grammar. Grammars are registered separately, described below. +- `path_suffixes` (optional) is an array of file suffixes that should be associated with this language. This supports glob patterns like `config/**/*.toml` where `**` matches 0 or more directories and `*` matches 0 or more characters. +- `line_comments` (optional) is an array of strings that are used to identify line comments in the language. + + + +## Grammar + +Zed uses the [Tree-sitter](https://tree-sitter.github.io) parsing library to provide built-in language-specific features. There are grammars available for many languages, and you can also [develop your own grammar](https://tree-sitter.github.io/tree-sitter/creating-parsers#writing-the-grammar). A growing list of Zed features are built using pattern matching over syntax trees with Tree-sitter queries. As mentioned above, every language that is defined in an extension must specify the name of a Tree-sitter grammar that is used for parsing. These grammars are then registered separately in extensions' `extension.toml` file, like this: + +```toml +[grammars.gleam] +repository = "https://github.com/gleam-lang/tree-sitter-gleam" +commit = "58b7cac8fc14c92b0677c542610d8738c373fa81" +``` + +The `repository` field must specify a repository where the Tree-sitter grammar should be loaded from, and the `commit` field must contain the SHA of the Git commit to use. An extension can provide multiple grammars by referencing multiple tree-sitter repositories. + +## Tree-sitter Queries + +Zed uses the syntax tree produced by the [Tree-sitter](https://tree-sitter.github.io) query language to implement +several features: + +- Syntax highlighting +- Bracket matching +- Code outline/structure +- Auto-indentation +- Code injections +- Syntax overrides +- Text redactions +- Runnable code detection + +The following sections elaborate on how [Tree-sitter queries](https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax) enable these +features in Zed, using [JSON syntax](https://www.json.org/json-en.html) as a guiding example. + +### Syntax highlighting + +In Tree-sitter, the `highlights.scm` file defines syntax highlighting rules for a particular syntax. + +Here's an example from a `highlights.scm` for JSON: + +```scheme +(string) @string + +(pair + key: (string) @property.json_key) + +(number) @number +``` + +This query marks strings, object keys, and numbers for highlighting. The following is a comprehensive list of captures supported by themes: + +| Capture | Description | +| ------------------------ | -------------------------------------- | +| @attribute | Captures attributes | +| @boolean | Captures boolean values | +| @comment | Captures comments | +| @comment.doc | Captures documentation comments | +| @constant | Captures constants | +| @constructor | Captures constructors | +| @embedded | Captures embedded content | +| @emphasis | Captures emphasized text | +| @emphasis.strong | Captures strongly emphasized text | +| @enum | Captures enumerations | +| @function | Captures functions | +| @hint | Captures hints | +| @keyword | Captures keywords | +| @label | Captures labels | +| @link_text | Captures link text | +| @link_uri | Captures link URIs | +| @number | Captures numeric values | +| @operator | Captures operators | +| @predictive | Captures predictive text | +| @preproc | Captures preprocessor directives | +| @primary | Captures primary elements | +| @property | Captures properties | +| @punctuation | Captures punctuation | +| @punctuation.bracket | Captures brackets | +| @punctuation.delimiter | Captures delimiters | +| @punctuation.list_marker | Captures list markers | +| @punctuation.special | Captures special punctuation | +| @string | Captures string literals | +| @string.escape | Captures escaped characters in strings | +| @string.regex | Captures regular expressions | +| @string.special | Captures special strings | +| @string.special.symbol | Captures special symbols | +| @tag | Captures tags | +| @text.literal | Captures literal text | +| @title | Captures titles | +| @type | Captures types | +| @variable | Captures variables | +| @variable.special | Captures special variables | +| @variant | Captures variants | + +### Bracket matching + +The `brackets.scm` file defines matching brackets. + +Here's an example from a `brackets.scm` file for JSON: + +```scheme +("[" @open "]" @close) +("{" @open "}" @close) +("\"" @open "\"" @close) +``` + +This query identifies opening and closing brackets, braces, and quotation marks. + +| Capture | Description | +| ------- | --------------------------------------------- | +| @open | Captures opening brackets, braces, and quotes | +| @close | Captures closing brackets, braces, and quotes | + +### Code outline/structure + +The `outline.scm` file defines the structure for the code outline. + +Here's an example from an `outline.scm` file for JSON: + +```scheme +(pair + key: (string (string_content) @name)) @item +``` + +This query captures object keys for the outline structure. + +| Capture | Description | +| -------------- | ------------------------------------------------------------------------------------ | +| @name | Captures the content of object keys | +| @item | Captures the entire key-value pair | +| @context | Captures elements that provide context for the outline item | +| @context.extra | Captures additional contextual information for the outline item | +| @annotation | Captures nodes that annotate outline item (doc comments, attributes, decorators)[^1] | + +[^1]: These annotations are used by Assistant when generating code modification steps. + +### Auto-indentation + +The `indents.scm` file defines indentation rules. + +Here's an example from an `indents.scm` file for JSON: + +```scheme +(array "]" @end) @indent +(object "}" @end) @indent +``` + +This query marks the end of arrays and objects for indentation purposes. + +| Capture | Description | +| ------- | -------------------------------------------------- | +| @end | Captures closing brackets and braces | +| @indent | Captures entire arrays and objects for indentation | + +### Code injections + +The `injections.scm` file defines rules for embedding one language within another, such as code blocks in Markdown or SQL queries in Python strings. + +Here's an example from an `injections.scm` file for Markdown: + +```scheme +(fenced_code_block + (info_string + (language) @language) + (code_fence_content) @content) + +((inline) @content + (#set! "language" "markdown-inline")) +``` + +This query identifies fenced code blocks, capturing the language specified in the info string and the content within the block. It also captures inline content and sets its language to "markdown-inline". + +| Capture | Description | +| --------- | ---------------------------------------------------------- | +| @language | Captures the language identifier for a code block | +| @content | Captures the content to be treated as a different language | + +Note that we couldn't use JSON as an example here because it doesn't support language injections. + +### Syntax overrides + +The `overrides.scm` file defines syntax overrides. + +Here's an example from an `overrides.scm` file for JSON: + +```scheme +(string) @string +``` + +This query explicitly marks strings for highlighting, potentially overriding default behavior. For a complete list of supported captures, refer to the [Syntax highlighting](#syntax-highlighting) section above. + +### Text redactions + +The `redactions.scm` file defines text redaction rules. When collaborating and sharing your screen, it makes sure that certain syntax nodes are rendered in a redacted mode to avoid them from leaking. + +Here's an example from a `redactions.scm` file for JSON: + +```scheme +(pair value: (number) @redact) +(pair value: (string) @redact) +(array (number) @redact) +(array (string) @redact) +``` + +This query marks number and string values in key-value pairs and arrays for redaction. + +| Capture | Description | +| ------- | ------------------------------ | +| @redact | Captures values to be redacted | + +### Runnable code detection + +The `runnables.scm` file defines rules for detecting runnable code. + +Here's an example from an `runnables.scm` file for JSON: + +```scheme +( + (document + (object + (pair + key: (string + (string_content) @_name + (#eq? @_name "scripts") + ) + value: (object + (pair + key: (string (string_content) @run @script) + ) + ) + ) + ) + ) + (#set! tag package-script) + (#set! tag composer-script) +) +``` + +This query detects runnable scripts in package.json and composer.json files. + +The `@run` capture specifies where the run button should appear in the editor. Other captures, except those prefixed with an underscore, are exposed as environment variables with a prefix of `ZED_CUSTOM_$(capture_name)` when running the code. + +| Capture | Description | +| ------- | ------------------------------------------------------ | +| @\_name | Captures the "scripts" key | +| @run | Captures the script name | +| @script | Also captures the script name (for different purposes) | + +TBD: `#set! tag` + +## Language Servers + +Zed uses the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) to provide advanced language support. + +An extension may provide any number of language servers. To provide a language server from your extension, add an entry to your `extension.toml` with the name of your language server and the language it applies to: + +```toml +[language_servers.my-language] +name = "My Language LSP" +language = "My Language" +``` + +Then, in the Rust code for your extension, implement the `language_server_command` method on your extension: + +```rust +impl zed::Extension for MyExtension { + fn language_server_command( + &mut self, + language_server_id: &LanguageServerId, + worktree: &zed::Worktree, + ) -> Result { + Ok(zed::Command { + command: get_path_to_language_server_executable()?, + args: get_args_for_language_server()?, + env: get_env_for_language_server()?, + }) + } +} +``` + +You can customize the handling of the language server using several optional methods in the `Extension` trait. For example, you can control how completions are styled using the `label_for_completion` method. For a complete list of methods, see the [API docs for the Zed extension API](https://docs.rs/zed_extension_api). diff --git a/docs/src/extensions/themes.md b/docs/src/extensions/themes.md new file mode 100644 index 0000000000..4737a99a3e --- /dev/null +++ b/docs/src/extensions/themes.md @@ -0,0 +1,53 @@ +# Themes + +The `themes` directory in an extension should contain one or more theme files. + +Each theme file should adhere to the JSON schema specified at [`https://zed.dev/schema/themes/v0.1.0.json`](https://zed.dev/schema/themes/v0.1.0.json). + +See [this blog post](https://zed.dev/blog/user-themes-now-in-preview) for more details about creating themes. + +## Theme JSON Structure + +The structure of a Zed theme is defined in the [Zed Theme JSON Schema](https://zed.dev/schema/themes/v0.1.0.json). + +A Zed theme consists of a Theme Family object including: + +- `name`: The name for the theme family +- `author`: The name of the author of the theme family +- `themes`: An array of Themes belonging to the theme family + +The core components a Theme object include: + +1. Theme Metadata: + + - `name`: The name of the theme + - `appearance`: Either "light" or "dark" + +2. Style Properties under the `style`, such as: + + - `background`: The main background color + - `foreground`: The main text color + - `accent`: The accent color used for highlighting and emphasis + +3. Syntax Highlighting: + + - `syntax`: An object containing color definitions for various syntax elements (e.g., keywords, strings, comments) + +4. UI Elements: + + - Colors for various UI components such as: + - `element.background`: Background color for UI elements + - `border`: Border colors for different states (normal, focused, selected) + - `text`: Text colors for different states (normal, muted, accent) + +5. Editor-specific Colors: + + - Colors for editor-related elements such as: + - `editor.background`: Editor background color + - `editor.gutter`: Gutter colors + - `editor.line_number`: Line number colors + +6. Terminal Colors: + - ANSI color definitions for the integrated terminal + +We recommend looking at our [existing themes](https://github.com/zed-industries/zed/tree/main/assets/themes) to get a more comprehensive idea of what can be styled. diff --git a/docs/src/feedback-and-support.md b/docs/src/feedback-and-support.md index 9198c5293e..2e4be92caa 100644 --- a/docs/src/feedback-and-support.md +++ b/docs/src/feedback-and-support.md @@ -1,37 +1,39 @@ # Feedback and Support -## Frequently asked questions +## Community Support -Our [FAQ](https://zed.dev/faq) is a great place to start for common questions about Zed. - -## Community repository - -We track our issues at [`zed-industries/zed`](https://github.com/zed-industries/zed/issues). - -### Feature requests - -Try to focus on the things that are most critical to you rather than exhaustively listing all features another editor you have used has. - -Command palette: `request feature` - -### Bug reports - -Try to add as much detail as possible, if it is not obvious to reproduce. Let us know how severe the problem is for you; is the issue more of a minor inconvenience or something that would prevent you from using Zed? - -Command palette: `file bug report` - -## In-app feedback - -Feedback can be submitted from within Zed via the feedback modal (command palette: `give feedback`). - -## Zed forum +Our [Discord community](https://discord.gg/zed-community) is vibrant and a great place to ask questions and learn from others. Be sure to check out the `#support` channel. Use the [community forum](https://github.com/zed-industries/zed/discussions) to ask questions and learn from one another. We will be present in the forum and answering questions as well. -## Email +## Frequently Asked Questions + +Our [FAQ](https://zed.dev/faq) is a great place to start for common questions about Zed. + +## Issue Tracking + +We track our issues at [`zed-industries/zed`](https://github.com/zed-industries/zed/issues). + +### Feature Requests + +Try to focus on the things that are most critical to you rather than exhaustively listing all features another editor you have used has. + +Command palette: `zed: request feature` + +### Bug Reports + +Try to add as much detail as possible, if it is not obvious to reproduce. Let us know how severe the problem is for you; is the issue more of a minor inconvenience or something that would prevent you from using Zed? + +Command palette: `zed: file bug report` + +## Feedback Channels + +In-app feedback can be submitted from within Zed via the feedback modal. + +Command palette: `feedback: give feedback` If you prefer to write up your thoughts as an email, you can send them to [hi@zed.dev](mailto:hi@zed.dev). -## Merch store +## Merch Store We have a [merch store](https://zedindustries.creator-spring.com/) where you can buy Zed stickers, shirts, and more. diff --git a/docs/src/fonts.md b/docs/src/fonts.md new file mode 100644 index 0000000000..ae9bbff275 --- /dev/null +++ b/docs/src/fonts.md @@ -0,0 +1,58 @@ +# Fonts + + + +Zed ships two fonts: Zed Plex Mono and Zed Plex Sans. These are based on IBM Plex Mono and IBM Plex Sans, respectively. + + + +## Settings + + + +- Buffer fonts + - `buffer-font-family` + - `buffer-font-features` + - `buffer-font-size` + - `buffer-line-height` +- UI fonts + - `ui_font_family` + - `ui_font_fallbacks` + - `ui_font_features` + - `ui_font_weight` + - `ui_font_size` +- Terminal fonts + - `terminal.font-size` + - `terminal.font-family` + - `terminal.font-features` +- Other settings: + - `active-pane-magnification` + +## Old Zed Fonts + +Previously, Zed shipped with `Zed Mono` and `Zed Sans`, customized versions of the [Iosevka](https://typeof.net/Iosevka/) typeface. You can find more about them in the [zed-fonts](https://github.com/zed-industries/zed-fonts/) repository. + +Here's how you can use the old Zed fonts instead of `Zed Plex Mono` and `Zed Plex Sans`: + +1. Download [zed-app-fonts-1.2.0.zip](https://github.com/zed-industries/zed-fonts/releases/download/1.2.0/zed-app-fonts-1.2.0.zip) from the [zed-fonts releases](https://github.com/zed-industries/zed-fonts/releases) page. +2. Open MacOS `Font Book.app` +3. Unzip the file and drag the `ttf` files into the Font Book app. +4. Update your settings `ui_font_family` and `buffer_font_family` to use `Zed Mono` or `Zed Sans` in your `settings.json` file. + +```json +{ + "ui_font_family": "Zed Sans Extended", + "buffer_font_family": "Zed Mono Extend", + "terminal": { + "font-family": "Zed Mono Extended" + } +} +``` + +5. Note there will be red squiggles under the font name. (this is a bug, but harmless.) diff --git a/docs/src/getting-started.md b/docs/src/getting-started.md index c80c550645..c1add5233b 100644 --- a/docs/src/getting-started.md +++ b/docs/src/getting-started.md @@ -56,7 +56,7 @@ Any time you see instructions that include commands of the form `zed: ...` or `e ## Configure Zed -Use `⌘` + `,` to open your custom settings to set things like fonts, formatting settings, per-language settings, and more. +Use `⌘` + `,`, or `ctrl` - `,` to open your custom settings to set things like fonts, formatting settings, per-language settings, and more. On macOS, you can access the default configuration using the `Zed > Settings > Open Default Settings` menu item. See [Configuring Zed](./configuring-zed.md) for all available settings. diff --git a/docs/src/git.md b/docs/src/git.md index 8639b0620e..9ab57e83f4 100644 --- a/docs/src/git.md +++ b/docs/src/git.md @@ -10,6 +10,16 @@ Zed currently supports the following Git features: More advanced Git features—like staging and committing changes or viewing history within Zed—will be coming in the future. + + ## Git Integrations Zed integrates with popular Git hosting services to ensure that git commit hashes @@ -23,7 +33,7 @@ Zed currently support links to Zed also has a Copy Permalink feature to create a permanent link to a code snippet on your Git hosting service. These links are useful for sharing a specific line or range of lines in a file at a specific commit. -Trigger this action via the [Command Palette](/docs/#command-palette) (search for `permalink`), -by creating a [custom key bindings](/docs/key-bindings#custom-key-bindings) to the +Trigger this action via the [Command Palette](./getting-started.md#command-palette) (search for `permalink`), +by creating a [custom key bindings](key-bindings.md#custom-key-bindings) to the `editor::CopyPermalinkToLine` or `editor::OpenPermalinkToLine` actions or by simply right clicking and selecting `Copy Permalink` with line(s) selected in your editor. diff --git a/docs/src/key-bindings.md b/docs/src/key-bindings.md index 0cabb2a8d4..93054c5fb2 100644 --- a/docs/src/key-bindings.md +++ b/docs/src/key-bindings.md @@ -59,7 +59,7 @@ The keys can be any single unicode codepoint that your keyboard generates (for e A few examples: -``` +```json "bindings": { "cmd-k cmd-s": "zed::OpenKeymap", // matches ⌘-k then ⌘-s "space e": "editor::Complete", // type space then e @@ -74,6 +74,37 @@ The `alt-` modifier can be used on many layouts to generate a different key. For It is possible to match against typing a modifier key on its own. For example `shift shift` can be used to implement JetBrains search everywhere shortcut. In this case the binding happens on key release instead of key press. +### Contexts + +Each key binding includes a `context` which determes when the key binding is active. If no context key is present it is considered to be in the `Global` context. The context is a boolean expression that can include the following: + +- Pane +- Workspace +- Editor +- Menu +- Terminal +- Assistant +- ProjectPanel +- ProjectSearch +- BufferSearch +- Search +- Dock +- EmptyPane +- SharedScreen +- VimControl +- vim_mode == normal +- vim_mode == visual +- vim_mode == insert +- vim_mode == replace +- vim_mode == operator +- vim_mode == waiting + + + +See also: [vim context docs](./vim.md#contexts) + ### Remapping keys A common request is to be able to map from one sequence of keys to another. As of Zed 0.124.0 you can do this with the `workspace::SendKeystrokes` action. @@ -102,7 +133,7 @@ A common request is to be able to map from one sequence of keys to another. As o There are some limitations to this, notably: - Any asynchronous operation will not happen until after all your key bindings have been dispatched. For example this means that while you can use a binding to open a file (as in the `cmd-alt-r` example) you cannot send further keystrokes and hope to have them interpreted by the new view. -- - Other examples of asynchronous things are: communicating with a language server, changing the language of a buffer, anything that hits the network. +- Other examples of asynchronous things are: communicating with a language server, changing the language of a buffer, anything that hits the network. - There is a limit of 100 simulated keys at a time, this is to avoid accidental infinite recursion if you trigger SendKeystrokes again inside your bindings. The argument to `SendKeystrokes` is a space-separated list of keystrokes (using the same syntax as above). Due to the way that keystrokes are parsed, any segment that is not recognized as a keypress will be sent verbatim to the currently focused input field. @@ -125,12 +156,15 @@ For example, `ctrl-n` creates a new tab in Zed on Linux. If you want to send `ct ### Task Key bindings You can also bind keys to launch Zed Tasks defined in your tasks.json. -See the [tasks documentation](/docs/tasks#custom-keybindings-for-tasks) for more. +See the [tasks documentation](tasks.md#custom-keybindings-for-tasks) for more. ### All key bindings #### Global +TBD: Update these to reflect current bindings +TBD: Add Column with Linux shortcuts + | **Command** | **Target** | **Default Shortcut** | | ------------------------- | ------------ | ----------------------- | | Toggle focus | Collab Panel | `⌘ + Shift + C` | diff --git a/docs/src/language-model-integration.md b/docs/src/language-model-integration.md index f2a2fb7b7c..7cc4afd07d 100644 --- a/docs/src/language-model-integration.md +++ b/docs/src/language-model-integration.md @@ -2,25 +2,18 @@ ## Assistant Panel -The assistant panel provides you with a way to interact with OpenAI's large language models. The assistant is good for various tasks, such as generating code, asking questions about existing code, and even writing plaintext, such as emails and documentation. To open the assistant panel, toggle the right dock by using the `workspace: toggle right dock` action in the command palette (`cmd-shift-p`). +The assistant panel provides you with a way to interact with large language models. The assistant is good for various tasks, such as generating code, asking questions about existing code, and even writing plaintext, such as emails and documentation. To open the assistant panel, toggle the right dock by using the `workspace: toggle right dock` action in the command palette or by using the `cmd-r` (Mac) or `ctrl-alt-b` (Linux) shortcut. -> **Note**: A default binding can be set to toggle the right dock via the settings. +> **Note**: A custom [key binding](./key-bindings.md) can be set to toggle the right dock. -### Setup +## Setup -1. Create an [OpenAI API key](https://platform.openai.com/account/api-keys) -2. Make sure that your OpenAI account has credits -3. Open the assistant panel, using either the `assistant: toggle focus` or the `workspace: toggle right dock` action in the command palette (`cmd-shift-p`). -4. Make sure the assistant panel is focused: - - ![The focused assistant panel](https://zed.dev/img/assistant/assistant-focused.png) - -5. Open the command palette (`cmd-shift-p`) and use the now-available `assistant: reset key` action to set your OpenAI API key: - ![Enter your OpenAI API key into the field on the right and hit return](https://zed.dev/img/assistant/assistant-reset-key.png) - -The OpenAI API key will be saved in your keychain. - -Zed will also use the `OPENAI_API_KEY` environment variable if it's defined. If you need to reset your OpenAI API key, focus on the assistant panel and run the command palette action `assistant: reset key`. +- [OpenAI API Setup Instructions](#openai) +- [OpenAI API Custom Endpoint](#openai-custom-endpoint) +- [Ollama Setup Instructions](#ollama) +- [Anthropic API Setup Instructions](#anthropic) +- [Google Gemini API Setup Instructions](#google-gemini) +- [GitHub Copilot Chat](#github-copilot) ### Having a conversation @@ -77,61 +70,6 @@ After you submit your first message, a name for your conversation is generated b ![Viewing assistant history](https://zed.dev/img/assistant/assistant-history.png) -### Using a custom API endpoint for OpenAI - -You can use a custom API endpoint for OpenAI, as long as it's compatible with the OpenAI API structure. - -To do so, add the following to your Zed `settings.json`: - -```json -{ - "language_models": { - "openai": { - "api_url": "http://localhost:11434/v1" - } - } -} -``` - -The custom URL here is `http://localhost:11434/v1`. - -### Using Ollama on macOS - -You can use Ollama with the Zed assistant by making Ollama appear as an OpenAPI endpoint. - -1. Download, for example, the `mistral` model with Ollama: - - ``` - ollama pull mistral - ``` - -2. Make sure that the Ollama server is running. You can start it either via running the Ollama app, or launching: - - ``` - ollama serve - ``` - -3. In the assistant panel, select one of the Ollama models using the model dropdown. -4. (Optional) If you want to change the default url that is used to access the Ollama server, you can do so by adding the following settings: - -```json -{ - "language_models": { - "ollama": { - "api_url": "http://localhost:11434" - } - } -} -``` - -### Using Claude 3.5 Sonnet - -You can use Claude with the Zed assistant by choosing it via the model dropdown in the assistant panel. - -You need can obtain an API key [here](https://console.anthropic.com/settings/keys). - -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. - ## Inline generation You can generate and transform text in any editor by selecting text and pressing `ctrl-enter`. @@ -228,3 +166,89 @@ Zed allows you to override the default prompts used for various assistant featur You can customize these templates to better suit your needs while maintaining the core structure and variables used by Zed. Zed will automatically reload your prompt overrides when they change on disk. Consult Zed's assets/prompts directory for current versions you can play with. Be sure you want to override these, as you'll miss out on iteration on our built in features. This should be primarily used when developing Zed. + +## Setup Instructions + +### OpenAI + + + +1. Create an [OpenAI API key](https://platform.openai.com/account/api-keys) +2. Make sure that your OpenAI account has credits +3. Open the assistant panel, using either the `assistant: toggle focus` or the `workspace: toggle right dock` action in the command palette (`cmd-shift-p`). +4. Make sure the assistant panel is focused: + + ![The focused assistant panel](https://zed.dev/img/assistant/assistant-focused.png) + +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 Endpoint + +You can use a custom API endpoint for OpenAI, as long as it's compatible with the OpenAI API structure. + +To do so, add the following to your Zed `settings.json`: + +```json +{ + "language_models": { + "openai": { + "api_url": "http://localhost:11434/v1" + } + } +} +``` + +The custom URL here is `http://localhost:11434/v1`. + +### Ollama + +Download and install ollama from [ollama.com/download](https://ollama.com/download) (Linux or MacOS) and ensure it's running with `ollama --version`. + +You can use Ollama with the Zed assistant by making Ollama appear as an OpenAPI endpoint. + +1. Download, for example, the `mistral` model with Ollama: + + ```sh + ollama pull mistral + ``` + +2. Make sure that the Ollama server is running. You can start it either via running the Ollama app, or launching: + + ```sh + ollama serve + ``` + +3. In the assistant panel, select one of the Ollama models using the model dropdown. +4. (Optional) If you want to change the default url that is used to access the Ollama server, you can do so by adding the following settings: + +```json +{ + "language_models": { + "ollama": { + "api_url": "http://localhost:11434" + } + } +} +``` + +### Anthropic + +You can use Claude 3.5 Sonnet with the Zed assistant by choosing it via the model dropdown in the assistant panel. + +You can obtain an API key [here](https://console.anthropic.com/settings/keys). + +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. + +### Google Gemini + +You can use Gemini 1.5 Pro/Flash with the Zed assistant by choosing it via the model dropdown in the assistant panel. + +You can obtain an API key [here](https://aistudio.google.com/app/apikey). + +### GitHub Copilot + +You can use GitHub Copilot chat with the Zed assistant by choosing it via the model dropdown in the assistant panel. diff --git a/docs/src/languages.md b/docs/src/languages.md new file mode 100644 index 0000000000..7ec586f1f5 --- /dev/null +++ b/docs/src/languages.md @@ -0,0 +1,159 @@ +# Language Support in Zed + +Zed supports hundreds of programming languages and text formats. Some work out-of-the box and others rely on 3rd party extensions. + +## Languages with Documentation + +- [AsciiDoc](./languages/asciidoc.md) +- [Astro](./languages/astro.md) +- [Bash](./languages/bash.md) +- [Biome](./languages/biome.md) +- [C](./languages/c.md) +- [C++](./languages/cpp.md) +- [C#](./languages/csharp.md) +- [Clojure](./languages/clojure.md) +- [CSS](./languages/css.md) +- [Dart](./languages/dart.md) +- [Deno](./languages/deno.md) +- [Docker](./languages/docker.md) +- [Elixir](./languages/elixir.md) +- [Elm](./languages/elm.md) +- [Emmet](./languages/emmet.md) +- [Erlang](./languages/erlang.md) +- [Fish](./languages/fish.md) +- [GDScript](./languages/gdscript.md) +- [Gleam](./languages/gleam.md) +- [GLSL](./languages/glsl.md) +- [Go](./languages/go.md) +- [Groovy](./languages/groovy.md) +- [Haskell](./languages/haskell.md) +- [HTML](./languages/html.md) +- [Java](./languages/java.md) +- [JavaScript](./languages/javascript.md) +- [Julia](./languages/julia.md) +- [JSON](./languages/json.md) +- [Kotlin](./languages/kotlin.md) +- [Lua](./languages/lua.md) +- [Luau](./languages/luau.md) +- [Makefile](./languages/makefile.md) +- [Markdown](./languages/markdown.md) +- [Nim](./languages/nim.md) +- [OCaml](./languages/ocaml.md) +- [PHP](./languages/php.md) +- [Prisma](./languages/prisma.md) +- [Proto](./languages/proto.md) +- [PureScript](./languages/purescript.md) +- [Python](./languages/python.md) +- [R](./languages/r.md) +- [ReStructuredText](./languages/rst.md) +- [Racket](./languages/racket.md) +- [Roc](./languages/roc.md) +- [Ruby](./languages/ruby.md) +- [Rust](./languages/rust.md) +- [Scala](./languages/scala.md) +- [Scheme](./languages/scheme.md) +- [Svelte](./languages/svelte.md) +- [Swift](./languages/swift.md) +- [TailwindCSS](./languages/tailwindcss.md) +- [Terraform](./languages/terraform.md) +- [TOML](./languages/toml.md) +- [TypeScript](./languages/typescript.md) +- [Uiua](./languages/uiua.md) +- [Vue](./languages/vue.md) +- [YAML](./languages/yaml.md) +- [Yarn](./languages/yarn.md) +- [Zig](./languages/zig.md) + +## Additional Community Language Extensions + +- [Ada](https://github.com/wisn/zed-ada-language) +- [Aiken](https://github.com/aiken-lang/zed-aiken) +- [Amber](https://github.com/amber-lang/zed-amber-extension) +- [Assembly](https://github.com/DevBlocky/zed-asm) +- [AWK](https://github.com/dangh/zed-awk) +- [Beancount](https://github.com/zed-extensions/beancount) +- [Bend](https://github.com/mrpedrobraga/zed-bend) +- [Blade](https://github.com/bajrangCoder/zed-laravel-blade) +- [Blueprint](https://github.com/tfuxu/zed-blueprint) +- [BQN](https://github.com/DavidZwitser/zed-bqn) +- [Brainfuck](https://github.com/JosephTLyons/zed-brainfuck) +- [Cadence](https://github.com/janezpodhostnik/cadence.zed) +- [Cairo](https://github.com/trbutler4/zed-cairo) +- [Cap'n Proto](https://github.com/cmackenzie1/zed-capnp) +- [Cedar](https://github.com/chrnorm/zed-cedar) +- [CFEngine policy language](https://github.com/olehermanse/zed-cfengine) +- [CSV](https://github.com/huacnlee/zed-csv) +- [Cucumber/Gherkin](https://github.com/thlcodes/zed-extension-cucumber) +- [CUE](https://github.com/jkasky/zed-cue) +- [Curry](https://github.com/fwcd/zed-curry) +- [D](https://github.com/staysail/zed-d) +- [Database Markup Language (DBML)](https://github.com/shuklaayush/zed-dbml) +- [Earthfile](https://github.com/glehmann/earthfile.zed) +- [EJS template](https://github.com/dangh/zed-ejs) +- [Elisp](https://github.com/JosephTLyons/zed-elisp) +- [Ember](https://github.com/jylamont/zed-ember) +- [Env](https://github.com/zarifpour/zed-env) +- [Exograph](https://github.com/exograph/zed-extension) +- [Fortran](https://github.com/Xavier-Maruff/zed-fortran) +- [F#](https://github.com/nathanjcollins/zed-fsharp) +- [Gemini gemtext](https://github.com/clseibold/gemini-zed) +- [Git Firefly](https://github.com/d1y/git_firefly) +- [GraphQL](https://github.com/11bit/zed-extension-graphql) +- [Groq](https://github.com/juice49/zed-groq) +- [INI](https://github.com/bajrangCoder/zed-ini) +- [Java](https://github.com/zed-extensions/java) +- [Jsonnet](https://github.com/narqo/zed-jsonnet) +- [Justfiles](https://github.com/jackTabsCode/zed-just) +- [LaTeX](https://github.com/rzukic/zed-latex) +- [Ledger](https://github.com/mrkstwrt/zed-ledger) +- [Less](https://github.com/jimliang/zed-less) +- [LilyPond](https://github.com/nwhetsell/lilypond-zed-extension) +- [Liquid](https://github.com/TheBeyondGroup/zed-shopify-liquid) +- [Log](https://github.com/evrensen467/zed-log) +- [Lox](https://github.com/arian81/zed-lox) +- [Markdown Oxide](https://github.com/Feel-ix-343/markdown-oxide-zed) +- [Marksman](https://github.com/vitallium/zed-marksman) +- [Matlab](https://github.com/rzukic/zed-matlab) +- [Meson](https://github.com/hqnna/zed-meson) +- [Navi](https://github.com/navi-language/zed-navi) +- [NeoCMake](https://github.com/k0tran/zed_neocmake) +- [Nginx](https://github.com/d1y/nginx-zed) +- [Nim](https://github.com/foxoman/zed-nim) +- [Nix](https://github.com/zed-extensions/nix) +- [Noir](https://github.com/shuklaayush/zed-noir) +- [Nu](https://github.com/zed-extensions/nu) +- [Odin](https://github.com/clseibold/zed-odin) +- [Pact](https://github.com/kadena-community/pact-zed) +- [Pest](https://github.com/pest-parser/zed-pest) +- [PICA200 assembly](https://github.com/Squareheron942/zed-pica200) +- [Pkl](https://github.com/Moshyfawn/pkl-zed) +- [PlaydateSDK](https://github.com/notpeter/playdate-zed-extension) +- [QML](https://github.com/lkroll/zed-qml) +- [Rainbow CSV](https://github.com/weartist/zed-rainbow-csv) +- [Rego](https://github.com/StyraInc/zed-rego) +- [Rescript](https://github.com/humaans/rescript-zed) +- [Roclang](https://github.com/h2000/zed-roc) +- [Ron](https://github.com/onbjerg/zed-ron) +- [Metals](https://github.com/scalameta/metals-zed) +- [SCSS](https://github.com/bajrangCoder/zed-scss) +- [Slim](https://github.com/calmyournerves/zed-slim) +- [Slint](https://gitlab.com/flukejones/zed-slint) +- [Smithy](https://github.com/joshrutkowski/zed-smithy) +- [Solidity](https://github.com/zarifpour/zed-solidity) +- [SQL](https://github.com/evrensen467/zed-sql) +- [Strace](https://github.com/sigmaSd/zed-strace) +- [Swift](https://github.com/zed-extensions/swift) +- [Templ](https://github.com/makifdb/zed-templ) +- [Tmux](https://github.com/dangh/zed-tmux) +- [Twig](https://github.com/YussufSassi/zed-twig) +- [Typst](https://github.com/WeetHet/typst.zed) +- [Unison](https://github.com/zetashift/unison-zed) +- [UnoCSS](https://github.com/bajrangCoder/zed-unocss) +- [Vlang](https://github.com/lv37/zed-v) +- [Vala](https://github.com/FyraLabs/zed-vala) +- [Vale](https://github.com/koozz/zed-vale) +- [Verilog](https://github.com/someone13574/zed-verilog-extension) +- [VHS](https://github.com/eth0net/zed-vhs) +- [Wgsl](https://github.com/luan/zed-wgsl) +- [WIT](https://github.com/valentinegb/zed-wit) +- [XML](https://github.com/sweetppro/zed-xml) diff --git a/docs/src/languages/asciidoc.md b/docs/src/languages/asciidoc.md new file mode 100644 index 0000000000..82a1c69bcf --- /dev/null +++ b/docs/src/languages/asciidoc.md @@ -0,0 +1,6 @@ +# AsciiDoc + +AsciiDoc language support in Zed is provided by the community-maintained [AsciiDoc extension](https://github.com/andreicek/zed-asciidoc). +Report issues to: [https://github.com/andreicek/zed-asciidoc/issues](https://github.com/andreicek/zed-asciidoc/issues) + +- Tree Sitter: [cathaysia/tree-sitter-asciidoc](https://github.com/cathaysia/tree-sitter-asciidoc) diff --git a/docs/src/languages/astro.md b/docs/src/languages/astro.md index 1dbba8178b..8553369c70 100644 --- a/docs/src/languages/astro.md +++ b/docs/src/languages/astro.md @@ -1,3 +1,10 @@ # Astro Astro support is available through the [Astro extension](https://github.com/zed-industries/zed/tree/main/extensions/astro). + +- Tree Sitter: [virchau13/tree-sitter-astro](https://github.com/virchau13/tree-sitter-astro) +- Language Server: [withastro/language-tools](https://github.com/withastro/language-tools) + + diff --git a/docs/src/languages/bash.md b/docs/src/languages/bash.md new file mode 100644 index 0000000000..2074b23d40 --- /dev/null +++ b/docs/src/languages/bash.md @@ -0,0 +1,24 @@ +# Bash + +Bash language support in Zed is provided by the community-maintained [Basher extension](https://github.com/d1y/bash.zed). +Report issues to: [https://github.com/d1y/bash.zed/issues](https://github.com/d1y/bash.zed/issues) + +- Tree Sitter: [tree-sitter/tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash) +- Language Server: [bash-lsp/bash-language-server](https://github.com/bash-lsp/bash-language-server) + +## Configuration + +The bash-language-server support shellcheck. But you need to install it manually: + +```sh +# MacOS +brew install shellcheck + +# Ubuntu/Debian +sudo apt-get install shellcheck + +# Arch Linux +pacman -S shellcheck +``` + +If you wish to customize the warnings/errors reported you just need to create a `.shellcheckrc` file. You can do this in the root of your project or in your home directory (`~/.shellcheckrc`). See: [shellcheck documentation](https://github.com/koalaman/shellcheck/wiki/Ignore#ignoring-one-or-more-types-of-errors-forever) for more. diff --git a/docs/src/languages/biome.md b/docs/src/languages/biome.md new file mode 100644 index 0000000000..4632d56d82 --- /dev/null +++ b/docs/src/languages/biome.md @@ -0,0 +1,35 @@ +# Biome + +[Biome](https://biomejs.dev/) support in Zed is provided by the community-maintained [Biome extension](https://github.com/biomejs/biome-zed). +Report issues to: [https://github.com/biomejs/biome-zed/issues](https://github.com/biomejs/biome-zed/issues) + +- Language Server: [biomejs/biome](https://github.com/biomejs/biome) + +## Biome Language Support + +The Biome extension includes support for the following languages: + +- JavaScript +- TypeScript +- JSX +- TSX +- JSON +- JSONC +- Vue.js +- Astro +- Svelte +- CSS + +## Configuration + +By default, the `biome.json` file is required to be in the root of the workspace. + +```json +{ + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json" +} +``` + +For a full list of `biome.json` options see [Biome Configuration](https://biomejs.dev/reference/configuration/) documentation. + +See the [Biome Zed Extension README](https://github.com/biomejs/biome-zed) for a complete list of features and configuration options. diff --git a/docs/src/languages/c.md b/docs/src/languages/c.md index e9df6197b0..c040285300 100644 --- a/docs/src/languages/c.md +++ b/docs/src/languages/c.md @@ -2,5 +2,9 @@ C support is available natively in Zed. -- Tree Sitter: [tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c) -- Language Server: [clangd](https://github.com/clangd/clangd) + + +- Tree Sitter: [tree-sitter/tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c) +- Language Server: [clangd/clangd](https://github.com/clangd/clangd) diff --git a/docs/src/languages/clojure.md b/docs/src/languages/clojure.md index 2dd816b174..43ed36898d 100644 --- a/docs/src/languages/clojure.md +++ b/docs/src/languages/clojure.md @@ -1,3 +1,13 @@ # Clojure Clojure support is available through the [Clojure extension](https://github.com/zed-industries/zed/tree/main/extensions/clojure). + +- Tree Sitter: [prcastro/tree-sitter-clojure](https://github.com/prcastro/tree-sitter-clojure) +- Language Server: [clojure-lsp/clojure-lsp](https://github.com/clojure-lsp/clojure-lsp) + +- Tree Sitter: [prcastro/tree-sitter-clojure](https://github.com/prcastro/tree-sitter-clojure) +- Language Server: [clojure-lsp/clojure-lsp](https://github.com/clojure-lsp/clojure-lsp) + + diff --git a/docs/src/languages/cpp.md b/docs/src/languages/cpp.md index 1cc9f99912..5660fc1f36 100644 --- a/docs/src/languages/cpp.md +++ b/docs/src/languages/cpp.md @@ -2,5 +2,9 @@ C++ support is available natively in Zed. -- Tree Sitter: [tree-sitter-cpp](https://github.com/tree-sitter/tree-sitter-cpp) -- Language Server: [clangd](https://github.com/clangd/clangd) +- Tree Sitter: [tree-sitter/tree-sitter-cpp](https://github.com/tree-sitter/tree-sitter-cpp) +- Language Server: [clangd/clangd](https://github.com/clangd/clangd) + +<--! +TBD: Add some C++ Docs +--> diff --git a/docs/src/languages/csharp.md b/docs/src/languages/csharp.md index 5dbeb19f6f..27d758e2fc 100644 --- a/docs/src/languages/csharp.md +++ b/docs/src/languages/csharp.md @@ -1,7 +1,12 @@ # C# +Note language name is "CSharp" for settings not "C#' + C# support is available through the [C# extension](https://github.com/zed-industries/zed/tree/main/extensions/csharp). +- Tree Sitter: [tree-sitter/tree-sitter-c-sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) +- Language Server: [OmniSharp/omnisharp-roslyn](https://github.com/OmniSharp/omnisharp-roslyn) + ## Configuration The `OmniSharp` binary can be configured in a Zed settings file with: diff --git a/docs/src/languages/css.md b/docs/src/languages/css.md index 56c55eae05..920c762db1 100644 --- a/docs/src/languages/css.md +++ b/docs/src/languages/css.md @@ -2,5 +2,18 @@ CSS support is available natively in Zed. -- Tree Sitter: [tree-sitter-css](https://github.com/tree-sitter/tree-sitter-css) -- Language Server: N/A +- 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) + + + +## See also: + +- [HTML](./html.md) +- [TypeScript](./typescript.md) +- [JavaScript](./javascript.md) diff --git a/docs/src/languages/dart.md b/docs/src/languages/dart.md index 5c95cb0781..6f80857c88 100644 --- a/docs/src/languages/dart.md +++ b/docs/src/languages/dart.md @@ -1,3 +1,11 @@ # Dart Dart support is available through the [Dart extension](https://github.com/zed-industries/zed/tree/main/extensions/dart). + +- Tree Sitter: [UserNobody14/tree-sitter-dart](https://github.com/UserNobody14/tree-sitter-dart) +- Language Server: [dart language-server](https://github.com/dart-lang/sdk) + + diff --git a/docs/src/languages/deno.md b/docs/src/languages/deno.md index 0de0619a71..7993ce81d9 100644 --- a/docs/src/languages/deno.md +++ b/docs/src/languages/deno.md @@ -1,3 +1,15 @@ # Deno Deno support is available through the [Deno extension](https://github.com/zed-industries/zed/tree/main/extensions/deno). + +- Language server: [Deno Language Server](https://docs.deno.com/runtime/manual/advanced/language_server/overview/) + + + +## See also: + +- [TypeScript](./typescript.md) +- [JavaScript](./javascript.md) diff --git a/docs/src/languages/docker.md b/docs/src/languages/docker.md new file mode 100644 index 0000000000..2104064b0b --- /dev/null +++ b/docs/src/languages/docker.md @@ -0,0 +1,16 @@ +# Docker + +Support for `Dockerfile` and `docker-compose.yaml` in Zed is provided by community-maintained extensions. + +## Docker Compose + +Docker `compose.yaml` language support in Zed is provided by the [Docker Compose extension](https://github.com/eth0net/zed-docker-compose). Please report issues to: [https://github.com/eth0net/zed-docker-compose/issues](https://github.com/eth0net/zed-docker-compose/issues). + +- Language Server: [microsoft/compose-language-service](https://github.com/microsoft/compose-language-service) + +## Dockerfile + +`Dockerfile` language support in Zed is provided by the [Dockerfile extension](https://github.com/d1y/dockerfile.zed). Please issues to: [https://github.com/d1y/dockerfile.zed/issues](https://github.com/d1y/dockerfile.zed/issues). + +- Tree Sitter: [camdencheek/tree-sitter-dockerfile](https://github.com/camdencheek/tree-sitter-dockerfile) +- Language Server: [rcjsuen/dockerfile-language-server](https://github.com/rcjsuen/dockerfile-language-server) diff --git a/docs/src/languages/elixir.md b/docs/src/languages/elixir.md index 38d81375b8..0d4940b1a6 100644 --- a/docs/src/languages/elixir.md +++ b/docs/src/languages/elixir.md @@ -2,6 +2,14 @@ Elixir support is available through the [Elixir extension](https://github.com/zed-industries/zed/tree/main/extensions/elixir). +- Tree Sitter: + - [elixir-lang/tree-sitter-elixir](https://github.com/elixir-lang/tree-sitter-elixir) + - [phoenixframework/tree-sitter-heex](https://github.com/phoenixframework/tree-sitter-heex) +- Language servers: + - [elixir-lsp/elixir-ls](https://github.com/elixir-lsp/elixir-ls) + - [elixir-tools/next-ls](https://github.com/elixir-tools/next-ls) + - [lexical-lsp/lexical](https://github.com/lexical-lsp/lexical) + ## Choosing a language server The Elixir extension offers language server support for `elixir-ls`, `next-ls`, and `lexical`. @@ -36,13 +44,13 @@ To switch to `lexical`, add the following to your `settings.json`: 1. Install `elixir`: -```bash +```sh brew install elixir ``` 2. Install `elixir-ls`: -```bash +```sh brew install elixir-ls ``` @@ -69,7 +77,7 @@ If you prefer to format your code with [Mix](https://hexdocs.pm/mix/Mix.html), u } ``` -### Additional workspace configuration options (requires Zed `0.128.0`): +### Additional workspace configuration options You can pass additional elixir-ls workspace configuration options via lsp settings in `settings.json`. @@ -86,3 +94,9 @@ The following example disables dialyzer: ``` See [ElixirLS configuration settings](https://github.com/elixir-lsp/elixir-ls#elixirls-configuration-settings) for more options. + +### HEEx + +Zed also supports HEEx templates. HEEx is a mix of [EEx](https://hexdocs.pm/eex/1.12.3/EEx.html) (Embedded Elixir) and HTML, and is used in Phoenix LiveView applications. + +- Tree Sitter: [phoenixframework/tree-sitter-heex](https://github.com/phoenixframework/tree-sitter-heex) diff --git a/docs/src/languages/elm.md b/docs/src/languages/elm.md index 2297688332..5da5dd1248 100644 --- a/docs/src/languages/elm.md +++ b/docs/src/languages/elm.md @@ -2,7 +2,10 @@ Elm support is available through the [Elm extension](https://github.com/zed-industries/zed/tree/main/extensions/elm). -### Setting up `elm-language-server` +- Tree Sitter: [elm-tooling/tree-sitter-elm](https://github.com/elm-tooling/tree-sitter-elm) +- Language Server: [elm-tooling/elm-language-server](https://github.com/elm-tooling/elm-language-server) + +## Setting up `elm-language-server` Elm language server can be configured in your `settings.json`, e.g.: @@ -20,4 +23,8 @@ Elm language server can be configured in your `settings.json`, e.g.: } ``` + + `elm-format`, `elm-review` and `elm` need to be installed and made available in the environment or configured in the settings. See the [full list of server settings here](https://github.com/elm-tooling/elm-language-server?tab=readme-ov-file#server-settings). diff --git a/docs/src/languages/emmet.md b/docs/src/languages/emmet.md new file mode 100644 index 0000000000..1a76291ad4 --- /dev/null +++ b/docs/src/languages/emmet.md @@ -0,0 +1,9 @@ +# Emmet + +[Emmet](https://emmet.io/) is a web-developer’s toolkit that can greatly improve your HTML & CSS workflow. + +- Language Server: [olrtg/emmet-language-server](https://github.com/olrtg/emmet-language-server) + + diff --git a/docs/src/languages/erlang.md b/docs/src/languages/erlang.md index 13997db446..4e9cc2d230 100644 --- a/docs/src/languages/erlang.md +++ b/docs/src/languages/erlang.md @@ -1,3 +1,11 @@ # Erlang Erlang support is available through the [Erlang extension](https://github.com/zed-industries/zed/tree/main/extensions/erlang). + +- Tree Sitter: [WhatsApp/tree-sitter-erlang](https://github.com/WhatsApp/tree-sitter-erlang) +- Language Server: [erlang-ls/erlang_ls](https://github.com/erlang-ls/erlang_ls) + +## See also: + +- [Elixir](./elixir.md) +- [Gleam](./gleam.md) diff --git a/docs/src/languages/fish.md b/docs/src/languages/fish.md new file mode 100644 index 0000000000..3c5fea2aab --- /dev/null +++ b/docs/src/languages/fish.md @@ -0,0 +1,6 @@ +# Fish + +Fish language support in Zed is provided by the community-maintained [Fish extension](https://github.com/hasit/zed-fish). +Report issues to: [https://github.com/hasit/zed-fish/issues](https://github.com/hasit/zed-fish/issues) + +- Tree Sitter: [ram02z/tree-sitter-fish](https://github.com/ram02z/tree-sitter-fish) diff --git a/docs/src/languages/gdscript.md b/docs/src/languages/gdscript.md new file mode 100644 index 0000000000..d856002c3c --- /dev/null +++ b/docs/src/languages/gdscript.md @@ -0,0 +1,29 @@ +# GDScript + +Godot [GDScript](https://gdscript.com/) language support in Zed is provided by the community-maintained [GDScript extension](https://github.com/grndctrl/zed-gdscript). +Report issues to: [https://github.com/grndctrl/zed-gdscript/issues](https://github.com/grndctrl/zed-gdscript/issues) + +- Tree Sitter: [PrestonKnopp/tree-sitter-gdscript](https://github.com/PrestonKnopp/tree-sitter-gdscript) and [PrestonKnopp/tree-sitter-godot-resource](https://github.com/PrestonKnopp/tree-sitter-godot-resource) +- Language Server: [gdscript-language-server](https://github.com/godotengine/godot) + +## Setup + +1. Download and install [Godot for MacOS](https://godotengine.org/download/macos/). +2. Unzip the Godot.app and drag it into your /Applications folder. +3. Open Godot.app and open your project (an example project is fine) +4. In Godot, Editor Menu -> Editor Settings; scroll down the left sidebar to `Text Editor -> External` + 1. Use External Editor: "✅ On" + 2. Exec path: `/Applications/Zed.app/Contents/MacOS/zed` + 3. Exec flags: `{project} {file}` + 4. Close settings to save. +5. In Godot double click on a \*.gd script and Zed will launch + + + +## Usage + +When Godot is running, the GDScript extension will connect to the language server provided by the Godot runtime and will provide `jump to definition`, hover states when you hold cmd and other language server features. + +> Note: If Zed is already running with an existing workspace, spawning from Godot will fail. Quit Zed and it should work again. diff --git a/docs/src/languages/gleam.md b/docs/src/languages/gleam.md index c0459a4d5b..0c5694b909 100644 --- a/docs/src/languages/gleam.md +++ b/docs/src/languages/gleam.md @@ -1,3 +1,11 @@ # Gleam -Gleam support is available through the [Gleam extension](https://github.com/zed-industries/zed/tree/main/extensions/gleam). +Gleam support is available through the [Gleam extension](https://github.com/zed-industries/zed/tree/main/extensions/gleam). To learn about Gleam, see the [docs](https://gleam.run/documentation/) or check out the [`stdlib` reference](https://hexdocs.pm/gleam_stdlib/). The Gleam language server has a variety of features, including go-to definition, automatic imports, and [more](https://gleam.run/language-server/). + +- Tree Sitter: [gleam-lang/tree-sitter-gleam](https://github.com/gleam-lang/tree-sitter-gleam) +- Language Server: [gleam lsp](https://github.com/gleam-lang/gleam/tree/main/compiler-core/src/language_server) + +See also: + +- [Elixir](./elixir.md) +- [Erlang](./erlang.md) diff --git a/docs/src/languages/glsl.md b/docs/src/languages/glsl.md new file mode 100644 index 0000000000..0a17828a24 --- /dev/null +++ b/docs/src/languages/glsl.md @@ -0,0 +1,6 @@ +# GLSL + +GLSL (OpenGL Shading Language) support is available through the [GLSL Extension](https://github.com/zed-industries/zed/tree/main/extensions/glsl/) + +- Tree Sitter: [theHamsta/tree-sitter-glsl](https://github.com/theHamsta/tree-sitter-glsl) +- Language Server: [nolanderc/glsl_analyzer](https://github.com/nolanderc/glsl_analyzer) diff --git a/docs/src/languages/go.md b/docs/src/languages/go.md index dfaf4ce04e..abbaaa2584 100644 --- a/docs/src/languages/go.md +++ b/docs/src/languages/go.md @@ -2,8 +2,8 @@ Go support is available natively in Zed. -- Tree Sitter: [tree-sitter-go](https://github.com/tree-sitter/tree-sitter-go) -- Language Server: [gopls](https://github.com/golang/tools/tree/master/gopls) +- Tree Sitter: [tree-sitter/tree-sitter-go](https://github.com/tree-sitter/tree-sitter-go) +- Language Server: [golang/tools/tree/master/gopls](https://github.com/golang/tools/tree/master/gopls) ## Inlay Hints @@ -27,7 +27,7 @@ Use ```json "lsp": { - "$LANGUAGE_SERVER_NAME": { + "gopls": { "initialization_options": { "hints": { .... @@ -39,18 +39,19 @@ Use to override these settings. -See https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md for more information. +See [gopls inlayHints documentation](https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md) for more information. -# Go Mod +## Go Mod -- Tree Sitter: [tree-sitter-go-mod](https://github.com/camdencheek/tree-sitter-go-mod) +- Tree Sitter: [camdencheek/tree-sitter-go-mod](https://github.com/camdencheek/tree-sitter-go-mod) - Language Server: N/A -# Go Sum +## Go Sum -TODO: https://github.com/zed-industries/zed/pull/7139 +- Tree Sitter: [amaanq/tree-sitter-go-sum](https://github.com/amaanq/tree-sitter-go-sum) +- Language Server: N/A -# Go Work +## Go Work - Tree Sitter: [tree-sitter-go-work](https://github.com/d1y/tree-sitter-go-work) diff --git a/docs/src/languages/groovy.md b/docs/src/languages/groovy.md new file mode 100644 index 0000000000..a402909611 --- /dev/null +++ b/docs/src/languages/groovy.md @@ -0,0 +1,7 @@ +# Groovy + +Groovy language support in Zed is provided by the community-maintained [Groovy extension](https://github.com/valentinegb/zed-groovy). +Report issues to: [https://github.com/valentinegb/zed-groovy/issues](https://github.com/valentinegb/zed-groovy/issues) + +- Tree Sitter: [murtaza64/tree-sitter-groovy](https://github.com/murtaza64/tree-sitter-groovy) +- Language Server: [GroovyLanguageServer/groovy-language-server](https://github.com/GroovyLanguageServer/groovy-language-server) diff --git a/docs/src/languages/haskell.md b/docs/src/languages/haskell.md index fc273660aa..05ce5ec0c0 100644 --- a/docs/src/languages/haskell.md +++ b/docs/src/languages/haskell.md @@ -1,3 +1,13 @@ # Haskell Haskell support is available through the [Haskell extension](https://github.com/zed-industries/zed/tree/main/extensions/haskell). + +- Tree Sitter: [tree-sitter-haskell](https://github.com/tree-sitter/tree-sitter-haskell) +- Language Server: [haskell-language-server](https://github.com/haskell/haskell-language-server) + +See: official [configuring haskell-language-server](https://haskell-language-server.readthedocs.io/en/latest/configuration.html) docs for more. + + diff --git a/docs/src/languages/html.md b/docs/src/languages/html.md index a45936c8f9..b2688f839d 100644 --- a/docs/src/languages/html.md +++ b/docs/src/languages/html.md @@ -2,6 +2,9 @@ HTML support is available through the [HTML extension](https://github.com/zed-industries/zed/tree/main/extensions/html). +- 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: @@ -13,3 +16,9 @@ If you do not want to use the HTML extension, you can add the following to your } } ``` + +## See also: + +- [CSS](./css.md) +- [JavaScript](./javascript.md) +- [TypeScript](./typescript.md) diff --git a/docs/src/languages/java.md b/docs/src/languages/java.md new file mode 100644 index 0000000000..0078947f82 --- /dev/null +++ b/docs/src/languages/java.md @@ -0,0 +1,6 @@ +# Java + +Java language support in Zed is provided the [zed Java extension](https://github.com/zed-extensions/java). +Report issues to: [https://github.com/zed-extensions/java/issues](https://github.com/zed-extensions/java/issues) + +- Tree Sitter: [tree-sitter/tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java) diff --git a/docs/src/languages/javascript.md b/docs/src/languages/javascript.md index 79e58c0486..61f56861fc 100644 --- a/docs/src/languages/javascript.md +++ b/docs/src/languages/javascript.md @@ -2,10 +2,10 @@ JavaScript support is available natively in Zed. -- Tree Sitter: [tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript) -- Language Server: [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server) +- Tree Sitter: [tree-sitter/tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript) +- Language Server: [typescript-language-server/typescript-language-server](https://github.com/typescript-language-server/typescript-language-server) -### Code formatting +## 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. @@ -26,10 +26,20 @@ For example, if you have Prettier installed and on your `PATH`, you can use it t } ``` -### ESLint +## JSX + +TBD: Mention JSX + +## JSDoc + +TBD: Document JSDoc support in Zed. + +- Tree Sitter: [tree-sitter/tree-sitter-jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) + +## ESLint You can configure Zed to format code using `eslint --fix` by running the ESLint -code action when formatting (requires Zed `0.125.0`): +code action when formatting: ```json { @@ -72,7 +82,7 @@ You can also only execute a single ESLint rule when using `fixAll`: > errors. If you **only** want to run ESLint on save, you can configure code actions as -the formatter (requires Zed `0.130.x`): +the formatter: ```json { @@ -88,9 +98,9 @@ the formatter (requires Zed `0.130.x`): } ``` -#### Configure ESLint's `nodePath`: +### Configure ESLint's `nodePath`: -You can configure ESLint's `nodePath` setting (requires Zed `0.127.0`): +You can configure ESLint's `nodePath` setting: ```json { @@ -104,9 +114,9 @@ You can configure ESLint's `nodePath` setting (requires Zed `0.127.0`): } ``` -#### Configure ESLint's `problems`: +### Configure ESLint's `problems`: -You can configure ESLint's `problems` setting (requires Zed `0.130.x`). +You can configure ESLint's `problems` setting. For example, here's how to set `problems.shortenToSingleLine`: @@ -124,7 +134,7 @@ For example, here's how to set `problems.shortenToSingleLine`: } ``` -#### Configure ESLint's `rulesCustomizations`: +### Configure ESLint's `rulesCustomizations`: You can configure ESLint's `rulesCustomizations` setting: @@ -143,6 +153,7 @@ You can configure ESLint's `rulesCustomizations` setting: } ``` -## Yarn integration +## See also -See [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn. +- [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn. +- [TypeScript documentation](./typescript.md) diff --git a/docs/src/languages/json.md b/docs/src/languages/json.md index d77f5f3409..14e3489d25 100644 --- a/docs/src/languages/json.md +++ b/docs/src/languages/json.md @@ -2,5 +2,16 @@ JSON support is available natively in Zed. -- Tree Sitter: [tree-sitter-json](https://github.com/tree-sitter/tree-sitter-json) -- Language Server: [json-language-server](https://github.com/zed-industries/json-language-server) +- Tree Sitter: [tree-sitter/tree-sitter-json](https://github.com/tree-sitter/tree-sitter-json) +- Language Server: [zed-industries/json-language-server](https://github.com/zed-industries/json-language-server) + +## JSONC + +Zed also supports a super-set of JSON called JSONC, which allows single line comments (`//`) in JSON files. +While editing these files you can use `cmd-/` (MacOS) or `ctrl-/` (Linux) to toggle comments on the current line or selection. + + diff --git a/docs/src/languages/julia.md b/docs/src/languages/julia.md new file mode 100644 index 0000000000..6b23580744 --- /dev/null +++ b/docs/src/languages/julia.md @@ -0,0 +1,12 @@ +# Julia + +Julia language support in Zed is provided by the community-maintained [Julia extension](https://github.com/JuliaEditorSupport/zed-julia). +Report issues to: [https://github.com/JuliaEditorSupport/zed-julia/issues](https://github.com/JuliaEditorSupport/zed-julia/issues) + +- Tree Sitter: [tree-sitter/tree-sitter-julia](https://github.com/tree-sitter/tree-sitter-julia) +- Language Server: [julia-vscode/LanguageServer.jl](https://github.com/julia-vscode/LanguageServer.jl) + + diff --git a/docs/src/languages/kotlin.md b/docs/src/languages/kotlin.md new file mode 100644 index 0000000000..e48df1d7d4 --- /dev/null +++ b/docs/src/languages/kotlin.md @@ -0,0 +1,34 @@ +# Kotlin + +Kotlin language support in Zed is provided by the community-maintained [Kotlin extension](https://github.com/zed-extensions/kotlin). +Report issues to: [https://github.com/zed-extensions/kotlin/issues](https://github.com/zed-extensions/kotlin/issues) + +- Tree Sitter: [fwcd/tree-sitter-kotlin](https://github.com/fwcd/tree-sitter-kotlin) +- Language Server: [fwcd/kotlin-language-server](https://github.com/fwcd/kotlin-language-server) + +## Configuration + +Workspace configuration options can be passed to the language server via lsp +settings in `settings.json`. + +The following example changes the JVM target from `default` (which is 1.8) to +`17`: + +```json +{ + "lsp": { + "kotlin-language-server": { + "settings": { + "compiler": { + "jvm": { + "target": "17" + } + } + } + } + } +} +``` + +The full list of workspace configuration options can be found +[here](https://github.com/fwcd/kotlin-language-server/blob/main/server/src/main/kotlin/org/javacs/kt/Configuration.kt). diff --git a/docs/src/languages/lua.md b/docs/src/languages/lua.md index ae869ebf8d..282ee529c4 100644 --- a/docs/src/languages/lua.md +++ b/docs/src/languages/lua.md @@ -1,3 +1,30 @@ # Lua Lua support is available through the [Lua extension](https://github.com/zed-industries/zed/tree/main/extensions/lua). + +- Tree Sitter: [tree-sitter-grammars/tree-sitter-lua](https://github.com/tree-sitter-grammars/tree-sitter-lua) +- Language server: [LuaLS/lua-language-server](https://github.com/LuaLS/lua-language-server) + +## luarc.json + +To configure LuaLS you can create a `.luarc.json` file in the root of your workspace. + +See [LuaLS Settings Documentation](https://luals.github.io/wiki/settings/) for all available configuration options. + +```json +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "runtime.version": "Lua 5.4", + "diagnostics.severity": { + // "duplicate-set-field": "Hint" + }, + "format.defaultConfig": { + "indent_style": "space", + "indent_size": "4" + }, + // Location(s) of any LuaCATS / EmmyLua annotation stubs + "workspace.library": [ + // "path/to/library/directory" + ] +} +``` diff --git a/docs/src/languages/luau.md b/docs/src/languages/luau.md new file mode 100644 index 0000000000..109bb9383c --- /dev/null +++ b/docs/src/languages/luau.md @@ -0,0 +1,41 @@ +# Luau + +[Luau](https://luau-lang.org/) is a fast, small, safe, gradually typed embeddable scripting language derived from Lua. Luau was developed by Roblox and available under the MIT license. + +Luau language support in Zed is provided by the community-maintained [Luau extension](https://github.com/4teapo/zed-luau). +Report issues to: [https://github.com/4teapo/zed-luau/issues](https://github.com/4teapo/zed-luau/issues) + +- Tree Sitter: [tree-sitter-grammars/tree-sitter-luau](https://github.com/tree-sitter-grammars/tree-sitter-luau) +- Language Server: [JohnnyMorganz/luau-lsp](https://github.com/JohnnyMorganz/luau-lsp) + +## Configuration + +Configuration instructions are available in the [Luau Zed Extension README](https://github.com/4teapo/zed-luau). + +## Formatting + +To support automatically formatting your code, you can use [JohnnyMorganz/StyLua](https://github.com/JohnnyMorganz/StyLua), a Lua code formatter. + +Install with: + +```sh +# MacOS via HomeBrew +brew install stylua +# Or via Cargo +cargo install stylua --features lua52,lua53,lua54,luau +``` + +Then add the following to your Zed `settings.json`: + +```json + "languages": { + "Luau": { + "formatter": { + "external": { + "command": "stylua", + "arguments": ["-"] + } + } + } + } +``` diff --git a/docs/src/languages/makefile.md b/docs/src/languages/makefile.md new file mode 100644 index 0000000000..ea79447792 --- /dev/null +++ b/docs/src/languages/makefile.md @@ -0,0 +1,6 @@ +# Makefile + +Makefile language support in Zed is provided by the community-maintained [Make extension](https://github.com/caius/zed-make). +Report issues to: [https://github.com/caius/zed-make/issues](https://github.com/caius/zed-make/issues). + +- Tree Sitter: [caius/tree-sitter-make](https://github.com/caius/tree-sitter-make) diff --git a/docs/src/languages/markdown.md b/docs/src/languages/markdown.md index 40521d087d..14786ad4f2 100644 --- a/docs/src/languages/markdown.md +++ b/docs/src/languages/markdown.md @@ -2,5 +2,32 @@ Markdown support is available natively in Zed. -- Tree Sitter: [tree-sitter-md](https://github.com/tree-sitter-grammars/tree-sitter-markdown) +- Tree Sitter: [tree-sitter-markdown](https://github.com/tree-sitter-grammars/tree-sitter-markdown) - Language Server: N/A + +## Syntax Highlighting Code Blocks + +Zed supports language-specific syntax highlighting of markdown code blocks by leveraging [tree-sitter language grammars](../extensions/languages.md#grammar). All [Zed supported languages](../languages.md), including those provided by official or community extensions, are available for use in markdown code blocks. All you need to do is provide a language name after the opening ``` code fence like so: + +````python +```python +import functools as ft + +@ft.lru_cache(maxsize=500) +def fib(n): + return n if n < 2 else fib(n - 1) + fib(n - 2) +``` +```` + +## Configuration + +If you wish change the default language settings for Markdown files, perhaps to disable auto format on save or if your markdown relies upon trailing whitespace ` ` being converted to `
` you can add change these values in your `settings.json`: + +```json + "languages": { + "Markdown": { + "remove_trailing_whitespace_on_save": true, + "format_on_save": "on" + } + }, +``` diff --git a/docs/src/languages/nim.md b/docs/src/languages/nim.md new file mode 100644 index 0000000000..48b3a13ef1 --- /dev/null +++ b/docs/src/languages/nim.md @@ -0,0 +1,24 @@ +# Nim + +Nim language support in Zed is provided by the community-maintained [Nim extension](https://github.com/foxoman/zed-nim). +Report issues to: [https://github.com/foxoman/zed-nim/issues](https://github.com/foxoman/zed-nim/issues) + +- Tree Sitter: [alaviss/tree-sitter-nim](https://github.com/alaviss/tree-sitter-nim) +- Language Server: [nim-lang/langserver](https://github.com/nim-lang/langserver) + +## Formatting + +To use [arnetheduck/nph](https://github.com/arnetheduck/nph) as a formatter, follow the [nph installation instructions](https://github.com/arnetheduck/nph?tab=readme-ov-file#installation) and add this to your Zed `settings.json`: + +```json + "languages": { + "Nim": { + "formatter": { + "external": { + "command": "nph", + "arguments": ["-"] + } + } + } + } +``` diff --git a/docs/src/languages/ocaml.md b/docs/src/languages/ocaml.md index fdcf79d748..10ffee86dd 100644 --- a/docs/src/languages/ocaml.md +++ b/docs/src/languages/ocaml.md @@ -2,6 +2,9 @@ OCaml support is available through the [OCaml extension](https://github.com/zed-industries/zed/tree/main/extensions/ocaml). +- Tree Sitter: [tree-sitter/tree-sitter-ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) +- Language Server: [ocaml/ocaml-lsp](https://github.com/ocaml/ocaml-lsp) + ## Setup Instructions If you have the development environment already setup, you can skip to [Launching Zed](#launching-zed) diff --git a/docs/src/languages/php.md b/docs/src/languages/php.md index e0ba5a4638..f72cb3f6aa 100644 --- a/docs/src/languages/php.md +++ b/docs/src/languages/php.md @@ -2,12 +2,21 @@ PHP support is available through the [PHP extension](https://github.com/zed-industries/zed/tree/main/extensions/php). +- Tree Sitter: https://github.com/tree-sitter/tree-sitter-php +- Language Servers: + - [phpactor](https://github.com/phpactor/phpactor) + - [intelephense](https://github.com/bmewburn/vscode-intelephense/) + ## Choosing a language server The PHP extension offers both `phpactor` and `intelephense` language server support. `phpactor` is enabled by default. +## Intelephense + +[Intelephense](https://intelephense.com/) is a [proprietary](https://github.com/bmewburn/vscode-intelephense/blob/master/LICENSE.txt#L29) language server for PHP operating under a freemium model. Certain features require purchase of a [premium license](https://intelephense.com/). To use these features you must place your [license.txt file](https://intelephense.com/faq.html) at `~/intelephense/licence.txt` inside your home directory. + To switch to `intelephense`, add the following to your `settings.json`: ```json @@ -19,3 +28,9 @@ To switch to `intelephense`, add the following to your `settings.json`: } } ``` + +## PHPDoc + +Zed supports syntax highlighting for PHPDoc comments. + +- Tree Sitter: [claytonrcarter/tree-sitter-phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc) diff --git a/docs/src/languages/prisma.md b/docs/src/languages/prisma.md index 9302fca17f..78af456e24 100644 --- a/docs/src/languages/prisma.md +++ b/docs/src/languages/prisma.md @@ -1,3 +1,10 @@ # Prisma Prisma support is available through the [Prisma extension](https://github.com/zed-industries/zed/tree/main/extensions/prisma). + +- Tree Sitter: [victorhqc/tree-sitter-prisma](https://github.com/victorhqc/tree-sitter-prisma) +- Language-Server: [prisma/language-tools](https://github.com/prisma/language-tools) + + diff --git a/docs/src/languages/proto.md b/docs/src/languages/proto.md index 50315b74d9..90689615c2 100644 --- a/docs/src/languages/proto.md +++ b/docs/src/languages/proto.md @@ -1,6 +1,5 @@ # Proto -Proto support is available natively in Zed. +Proto/proto3 (Protocol Buffers definition language) support is available natively in Zed. -- Tree-Sitter: [protols-tree-sitter-proto](https://github.com/coder3101/tree-sitter-proto) -- Language-Server: N/A +- Tree Sitter: [coder3101/tree-sitter-proto](https://github.com/coder3101/tree-sitter-proto) diff --git a/docs/src/languages/purescript.md b/docs/src/languages/purescript.md index f34ef23176..efa6e071f7 100644 --- a/docs/src/languages/purescript.md +++ b/docs/src/languages/purescript.md @@ -1,3 +1,6 @@ # PureScript PureScript support is available through the [PureScript extension](https://github.com/zed-industries/zed/tree/main/extensions/purescript). + +- Tree Sitter: [postsolar/tree-sitter-purescript](https://github.com/postsolar/tree-sitter-purescript) +- Language-Server: [nwolverson/purescript-language-server](https://github.com/nwolverson/purescript-language-server) diff --git a/docs/src/languages/python.md b/docs/src/languages/python.md index aa279f2b2d..5324750e7e 100644 --- a/docs/src/languages/python.md +++ b/docs/src/languages/python.md @@ -3,23 +3,23 @@ Python support is available natively in Zed. - Tree Sitter: [tree-sitter-python](https://github.com/tree-sitter/tree-sitter-python) -- Language Server: [pyright](https://github.com/microsoft/pyright) +- Language Server: [microsoft/pyright](https://github.com/microsoft/pyright) -### Configuration +## Configuration -The [pyright](https://github.com/microsoft/pyright) language server offers flexible configuration options specified in a JSON-formatted text configuration. By default, the file is called `pyrightconfig.json` and is located within the root directory of your project. Pyright settings can also be specified in a `[tool.pyright]` section of a `pyproject.toml` file. A `pyrightconfig.json` file always takes precedent over `pyproject.toml` if both are present. +The [pyright](https://github.com/microsoft/pyright) language server offers flexible configuration options specified in a JSON-formatted text configuration. By default, the file is called `pyrightconfig.json` and is located within the root directory of your project. Pyright settings can also be specified in a `[tool.pyright]` section of a `pyproject.toml` file. A `pyrightconfig.json` file always takes precedence over `pyproject.toml` if both are present. For more information, see the Pyright [configuration documentation](https://microsoft.github.io/pyright/#/configuration). -### Settings +## Settings -The [pyright](https://github.com/microsoft/pyright) language server also accepts specific LSP related settings, not necessarily connected to a project. These can be changed in the `lsp` section of your `settings.json`. +The [pyright](https://github.com/microsoft/pyright) language server also accepts specific LSP-related settings, not necessarily connected to a project. These can be changed in the `lsp` section of your `settings.json`. For example, in order to: - use strict type-checking level - diagnose all files in the workspace instead of the only open files default -- provide the path to a specific python interpreter +- provide the path to a specific Python interpreter ```json { @@ -41,9 +41,9 @@ For example, in order to: For more information, see the Pyright [settings documentation](https://microsoft.github.io/pyright/#/settings). -### Virtual environments +## Virtual environments -A python [virtual environment](https://docs.python.org/3/tutorial/venv.html) allows you to store all of a project's dependencies, including the Python interpreter and package manager, in a single directory that's isolated from any other Python projects on your computer. +A Python [virtual environment](https://docs.python.org/3/tutorial/venv.html) allows you to store all of a project's dependencies, including the Python interpreter and package manager, in a single directory that's isolated from any other Python projects on your computer. By default, the Pyright language server will look for Python packages in the default global locations. But you can also configure Pyright to use the packages installed in a given virtual environment. @@ -54,7 +54,7 @@ To do this, create a JSON file called `pyrightconfig.json` at the root of your p For example, a common approach is to create a virtual environment directory called `.venv` at the root of your project directory with the following commands: -```bash +```sh # create a virtual environment in the .venv directory python3 -m venv .venv # set up the current shell to use that virtual environment @@ -78,7 +78,7 @@ venvPath = "." venv = ".venv" ``` -You can also configure this option directly in your `settings.json` file ([pyrights settings](#settings)), as recommended in [Configuring Your Python Environment](https://microsoft.github.io/pyright/#/import-resolution?id=configuring-your-python-environment). +You can also configure this option directly in your `settings.json` file ([pyright settings](#settings)), as recommended in [Configuring Your Python Environment](https://microsoft.github.io/pyright/#/import-resolution?id=configuring-your-python-environment). ```json { @@ -94,31 +94,13 @@ You can also configure this option directly in your `settings.json` file ([pyrig } ``` -### Code formatting & Linting +## Code formatting & Linting The Pyright language server does not provide code formatting or linting. If you want to detect lint errors and reformat your Python code upon saving, you'll need to set up. -A common tool for formatting Python code is [Ruff](https://docs.astral.sh/ruff/). It is another tool written in Rust, an extremely fast Python linter and code formatter. +A common tool for formatting Python code is [Ruff](https://docs.astral.sh/ruff/). It is another tool written in Rust, an extremely fast Python linter and code formatter. It is available through the [Ruff extension](https://github.com/zed-industries/zed/tree/main/extensions/ruff/). To configure the Ruff extension to work within Zed, see the setup documentation [here](https://docs.astral.sh/ruff/editors/setup/#zed). -It is available through the [Ruff extension](https://github.com/zed-industries/zed/tree/main/extensions/ruff/). However, the code formatting through the extension is not yet available. You can set up the formatter to run on save by adding the following configuration to your `settings.json`, assuming that [`Ruff`](https://docs.astral.sh/ruff/) is installed in your Python environment. - -```json -{ - "languages": { - ..., // other languages - "Python": { - "format_on_save": { - "external": { - "command": "python", - "arguments": [ - "-m", - "ruff", - "format", - "-" - ] - } - } - } - } -} -``` + diff --git a/docs/src/languages/r.md b/docs/src/languages/r.md index f20368e628..934df61e59 100644 --- a/docs/src/languages/r.md +++ b/docs/src/languages/r.md @@ -2,6 +2,9 @@ R support is available through the [R extension](https://github.com/ocsmit/zed-r). +- Tree Sitter: [r-lib/tree-sitter-r](https://github.com/r-lib/tree-sitter-r) +- Language-Server: [REditorSupport/languageserver](https://github.com/REditorSupport/languageserver) + ## Installation - [Install R](https://cloud.r-project.org/) @@ -13,3 +16,7 @@ install.packages("lintr") ``` - Install the [R extension](https://github.com/ocsmit/zed-r) through Zed's extensions + + diff --git a/docs/src/languages/racket.md b/docs/src/languages/racket.md index 379a5c8348..4718b08f2d 100644 --- a/docs/src/languages/racket.md +++ b/docs/src/languages/racket.md @@ -1,3 +1,7 @@ # Racket Racket support is available through the [Racket extension](https://github.com/zed-industries/zed/tree/main/extensions/racket). + +- Tree Sitter: [zed-industries/tree-sitter-racket](https://github.com/zed-industries/tree-sitter-racket) + +The [racket-language-server](https://docs.racket-lang.org/racket-language-server/index.html) is not yet supported in Zed, please see [Issue #15789](https://github.com/zed-industries/zed/issues/15789) for more information. diff --git a/docs/src/languages/roc.md b/docs/src/languages/roc.md new file mode 100644 index 0000000000..5a8e562be2 --- /dev/null +++ b/docs/src/languages/roc.md @@ -0,0 +1,14 @@ +# Roc + +[Roc](https://www.roc-lang.org/) is a fast, friendly, functional language. + +Roc language support in Zed is provided by the community-maintained [Roc extension](https://github.com/h2000/zed-roc). +Report issues to: [https://github.com/h2000/zed-roc/issues](https://github.com/h2000/zed-roc/issues) + +- Tree Sitter: [faldor20/tree-sitter-roc](https://github.com/faldor20/tree-sitter-roc) +- Language Server: [roc-lang/roc/tree/main/crates/language_server](https://github.com/roc-lang/roc/tree/main/crates/language_server) + +## Setup + +1. Follow instructions to [Install Roc](https://www.roc-lang.org/install) from the Roc-Lang website. +2. Ensure `roc` and `roc_language_server` are in your PATH. diff --git a/docs/src/languages/rst.md b/docs/src/languages/rst.md new file mode 100644 index 0000000000..f0817acb43 --- /dev/null +++ b/docs/src/languages/rst.md @@ -0,0 +1,7 @@ +# ReStructuredText (rst) + +ReStructuredText language support in Zed is provided by the community-maintained [reST extension](https://github.com/elmarco/zed-rst). +Report issues to: [https://github.com/elmarco/zed-rst/issues](https://github.com/elmarco/zed-rst/issues) + +- Tree Sitter: [stsewd/tree-sitter-rst.git](https://github.com/stsewd/tree-sitter-rst.git) +- Language Server: [swyddfa/esbonio](https://github.com/swyddfa/esbonio) diff --git a/docs/src/languages/ruby.md b/docs/src/languages/ruby.md index 19979bea97..8449342f60 100644 --- a/docs/src/languages/ruby.md +++ b/docs/src/languages/ruby.md @@ -2,13 +2,36 @@ Ruby support is available through the [Ruby extension](https://github.com/zed-industries/zed/tree/main/extensions/ruby). +- Tree-sitters: + - [tree-sitter-ruby](https://github.com/tree-sitter/tree-sitter-ruby) + - [tree-sitter-embedded-template](https://github.com/tree-sitter/tree-sitter-embedded-template) +- Language Servers: + - [ruby-lsp](https://github.com/Shopify/ruby-lsp) + - [solargraph](https://github.com/castwide/solargraph) + - [rubocop](https://github.com/rubocop/rubocop) + The Ruby extension also provides support for ERB files. -## Choosing a language server +## Language Servers -The Ruby extension offers both `solargraph` and `ruby-lsp` language server support. +There are multiple language servers available for Ruby. Zed supports the two following: -`solargraph` is enabled by default. +- [solargraph](https://github.com/castwide/solargraph) +- [ruby-lsp](https://github.com/Shopify/ruby-lsp) + +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. + +## Configuring a language server + +The [Ruby extension](https://github.com/zed-industries/zed/tree/main/extensions/ruby) offers both `solargraph` and `ruby-lsp` language server support. + +### Using `solargraph` + +`solargraph` is enabled by default in the Ruby extension. + +### Using `ruby-lsp` To switch to `ruby-lsp`, add the following to your `settings.json`: @@ -22,8 +45,13 @@ To switch to `ruby-lsp`, add the following to your `settings.json`: } ``` -The Ruby extension also provides support for `rubocop` language server for offense detection and autocorrection. To enable it, add the following to your -`settings.json`: +That disables `solargraph` and `rubocop` and enables `ruby-lsp`. + +### Using `rubocop` + +The Ruby extension also provides support for `rubocop` language server for offense detection and autocorrection. + +To enable it, add the following to your `settings.json`: ```json { @@ -35,19 +63,31 @@ The Ruby extension also provides support for `rubocop` language server for offen } ``` +Or, conversely, you can disable `ruby-lsp` and enable `solargraph` and `rubocop` by adding the following to your `settings.json`: + +```json +{ + "languages": { + "Ruby": { + "language_servers": ["solargraph", "rubocop", "!ruby-lsp", "..."] + } + } +} +``` + ## Setting up `solargraph` Zed currently doesn't install Solargraph automatically. To use Solargraph, you need to install the gem. Zed just looks for an executable called `solargraph` on your `PATH`. You can install the gem manually with the following command: -```shell +```sh gem install solargraph ``` Alternatively, if your project uses Bundler, you can add the Solargraph gem to your `Gemfile`: -```ruby +```rb gem 'solargraph', group: :development ``` @@ -66,7 +106,7 @@ Solargraph has formatting and diagnostics disabled by default. We can tell Zed t } ``` -To use Solargraph in the context of the bundle, you can use [folder-specific settings](../configuring-zed#settings-files) and specify the absolute path to the [`binstub`](https://bundler.io/v2.5/man/bundle-binstubs.1.html) of Solargraph: +To use Solargraph in the context of the bundle, you can use [folder-specific settings](../configuring-zed.md#settings-files) and specify the absolute path to the [`binstub`](https://bundler.io/v2.5/man/bundle-binstubs.1.html) of Solargraph: ```json { @@ -90,7 +130,7 @@ Zed currently doesn't install Ruby LSP automatically. To use Ruby LSP, you need You can install the gem manually with the following command: -```shell +```sh gem install ruby-lsp ``` @@ -116,7 +156,7 @@ Zed currently doesn't install `rubocop` automatically. To use `rubocop`, you nee You can install the gem manually with the following command: -```shell +```sh gem install rubocop ``` @@ -134,7 +174,7 @@ Rubocop has unsafe autocorrection disabled by default. We can tell Zed to enable } ``` -To use Rubocop in the context of the bundle, you can use [folder-specific settings](../configuring-zed#settings-files) and specify the absolute path to the [`binstub`](https://bundler.io/v2.5/man/bundle-binstubs.1.html) of Rubocop: +To use Rubocop in the context of the bundle, you can use [folder-specific settings](../configuring-zed.md#settings-files) and specify the absolute path to the [`binstub`](https://bundler.io/v2.5/man/bundle-binstubs.1.html) of Rubocop: ```json { @@ -179,7 +219,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: -```ruby +```rb # Ruby file: def method div(class: "pl-2 ") do diff --git a/docs/src/languages/rust.md b/docs/src/languages/rust.md index 12ef427c7b..026b522898 100644 --- a/docs/src/languages/rust.md +++ b/docs/src/languages/rust.md @@ -2,8 +2,14 @@ Rust support is available natively in Zed. -- Tree Sitter: [tree-sitter-rust](https://github.com/tree-sitter/tree-sitter-rust) -- Language Server: [rust-analyzer](https://github.com/rust-lang/rust-analyzer) +- Tree Sitter: [tree-sitter/tree-sitter-rust](https://github.com/tree-sitter/tree-sitter-rust) +- Language Server: [rust-lang/rust-analyzer](https://github.com/rust-lang/rust-analyzer) + + ## Inlay Hints @@ -28,7 +34,7 @@ Use ```json "lsp": { - "$LANGUAGE_SERVER_NAME": { + "rust-analyzer": { "initialization_options": { .... } @@ -38,7 +44,7 @@ Use to override these settings. -See https://rust-analyzer.github.io/manual.html#inlay-hints for more information. +See [Inlay Hints](https://rust-analyzer.github.io/manual.html#inlay-hints) in the Rust Analyzer Manual for more information. ## Target directory @@ -60,8 +66,45 @@ The `rust-analyzer` target directory can be set in `initialization_options`: A `true` setting will set the target directory to `target/rust-analyzer`. You can set a custom directory with a string like `"target/analyzer"` instead of `true`. +## Binary + +You can configure which `rust-analyzer` binary Zed should use. + +To use a binary in a custom location, add the following to your `settings.json`: + +```json +{ + "lsp": { + "rust-analyzer": { + "binary": { + "path": "/Users/example/bin/rust-analyzer", + "args": [] + } + } + } +} +``` + +To use a binary that is on your `$PATH`, add the following to your `settings.json`: + +```json +{ + "lsp": { + "rust-analyzer": { + "binary": { + "path_lookup": true + } + } + } +} +``` + ## More server configuration + + Rust-analyzer [manual](https://rust-analyzer.github.io/manual.html) describes various features and configuration options for rust-analyzer language server. Rust-analyzer in Zed runs with the default parameters. @@ -84,7 +127,7 @@ rust-analyzer.cargo.allTargets (default: true) Pass --all-targets to cargo invocation ``` -Which would mean that every time Zed [auto]saves, a `cargo check --workspace --all-targets` command is run, checking the entire project (workspace), lib, doc, test, bin, bench and [other targets](https://doc.rust-lang.org/cargo/reference/cargo-targets.html). +Which would mean that every time Zed saves, a `cargo check --workspace --all-targets` command is run, checking the entire project (workspace), lib, doc, test, bin, bench and [other targets](https://doc.rust-lang.org/cargo/reference/cargo-targets.html). While that works fine on small projects, it does not scale well. diff --git a/docs/src/languages/scala.md b/docs/src/languages/scala.md new file mode 100644 index 0000000000..34e1d71968 --- /dev/null +++ b/docs/src/languages/scala.md @@ -0,0 +1,29 @@ +# Scala + +Scala language support in Zed is provided by the community-maintained [Scala extension](https://github.com/scalameta/metals-zed). +Report issues to: [https://github.com/scalameta/metals-zed/issues](https://github.com/scalameta/metals-zed/issues) + +- Tree Sitter: [tree-sitter/tree-sitter-scala](https://github.com/tree-sitter/tree-sitter-scala) +- Language Server: [scalameta/metals](https://github.com/scalameta/metals) + +## Setup + +- Install Scala with `cs setup` (Coursier): https://www.scala-lang.org/download/ + - `brew install coursier/formulas/coursier && cs setup` +- REPL (Almond) Setup Instructions https://almond.sh/docs/quick-start-install + - `brew install --cask temurin` (Eclipse foundation official OpenJDK binaries) + - `brew install coursier/formulas/coursier && cs setup` + - `coursier launch --use-bootstrap almond -- --install` + +## Configuration + +Behavior of the Metals language server can be controlled with: + +- `.scalafix.conf` file - See [Scalafix Configuration](https://scalacenter.github.io/scalafix/docs/users/configuration.html) +- `.scalafmt.conf` file - See [Scalafmt Configuration](https://scalameta.org/scalafmt/docs/configuration.html) + +You can place these files in the root of your project or specifying their location in the Metals configuration. See [Metals User Configuration](https://scalameta.org/metals/docs/editors/user-configuration) for more. + + diff --git a/docs/src/languages/scheme.md b/docs/src/languages/scheme.md index 3be418b037..97b143c64d 100644 --- a/docs/src/languages/scheme.md +++ b/docs/src/languages/scheme.md @@ -1,3 +1,5 @@ # Scheme Scheme support is available through the [Scheme extension](https://github.com/zed-industries/zed/tree/main/extensions/scheme). + +- Tree Sitter: [6cdh/tree-sitter-scheme](https://github.com/6cdh/tree-sitter-scheme) diff --git a/docs/src/languages/svelte.md b/docs/src/languages/svelte.md index a048ee173f..1c6fd49b3e 100644 --- a/docs/src/languages/svelte.md +++ b/docs/src/languages/svelte.md @@ -2,6 +2,13 @@ Svelte support is available through the [Svelte extension](https://github.com/zed-industries/zed/tree/main/extensions/svelte). +- Tree Sitter: [Himujjal/tree-sitter-svelte](https://github.com/Himujjal/tree-sitter-svelte) +- Language Server: [sveltejs/language-tools](https://github.com/sveltejs/language-tools) + + + ## Inlay Hints Zed sets the following initialization options for inlay Hints: @@ -37,7 +44,7 @@ Use ```json "lsp": { - "$LANGUAGE_SERVER_NAME": { + "svelte-language-server": { "initialization_options": { "configuration": { "typescript": { diff --git a/docs/src/languages/swift.md b/docs/src/languages/swift.md new file mode 100644 index 0000000000..e87a70afb7 --- /dev/null +++ b/docs/src/languages/swift.md @@ -0,0 +1,11 @@ +# Swift + +Swift language support in Zed is provided by the community-maintained [Swift extension](https://github.com/zed-extensions/swift). +Report issues to: [https://github.com/zed-extensions/swift/issues](https://github.com/zed-extensions/swift/issues) + +- 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) + +## 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. diff --git a/docs/src/languages/tailwindcss.md b/docs/src/languages/tailwindcss.md new file mode 100644 index 0000000000..3290a68a99 --- /dev/null +++ b/docs/src/languages/tailwindcss.md @@ -0,0 +1,25 @@ +# TailWind CSS + +Tailwind CSS support is built into Zed. + +- Tree Sitter: [] +- Language Server: [tailwindlabs/tailwindcss-intellisense](https://github.com/tailwindlabs/tailwindcss-intellisense) + +## Configuration + + + +Languages which can be used with Tailwind CSS in Zed + +- [Astro](./astro.md) +- [CSS](./css.md) +- [ERB](./ruby.md) +- [HEEx](./elixir.md#heex) +- [HTML](./html.md) +- [TypeScript](./typescript.md) +- [JavaScript](./javascript.md) +- [PHP](./php.md) +- [Svelte](./svelte.md) +- [Vue](./vue.md) diff --git a/docs/src/languages/terraform.md b/docs/src/languages/terraform.md index 894db30dea..6a5365b308 100644 --- a/docs/src/languages/terraform.md +++ b/docs/src/languages/terraform.md @@ -2,7 +2,14 @@ Terraform support is available through the [Terraform extension](https://github.com/zed-industries/zed/tree/main/extensions/terraform). -### Configuration +- Tree sitter: [MichaHoffmann/tree-sitter-hcl](https://github.com/MichaHoffmann/tree-sitter-hcl) +- Language Server: [hashicorp/terraform-ls](https://github.com/hashicorp/terraform-ls) + +## Configuration + + The Terraform language server can be configured in your `settings.json`, e.g.: diff --git a/docs/src/languages/toml.md b/docs/src/languages/toml.md index 5a415dfe89..a4aa8436ff 100644 --- a/docs/src/languages/toml.md +++ b/docs/src/languages/toml.md @@ -1,3 +1,20 @@ # TOML TOML support is available through the [TOML extension](https://github.com/zed-industries/zed/tree/main/extensions/toml). + +- Tree Sitter: [tree-sitter/tree-sitter-toml](https://github.com/tree-sitter/tree-sitter-toml) +- Language Server: [tamasfe/taplo](https://github.com/tamasfe/taplo) + +## Configuration + +You can control the behavior of the Taplo TOML language server by adding a `.taplo.toml` file to the root of your project. See the [Taplo Configuration File](https://taplo.tamasfe.dev/configuration/file.html#configuration-file) and [Taplo Formatter Options](https://taplo.tamasfe.dev/configuration/formatter-options.html) documentation for more. + +```toml +# .taplo.toml +include = ["Cargo.toml", "some_directory/**/*.toml"] +# exclude = ["Cargo.toml"] + +[formatting] +align_entries = true +reorder_keys = true +``` diff --git a/docs/src/languages/typescript.md b/docs/src/languages/typescript.md index 61af276337..ac36a56f6a 100644 --- a/docs/src/languages/typescript.md +++ b/docs/src/languages/typescript.md @@ -2,9 +2,16 @@ TypeScript and TSX support are available natively in Zed. -- Tree Sitter: [tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) -- Language Server: [vtsls](https://github.com/yioneko/vtsls) -- Alternate Language Server: [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server) +- Tree Sitter: [tree-sitter/tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) +- Language Server: [yioneko/vtsls](https://github.com/yioneko/vtsls) +- Alternate Language Server: [typescript-language-server/typescript-language-server](https://github.com/typescript-language-server/typescript-language-server) + + ## Inlay Hints @@ -41,8 +48,9 @@ Use to override these settings. -See https://github.com/typescript-language-server/typescript-language-server?tab=readme-ov-file#inlay-hints-textdocumentinlayhint for more information. +See [typescript-language-server inlayhints documentation](https://github.com/typescript-language-server/typescript-language-server?tab=readme-ov-file#inlay-hints-textdocumentinlayhint) for more information. -## Yarn integration +## See also -See [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn. +- [Zed Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn. +- [Zed Deno documentation](./deno.md) diff --git a/docs/src/languages/uiua.md b/docs/src/languages/uiua.md index 4e2a039c6d..2f680a5e8a 100644 --- a/docs/src/languages/uiua.md +++ b/docs/src/languages/uiua.md @@ -1,3 +1,8 @@ # Uiua +[Uiua](https://www.uiua.org/) is a general purpose, stack-based, array-oriented programming language with a focus on simplicity, beauty, and tacit code. + Uiua support is available through the [Uiua extension](https://github.com/zed-industries/zed/tree/main/extensions/uiua). + +- Tree Sitter: [shnarazk/tree-sitter-uiua](https://github.com/shnarazk/tree-sitter-uiua) +- Language Server: [uiua-lang/uiua](https://github.com/uiua-lang/uiua/) diff --git a/docs/src/languages/vue.md b/docs/src/languages/vue.md index 38d06a6edc..3231ead94d 100644 --- a/docs/src/languages/vue.md +++ b/docs/src/languages/vue.md @@ -2,4 +2,7 @@ Vue support is available through the [Vue extension](https://github.com/zed-industries/zed/tree/main/extensions/vue). +- Tree Sitter: [tree-sitter-grammars/tree-sitter-vue](https://github.com/tree-sitter-grammars/tree-sitter-vue) +- Language Server: [vuejs/language-tools/](https://github.com/vuejs/language-tools/) + > `@vue/language-server` is pinned to v1.8 due to some issues in v2.x [#9846](https://github.com/zed-industries/zed/pull/9846) diff --git a/docs/src/languages/yaml.md b/docs/src/languages/yaml.md index a0ad86bf22..36895a94c1 100644 --- a/docs/src/languages/yaml.md +++ b/docs/src/languages/yaml.md @@ -2,5 +2,5 @@ YAML support is available natively in Zed. -- Tree Sitter: [tree-sitter-yaml](https://github.com/zed-industries/tree-sitter-yaml) -- Language Server: [yaml-language-server](https://github.com/redhat-developer/yaml-language-server) +- Tree Sitter: [zed-industries/tree-sitter-yaml](https://github.com/zed-industries/tree-sitter-yaml) +- Language Server: [redhat-developer/yaml-language-server](https://github.com/redhat-developer/yaml-language-server) diff --git a/docs/src/languages/zig.md b/docs/src/languages/zig.md index 3eca03192d..27b1737445 100644 --- a/docs/src/languages/zig.md +++ b/docs/src/languages/zig.md @@ -1,3 +1,6 @@ # Zig Zig support is available through the [Zig extension](https://github.com/zed-industries/zed/tree/main/extensions/zig). + +- Tree-Sitter: [tree-sitter-zig](https://github.com/maxxnino/tree-sitter-zig) +- Language Server: [zls](https://github.com/zigtools/zls) diff --git a/docs/src/linux.md b/docs/src/linux.md index 7087e362d4..833768c4a2 100644 --- a/docs/src/linux.md +++ b/docs/src/linux.md @@ -1,6 +1,6 @@ # Zed on Linux -For most people we recommend using the script on the [download](/download) page to install Zed: +For most people we recommend using the script on the [download](https://zed.dev/download) page to install Zed: ```sh curl -f https://zed.dev/install.sh | sh diff --git a/docs/src/remote-development.md b/docs/src/remote-development.md index 8424830cb4..bd0bb26e5e 100644 --- a/docs/src/remote-development.md +++ b/docs/src/remote-development.md @@ -59,17 +59,21 @@ The remote machine must be able to run Zed. The following platforms should work, > **Note:** This may change as the alpha program continues. + + You can edit the settings file on the remote instance. To do so, add a new project to your server in the directory `~/.config/zed`. You can create a file called `settings.json` if it does not yet exist. Note that this is most useful for configuring language servers, as any UI related settings do not apply. If you'd like to install language-server extensions, you can add them to the list of `auto_installed_extensions`. Again you don't need to do this to get syntax highlighting (which is handled by the local zed). -``` +```json { "auto_install_extensions": { "java": true - }, + } } ``` @@ -93,13 +97,13 @@ We are working on a direct SSH connection feature, which you can try out if you' To try this out you can either from the command line run: -``` +```sh zed ssh://user@host:port/path/to/project ``` Or you can (in your settings file) add: -``` +```json "ssh_connections": [] ``` diff --git a/docs/src/repl.md b/docs/src/repl.md index 58f72ce5fa..19f8c0e189 100644 --- a/docs/src/repl.md +++ b/docs/src/repl.md @@ -28,8 +28,11 @@ Zed supports running code in multiple languages. To get started, you need to ins **Currently supported languages:** - [Python (ipykernel)](#python) -- [R (Ark)](#r) - [TypeScript (Deno)](#typescript-deno) +- [R (Ark)](#r-ark) +- [R (Xeus)](#r-xeus) +- [Julia](#julia) +- [Scala (Almond)](#scala) Once installed, you can start using the REPL in the respective language files, or other places those languages are supported, such as Markdown. If you recently added the kernels, run the `repl: refresh kernelspecs` command to make them available in the editor. @@ -73,14 +76,14 @@ On MacOS, your system Python will _not_ work. Either set up [pyenv](https://gith To setup your current python to have an available kernel, run: -``` +```sh pip install ipykernel python -m ipykernel install --user ``` #### Conda Environment -``` +```sh source activate myenv conda install ipykernel python -m ipykernel install --user --name myenv --display-name "Python (myenv)" @@ -88,37 +91,58 @@ python -m ipykernel install --user --name myenv --display-name "Python (myenv)" #### Virtualenv with pip -``` +```sh source activate myenv pip install ipykernel python -m ipykernel install --user --name myenv --display-name "Python (myenv)" ``` -### R +### R (Ark Kernel) {#r-ark} Install [Ark](https://github.com/posit-dev/ark/releases) by downloading the release for your operating system. E.g. for macOS just unpack `ark` binary and put it into `/usr/local/bin`. Then run: -``` +```sh ark --install ``` +### R (Xeus Kernel) {#r-xeus} + +- Install [Xeus-R](https://github.com/jupyter-xeus/xeus-r) +- Install the R Extension for Zed (search for `R` in Zed Extensions) + + + ### Typescript: Deno {#typescript-deno} -[Install Deno](https://docs.deno.com/runtime/manual/getting_started/installation/) and then install the Deno jupyter kernel: +- [Install Deno](https://docs.deno.com/runtime/manual/getting_started/installation/) and then install the Deno jupyter kernel: -``` +```sh deno jupyter --install ``` -### Other languages + -The following languages and kernels are also supported. You can help us out by expanding their installation instructions and configuration: +### Julia -- [Julia (IJulia)](https://github.com/JuliaLang/IJulia.jl) -- R - - [Ark Kernel](https://github.com/posit-dev/ark) - via Positron, formerly RStudio - - [Xeus-R](https://github.com/jupyter-xeus/xeus-r) -- [Scala (almond)](https://almond.sh/docs/quick-start-install) +- Download and install Julia from the [official website](https://julialang.org/downloads/). +- Install the Julia Extension for Zed (search for `Julia` in Zed Extensions) + + + +### Scala + +- Install Scala with `cs setup` (Coursier): https://www.scala-lang.org/download/ + - `brew install coursier/formulas/coursier && cs setup` +- REPL (Almond) Setup Instructions https://almond.sh/docs/quick-start-install + - `brew install --cask temurin` (Eclipse foundation official OpenJDK binaries) + - `brew install coursier/formulas/coursier && cs setup` + - `coursier launch --use-bootstrap almond -- --install` ## Changing which kernel is used per language {#changing-kernels} @@ -144,7 +168,7 @@ Available kernels are shown via the `repl: sessions` command. To refresh the ker If you have `jupyter` installed, you can run `jupyter kernelspec list` to see the available kernels. -``` +```sh $ jupyter kernelspec list Available kernels: ark /Users/z/Library/Jupyter/kernels/ark diff --git a/docs/src/tasks.md b/docs/src/tasks.md index 05d4337162..26b714d205 100644 --- a/docs/src/tasks.md +++ b/docs/src/tasks.md @@ -94,7 +94,7 @@ The same task modal opened via `task: spawn` supports arbitrary bash-like comman Task modal will persist list of those command for current Zed session, `task: rerun` will also rerun such tasks if they were the last ones spawned. -You can also adjust currently selected task in a modal (`opt-e` is a default key binding). Doing so will put it's command into a prompt that can then be edited & spawned as an oneshot task. +You can also adjust currently selected task in a modal (`tab` is a default key binding). Doing so will put it's command into a prompt that can then be edited & spawned as an oneshot task. ### Ephemeral tasks @@ -103,7 +103,7 @@ The intended use of ephemeral tasks is to stay in the flow with continuous `task ## Custom keybindings for tasks -You can define your own keybindings for your tasks via additional argument to `task::Spawn`. If you wanted to bind the aforementioned `echo current file's path` task to `alt-g`, you would add the following snippet in your [`keymap.json`](./key-bindings/) file: +You can define your own keybindings for your tasks via additional argument to `task::Spawn`. If you wanted to bind the aforementioned `echo current file's path` task to `alt-g`, you would add the following snippet in your [`keymap.json`](./key-bindings.md) file: ```json { diff --git a/docs/src/themes.md b/docs/src/themes.md index 29a0d5da18..7082520933 100644 --- a/docs/src/themes.md +++ b/docs/src/themes.md @@ -25,3 +25,38 @@ By default, Zed maintains two themes: one for light mode and one for dark mode. } } ``` + +## Theme Overrides + +You can also override specific attributes of a theme, by using the `experimental.theme_overrides` setting. + +For example, to override the background color of the editor and the font style of comments, you can add the following to your `settings.json` file: + +```json +{ + "experimental.theme_overrides": { + "editor.background": "#333", + "syntax": { + "comment": { + "font_style": "italic" + } + } + } +} +``` + +You can see which attributes are available to override by looking at the JSON format of your theme. For example, [here is the JSON format for the `One` themes](https://github.com/zed-industries/zed/blob/main/assets/themes/one/one.json). + +## Local Themes + +You can store new themes locally, by placing them in the `~/.config/zed/themes` directory. + +For example, to create a new theme called `my-cool-theme`, you can create a file called `my-cool-theme.json` in that directory. + +It will be available in the theme selector the next time Zed loads. + +You can find a lot of themes at [zed-themes.com](https://zed-themes.com). + +## Theme Development + +See: [Developing Zed Themes](./extensions/themes.md) diff --git a/docs/src/vim.md b/docs/src/vim.md index a00ccab70f..15a70a4dc1 100644 --- a/docs/src/vim.md +++ b/docs/src/vim.md @@ -116,7 +116,7 @@ For vim-specific shortcuts, you may find the following template a good place to ] ``` -If you would like to emulate vim's `map` (`nmap` etc.) commands you can bind to the [`workspace::SendKeystrokes`](/docs/key-bindings#remapping-keys) action in the correct context. +If you would like to emulate vim's `map` (`nmap` etc.) commands you can bind to the [`workspace::SendKeystrokes`](./key-bindings.md#remapping-keys) action in the correct context. You can see the bindings that are enabled by default in vim mode [here](https://github.com/zed-industries/zed/blob/main/assets/keymaps/vim.json). @@ -135,7 +135,7 @@ Vim mode adds several contexts to the `Editor`: If you're using Vim mode on Linux or Windows, you may find that it has overridden keybindings that you can't live without. You can restore them to their defaults by copying these into your keymap: -``` +```json { "context": "Editor && !menu", "bindings": { @@ -290,15 +290,17 @@ If you want to navigate between the editor and docks (terminal, project panel, A Subword motion is not enabled by default. To enable it, add these bindings to your keymap. ```json +[ { - "context": "VimControl && !menu", + "context": "VimControl && !menu && vim_mode != operator", "bindings": { "w": "vim::NextSubwordStart", "b": "vim::PreviousSubwordStart", "e": "vim::NextSubwordEnd", "g e": "vim::PreviousSubwordEnd" } - }, + } +] ``` Surrounding the selection in visual mode is also not enabled by default (`shift-s` normally behaves like `c`). To enable it, add the following to your keymap. diff --git a/docs/src/windows.md b/docs/src/windows.md new file mode 100644 index 0000000000..f3650c0467 --- /dev/null +++ b/docs/src/windows.md @@ -0,0 +1,13 @@ +# Zed on Windows + +Zed is not supported on Windows (yet). We have limited developer bandwidth, and a +new platform is a large undertaking. However, the community has developed +a build of Zed on Windows, and you can compile it yourself with these instructions: + +- [Building for Windows](./development/windows.md) + +Zed Employees are not currently working on the Windows build. +However, we welcome contributions from the community to improve Windows support. + +- [GitHub Issues with 'Windows' label](https://github.com/zed-industries/zed/issues?q=is%3Aissue+is%3Aopen+label%3Awindows) +- [#windows-port on Zed Community Discord](https://discord.com/channels/869392257814519848/1208481909676576818)