logiguard fork: GPUI xdg-activation keyboard-focus serial fix
Some checks failed
Update All Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Triage Project Sync (#84) / Sync triage project (push) Has been cancelled
release_nightly / notify_on_failure (push) Has been cancelled
release_nightly / check_style (push) Has been cancelled
release_nightly / run_tests_windows (push) Has been cancelled
release_nightly / clippy_windows (push) Has been cancelled
release_nightly / bundle_linux_aarch64 (push) Has been cancelled
release_nightly / bundle_linux_x86_64 (push) Has been cancelled
release_nightly / bundle_mac_aarch64 (push) Has been cancelled
release_nightly / bundle_mac_x86_64 (push) Has been cancelled
release_nightly / bundle_windows_aarch64 (push) Has been cancelled
release_nightly / bundle_windows_x86_64 (push) Has been cancelled
release_nightly / build_nix_linux_x86_64 (push) Has been cancelled
release_nightly / build_nix_mac_aarch64 (push) Has been cancelled
release_nightly / update_nightly_tag (push) Has been cancelled
Hotfix Review Monitor / check-hotfix-reviews (push) Has been cancelled
Stale PR Review Reminder / check-stale-prs (push) Has been cancelled
Update Weekly Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Bump collab-staging Tag / update-collab-staging-tag (push) Has been cancelled
compliance_check / scheduled_compliance_check (push) Has been cancelled
Some checks failed
Update All Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Triage Project Sync (#84) / Sync triage project (push) Has been cancelled
release_nightly / notify_on_failure (push) Has been cancelled
release_nightly / check_style (push) Has been cancelled
release_nightly / run_tests_windows (push) Has been cancelled
release_nightly / clippy_windows (push) Has been cancelled
release_nightly / bundle_linux_aarch64 (push) Has been cancelled
release_nightly / bundle_linux_x86_64 (push) Has been cancelled
release_nightly / bundle_mac_aarch64 (push) Has been cancelled
release_nightly / bundle_mac_x86_64 (push) Has been cancelled
release_nightly / bundle_windows_aarch64 (push) Has been cancelled
release_nightly / bundle_windows_x86_64 (push) Has been cancelled
release_nightly / build_nix_linux_x86_64 (push) Has been cancelled
release_nightly / build_nix_mac_aarch64 (push) Has been cancelled
release_nightly / update_nightly_tag (push) Has been cancelled
Hotfix Review Monitor / check-hotfix-reviews (push) Has been cancelled
Stale PR Review Reminder / check-stale-prs (push) Has been cancelled
Update Weekly Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Bump collab-staging Tag / update-collab-staging-tag (push) Has been cancelled
compliance_check / scheduled_compliance_check (push) Has been cancelled
Single-commit orphan branch: full zed-industries/zed @ 8c74db0 source tree with a 3-file patch applied (no upstream history). Patch (crates/gpui_linux/src/linux/wayland/): - serial.rs: add SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; add latest_serial_of() - window.rs: activate() uses keyboard-enter serial (Mutter focus gate) Mutter honors window activation only when the token carries the keyboard- focus serial from wl_keyboard.enter; GPUI used a stale mouse-press serial. See docs/tray-window-focus-wayland.md in logiguard. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
141
docs/src/languages/ansible.md
Normal file
141
docs/src/languages/ansible.md
Normal file
@@ -0,0 +1,141 @@
|
||||
---
|
||||
title: Ansible
|
||||
description: "Configure Ansible language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Ansible
|
||||
|
||||
Support for Ansible in Zed is provided via a community-maintained [Ansible extension](https://github.com/kartikvashistha/zed-ansible).
|
||||
|
||||
- Tree-sitter: [zed-industries/tree-sitter-yaml](https://github.com/zed-industries/tree-sitter-yaml)
|
||||
- Language Server: [ansible/vscode-ansible](https://github.com/ansible/vscode-ansible/tree/main/packages/ansible-language-server)
|
||||
|
||||
## Setup
|
||||
|
||||
### File detection
|
||||
|
||||
To avoid mishandling non-Ansible YAML files, the Ansible Language is not associated with any file extensions by default.
|
||||
|
||||
To change this behavior, you can add a `"file_types"` section to Zed settings inside your project (`.zed/settings.json`) or your Zed user settings (`~/.config/zed/settings.json`) to match your folder/naming conventions. For example:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"file_types": {
|
||||
"Ansible": [
|
||||
"**.ansible.yml",
|
||||
"**.ansible.yaml",
|
||||
"**/defaults/*.yml",
|
||||
"**/defaults/*.yaml",
|
||||
"**/meta/*.yml",
|
||||
"**/meta/*.yaml",
|
||||
"**/tasks/*.yml",
|
||||
"**/tasks/*.yaml",
|
||||
"**/handlers/*.yml",
|
||||
"**/handlers/*.yaml",
|
||||
"**/group_vars/*.yml",
|
||||
"**/group_vars/*.yaml",
|
||||
"**/host_vars/*.yml",
|
||||
"**/host_vars/*.yaml",
|
||||
"**/playbooks/*.yml",
|
||||
"**/playbooks/*.yaml",
|
||||
"**playbook*.yml",
|
||||
"**playbook*.yaml"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Feel free to modify this list as per your needs.
|
||||
|
||||
#### Inventory
|
||||
|
||||
If your inventory file is in the YAML format, you can either:
|
||||
|
||||
- Append the `ansible-lint` inventory JSON schema to it via the following comment at the top of your inventory file:
|
||||
|
||||
```yml
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json
|
||||
```
|
||||
|
||||
- or, configure the YAML language server settings to set this schema for all your inventory files, that match your inventory pattern, under your Zed settings ([ref](https://zed.dev/docs/languages/yaml)):
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"yaml-language-server": {
|
||||
"settings": {
|
||||
"yaml": {
|
||||
"schemas": {
|
||||
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json": [
|
||||
"./inventory/*.yaml",
|
||||
"hosts.yml"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### LSP Configuration
|
||||
|
||||
By default, the following configuration is passed to the Ansible language server. It conveniently mirrors the defaults set by [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/blob/03bc581e05e81d33808b42b2d7e76d70adb3b595/lua/lspconfig/configs/ansiblels.lua) for the Ansible language server:
|
||||
|
||||
```json
|
||||
{
|
||||
"ansible": {
|
||||
"ansible": {
|
||||
"path": "ansible"
|
||||
},
|
||||
"executionEnvironment": {
|
||||
"enabled": false
|
||||
},
|
||||
"python": {
|
||||
"interpreterPath": "python3"
|
||||
},
|
||||
"validation": {
|
||||
"enabled": true,
|
||||
"lint": {
|
||||
"enabled": true,
|
||||
"path": "ansible-lint"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> **Note:** In order for linting to work, ensure that `ansible-lint` is installed and discoverable on your `$PATH`.
|
||||
|
||||
When desired, any of the above default settings can be overridden under the `"lsp"` section of your Zed settings file. For example:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
// The Zed Ansible extension prefixes all settings with `ansible`
|
||||
// so use `ansible.path` instead of `ansible.ansible.path`.
|
||||
"ansible-language-server": {
|
||||
"settings": {
|
||||
"ansible": {
|
||||
"path": "ansible"
|
||||
},
|
||||
"executionEnvironment": {
|
||||
"enabled": false
|
||||
},
|
||||
"python": {
|
||||
"interpreterPath": "python3"
|
||||
},
|
||||
"validation": {
|
||||
"enabled": false,
|
||||
"lint": {
|
||||
"enabled": false,
|
||||
"path": "ansible-lint"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A full list of options/settings that can be passed to the server can be found at the project's page [here](https://github.com/ansible/vscode-ansible/blob/main/docs/als/settings.md).
|
||||
11
docs/src/languages/asciidoc.md
Normal file
11
docs/src/languages/asciidoc.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: AsciiDoc
|
||||
description: "Configure AsciiDoc language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
60
docs/src/languages/astro.md
Normal file
60
docs/src/languages/astro.md
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
title: Astro
|
||||
description: "Configure Astro language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Astro
|
||||
|
||||
Astro support is available through the [Astro extension](https://github.com/zed-extensions/astro).
|
||||
|
||||
- Tree-sitter: [virchau13/tree-sitter-astro](https://github.com/virchau13/tree-sitter-astro)
|
||||
- Language Server: [withastro/language-tools](https://github.com/withastro/astro/tree/main/packages/language-tools/language-server)
|
||||
|
||||
## Using the Tailwind CSS Language Server with Astro
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in Astro files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"includeLanguages": {
|
||||
"astro": "html"
|
||||
},
|
||||
"experimental": {
|
||||
"classRegex": [
|
||||
"class=\"([^\"]*)\"",
|
||||
"class='([^']*)'",
|
||||
"class:list=\"{([^}]*)}\"",
|
||||
"class:list='{([^}]*)}'"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With these settings, you will get completions for Tailwind CSS classes in Astro template files. Examples:
|
||||
|
||||
```astro
|
||||
---
|
||||
const active = true;
|
||||
---
|
||||
|
||||
<!-- Standard class attribute -->
|
||||
<div class="flex items-center <completion here>">
|
||||
<p class="text-lg font-bold <completion here>">Hello World</p>
|
||||
</div>
|
||||
|
||||
<!-- class:list directive -->
|
||||
<div class:list={["flex", "items-center", "<completion here>"]}>
|
||||
Content
|
||||
</div>
|
||||
|
||||
<!-- Conditional classes -->
|
||||
<div class:list={{ "flex <completion here>": active, "hidden <completion here>": !active }}>
|
||||
Content
|
||||
</div>
|
||||
```
|
||||
40
docs/src/languages/bash.md
Normal file
40
docs/src/languages/bash.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: Bash
|
||||
description: "Configure Bash language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Bash
|
||||
|
||||
Bash support is available natively in Zed.
|
||||
|
||||
- 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
|
||||
|
||||
It is highly recommended to install `shellcheck`, as `bash-language-server` depends on it to provide diagnostics.
|
||||
|
||||
### Install `shellcheck`:
|
||||
|
||||
```sh
|
||||
brew install shellcheck # macOS (HomeBrew)
|
||||
apt-get install shellcheck # Ubuntu/Debian
|
||||
pacman -S shellcheck # ArchLinux
|
||||
dnf install shellcheck # Fedora
|
||||
yum install shellcheck # CentOS/RHEL
|
||||
zypper install shellcheck # openSUSE
|
||||
choco install shellcheck # Windows (Chocolatey)
|
||||
```
|
||||
|
||||
And verify it is available from your path:
|
||||
|
||||
```sh
|
||||
which shellcheck
|
||||
shellcheck --version
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
### See also:
|
||||
|
||||
- [Zed Docs: Language Support: Shell Scripts](./sh.md)
|
||||
40
docs/src/languages/biome.md
Normal file
40
docs/src/languages/biome.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: Biome
|
||||
description: "Configure Biome language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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.
|
||||
98
docs/src/languages/c.md
Normal file
98
docs/src/languages/c.md
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
title: C
|
||||
description: "Configure C language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# C
|
||||
|
||||
C support is available natively in Zed.
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c)
|
||||
- Language Server: [clangd/clangd](https://github.com/clangd/clangd)
|
||||
- Debug Adapter: [CodeLLDB](https://github.com/vadimcn) (primary), [GDB](https://sourceware.org/gdb/) (secondary, not available on Apple silicon)
|
||||
|
||||
## Clangd: Force detect as C
|
||||
|
||||
Clangd out of the box assumes mixed C++/C projects. If you have a C-only project you may wish to instruct clangd to treat all files as C using the `-xc` flag. To do this, create a `.clangd` file in the root of your project with the following:
|
||||
|
||||
```yaml
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/clangd.json
|
||||
CompileFlags:
|
||||
Add: [-xc]
|
||||
```
|
||||
|
||||
By default clang and gcc will recognize `*.C` and `*.H` (uppercase extensions) as C++ and not C and so Zed too follows this convention. If you are working with a C-only project (perhaps one with legacy uppercase pathing like `FILENAME.C`) you can override this behavior by adding this to your settings:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"file_types": {
|
||||
"C": ["C", "H"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
By default Zed will use the `clangd` language server for formatting C code like the `clang-format` CLI tool. To configure this you can add a `.clang-format` file. For example:
|
||||
|
||||
```yaml
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/clang-format-21.x.json
|
||||
---
|
||||
BasedOnStyle: GNU
|
||||
IndentWidth: 2
|
||||
---
|
||||
```
|
||||
|
||||
See [Clang-Format Style Options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) for a complete list of options.
|
||||
|
||||
You can trigger formatting via {#kb editor::Format} or the {#action editor::Format} action from the command palette or by enabling format on save.
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > C, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"C": {
|
||||
"format_on_save": "on",
|
||||
"tab_size": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Compile Commands
|
||||
|
||||
For some projects Clangd requires a `compile_commands.json` file to properly analyze your project. This file contains the compilation database that tells clangd how your project should be built.
|
||||
|
||||
### CMake Compile Commands
|
||||
|
||||
With CMake, you can generate `compile_commands.json` automatically by adding the following line to your `CMakeLists.txt`:
|
||||
|
||||
```cmake
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
```
|
||||
|
||||
After building your project, CMake will generate the `compile_commands.json` file in the build directory and clangd will automatically pick it up.
|
||||
|
||||
## Debugging
|
||||
|
||||
You can use CodeLLDB or GDB to debug native binaries. (Make sure that your build process passes `-g` to the C compiler, so that debug information is included in the resulting binary.) See below for examples of debug configurations that you can add to `.zed/debug.json`.
|
||||
|
||||
- [CodeLLDB configuration documentation](https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#starting-a-new-debug-session)
|
||||
- [GDB configuration documentation](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Debugger-Adapter-Protocol.html)
|
||||
|
||||
### Build and Debug Binary
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Debug native binary",
|
||||
"build": {
|
||||
"command": "make",
|
||||
"args": ["-j8"],
|
||||
"cwd": "$ZED_WORKTREE_ROOT"
|
||||
},
|
||||
"program": "$ZED_WORKTREE_ROOT/build/prog",
|
||||
"request": "launch",
|
||||
"adapter": "CodeLLDB"
|
||||
}
|
||||
]
|
||||
```
|
||||
15
docs/src/languages/clojure.md
Normal file
15
docs/src/languages/clojure.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Clojure
|
||||
description: "Configure Clojure language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Clojure
|
||||
|
||||
Clojure support is available through the [Clojure extension](https://github.com/zed-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)
|
||||
|
||||
<!--
|
||||
TBD: Add some Clojure Docs
|
||||
-->
|
||||
190
docs/src/languages/cpp.md
Normal file
190
docs/src/languages/cpp.md
Normal file
@@ -0,0 +1,190 @@
|
||||
---
|
||||
title: C++
|
||||
description: "Configure C++ language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# C++
|
||||
|
||||
C++ support is available natively in Zed.
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-cpp](https://github.com/tree-sitter/tree-sitter-cpp)
|
||||
- Language Server: [clangd/clangd](https://github.com/clangd/clangd)
|
||||
|
||||
## Binary
|
||||
|
||||
You can configure which `clangd` binary Zed should use.
|
||||
|
||||
By default, Zed will try to find a `clangd` in your `$PATH` and try to use that. If that binary successfully executes, it's used. Otherwise, Zed will fall back to installing its own `clangd` version and use that.
|
||||
|
||||
If you want to install a pre-release `clangd` version instead you can instruct Zed to do so by setting `pre_release` to `true` in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"clangd": {
|
||||
"fetch": {
|
||||
"pre_release": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you want to disable Zed looking for a `clangd` binary, you can set `ignore_system_version` to `true` in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"clangd": {
|
||||
"binary": {
|
||||
"ignore_system_version": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you want to use a binary in a custom location, you can specify a `path` and optional `arguments`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"clangd": {
|
||||
"binary": {
|
||||
"path": "/path/to/clangd",
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This `"path"` has to be an absolute path.
|
||||
|
||||
## Arguments
|
||||
|
||||
You can pass any number of arguments to clangd. To see a full set of available options, run `clangd --help` from the command line. For example with `--function-arg-placeholders=0` completions contain only parentheses for function calls, while the default (`--function-arg-placeholders=1`) completions also contain placeholders for method parameters.
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"clangd": {
|
||||
"binary": {
|
||||
"path": "/path/to/clangd",
|
||||
"arguments": ["--function-arg-placeholders=0"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
By default Zed will use the `clangd` language server for formatting C++ code. The Clangd is the same as the `clang-format` CLI tool. To configure this you can add a `.clang-format` file. For example:
|
||||
|
||||
```yaml
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/clang-format-21.x.json
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
# Force pointers to the type for C++.
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Left
|
||||
---
|
||||
```
|
||||
|
||||
See [Clang-Format Style Options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) for a complete list of options.
|
||||
|
||||
You can trigger formatting via {#kb editor::Format} or the {#action editor::Format} action from the command palette or by enabling format on save.
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > C++, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"C++": {
|
||||
"format_on_save": "on",
|
||||
"tab_size": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## More server configuration
|
||||
|
||||
In the root of your project, it is generally common to create a `.clangd` file to set extra configuration.
|
||||
|
||||
```yaml
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/clangd.json
|
||||
CompileFlags:
|
||||
Add:
|
||||
- "--include-directory=/path/to/include"
|
||||
Diagnostics:
|
||||
MissingIncludes: Strict
|
||||
UnusedIncludes: Strict
|
||||
```
|
||||
|
||||
For more advanced usage of clangd configuration file, take a look into their [official page](https://clangd.llvm.org/config.html).
|
||||
|
||||
## Compile Commands
|
||||
|
||||
For some projects Clangd requires a `compile_commands.json` file to properly analyze your project. This file contains the compilation database that tells clangd how your project should be built.
|
||||
|
||||
### CMake Compile Commands
|
||||
|
||||
With CMake, you can generate `compile_commands.json` automatically by adding the following line to your `CMakeLists.txt`:
|
||||
|
||||
```cmake
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
```
|
||||
|
||||
After building your project, CMake will generate the `compile_commands.json` file in the build directory and clangd will automatically pick it up.
|
||||
|
||||
## Debugging
|
||||
|
||||
You can use CodeLLDB or GDB to debug native binaries. (Make sure that your build process passes `-g` to the C++ compiler, so that debug information is included in the resulting binary.) See below for examples of debug configurations that you can add to `.zed/debug.json`.
|
||||
|
||||
- [CodeLLDB configuration documentation](https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#starting-a-new-debug-session)
|
||||
- [GDB configuration documentation](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Debugger-Adapter-Protocol.html)
|
||||
- GDB needs to be at least v14.1
|
||||
|
||||
### Build and Debug Binary
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Debug native binary",
|
||||
"build": {
|
||||
"command": "make",
|
||||
"args": ["-j8"],
|
||||
"cwd": "$ZED_WORKTREE_ROOT"
|
||||
},
|
||||
"program": "$ZED_WORKTREE_ROOT/build/prog",
|
||||
"request": "launch",
|
||||
"adapter": "CodeLLDB"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Protocol Extensions
|
||||
|
||||
Zed currently implements the following `clangd` [extensions](https://clangd.llvm.org/extensions):
|
||||
|
||||
### Inactive Regions
|
||||
|
||||
Automatically dims inactive sections of code due to preprocessor directives, such as `#if`, `#ifdef`, or `#ifndef` blocks that evaluate to false.
|
||||
|
||||
### Switch Between Source and Header Files
|
||||
|
||||
Allows switching between corresponding C++ source files (e.g., `.cpp`) and header files (e.g., `.h`).
|
||||
by running the command {#action editor::SwitchSourceHeader} from the command palette or by setting
|
||||
a keybinding for the `editor::SwitchSourceHeader` action.
|
||||
|
||||
```json [keymap]
|
||||
{
|
||||
"context": "Editor",
|
||||
"bindings": {
|
||||
"alt-enter": "editor::SwitchSourceHeader"
|
||||
}
|
||||
}
|
||||
```
|
||||
130
docs/src/languages/csharp.md
Normal file
130
docs/src/languages/csharp.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
title: C#
|
||||
description: "Configure C# language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# C#
|
||||
|
||||
C# support is available through the [C# extension](https://github.com/zed-extensions/csharp).
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-c-sharp](https://github.com/tree-sitter/tree-sitter-c-sharp)
|
||||
- Language Servers:
|
||||
- [roslyn-language-server](https://www.nuget.org/packages/roslyn-language-server#readme)
|
||||
- [OmniSharp/omnisharp-roslyn](https://github.com/OmniSharp/omnisharp-roslyn)
|
||||
|
||||
Roslyn is enabled by default. To switch back to OmniSharp, add the following to your Zed settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"CSharp": {
|
||||
"language_servers": ["omnisharp", "!roslyn", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note: the language name used in settings is "CSharp", not "C#".
|
||||
|
||||
## Configuration
|
||||
|
||||
Roslyn can be configured with the following language server settings:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"roslyn": {
|
||||
"settings": {
|
||||
// Default values are shown below, along with alternative options where applicable.
|
||||
"csharp|symbol_search": {
|
||||
"dotnet_search_reference_assemblies": true
|
||||
},
|
||||
"csharp|type_members": {
|
||||
"dotnet_member_insertion_location": "atTheEnd", // or "withOtherMembersOfTheSameKind"
|
||||
"dotnet_property_generation_behavior": "preferThrowingProperties" // or "preferAutoProperties"
|
||||
},
|
||||
"csharp|completion": {
|
||||
"dotnet_show_name_completion_suggestions": true,
|
||||
"dotnet_provide_regex_completions": true,
|
||||
"dotnet_show_completion_items_from_unimported_namespaces": true,
|
||||
"dotnet_trigger_completion_in_argument_lists": true
|
||||
},
|
||||
"csharp|quick_info": {
|
||||
"dotnet_show_remarks_in_quick_info": true
|
||||
},
|
||||
"csharp|navigation": {
|
||||
"dotnet_navigate_to_decompiled_sources": true,
|
||||
"dotnet_navigate_to_source_link_and_embedded_sources": true
|
||||
},
|
||||
"csharp|highlighting": {
|
||||
"dotnet_highlight_related_json_components": true,
|
||||
"dotnet_highlight_related_regex_components": true
|
||||
},
|
||||
"csharp|inlay_hints": {
|
||||
"dotnet_enable_inlay_hints_for_parameters": true,
|
||||
"dotnet_enable_inlay_hints_for_literal_parameters": true,
|
||||
"dotnet_enable_inlay_hints_for_indexer_parameters": true,
|
||||
"dotnet_enable_inlay_hints_for_object_creation_parameters": true,
|
||||
"dotnet_enable_inlay_hints_for_other_parameters": true,
|
||||
"dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix": true,
|
||||
"dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent": true,
|
||||
"dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name": true,
|
||||
"csharp_enable_inlay_hints_for_types": true,
|
||||
"csharp_enable_inlay_hints_for_implicit_variable_types": true,
|
||||
"csharp_enable_inlay_hints_for_lambda_parameter_types": true,
|
||||
"csharp_enable_inlay_hints_for_implicit_object_creation": true,
|
||||
"csharp_enable_inlay_hints_for_collection_expressions": true
|
||||
},
|
||||
"csharp|code_style.formatting.indentation_and_spacing": {
|
||||
"tab_width": 4,
|
||||
"indent_size": 4,
|
||||
"indent_style": "space" // or "tab"
|
||||
},
|
||||
"csharp|code_style.formatting.new_line": {
|
||||
"end_of_line": "...", // platform-specific default
|
||||
"insert_final_newline": false
|
||||
},
|
||||
"csharp|background_analysis": {
|
||||
"dotnet_analyzer_diagnostics_scope": "default", // or "none" "openFiles" "fullSolution"
|
||||
"dotnet_compiler_diagnostics_scope": "openFiles" // or "fullSolution"
|
||||
},
|
||||
"csharp|code_lens": {
|
||||
"dotnet_enable_references_code_lens": false,
|
||||
"dotnet_enable_tests_code_lens": false
|
||||
},
|
||||
"csharp|auto_insert": {
|
||||
"dotnet_enable_auto_insert": true
|
||||
},
|
||||
"csharp|projects": {
|
||||
"dotnet_binary_log_path": null,
|
||||
"dotnet_enable_automatic_restore": true,
|
||||
"dotnet_enable_file_based_programs": true,
|
||||
"dotnet_enable_file_based_programs_when_ambiguous": true
|
||||
},
|
||||
"csharp|formatting": {
|
||||
"dotnet_organize_imports_on_format": false
|
||||
}
|
||||
},
|
||||
"binary": {
|
||||
"path": "/path/to/roslyn-language-server",
|
||||
"arguments": ["--stdio", "--autoLoadProjects" /* add extra arguments */]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
OmniSharp can be configured in a Zed settings file with:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"omnisharp": {
|
||||
"binary": {
|
||||
"path": "/path/to/OmniSharp",
|
||||
"arguments": ["-lsp" /* add extra arguments */]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
25
docs/src/languages/css.md
Normal file
25
docs/src/languages/css.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: CSS
|
||||
description: "Configure CSS language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# CSS
|
||||
|
||||
Zed has built-in support for CSS.
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-css](https://github.com/tree-sitter/tree-sitter-css)
|
||||
- Language Servers:
|
||||
- [microsoft/vscode-css-languageservice](https://github.com/microsoft/vscode-css-languageservice)
|
||||
- [tailwindcss-language-server](https://github.com/tailwindlabs/tailwindcss-intellisense)
|
||||
|
||||
## Tailwind CSS
|
||||
|
||||
Zed also supports [Tailwind CSS](./tailwindcss.md) out-of-the-box for languages and frameworks like JavaScript, Astro, Svelte, and more.
|
||||
|
||||
<!-- TBD: Document CS -->
|
||||
|
||||
## Recommended Reading
|
||||
|
||||
- [HTML](./html.md)
|
||||
- [TypeScript](./typescript.md)
|
||||
- [JavaScript](./javascript.md)
|
||||
59
docs/src/languages/dart.md
Normal file
59
docs/src/languages/dart.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
title: Dart
|
||||
description: "Configure Dart language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Dart
|
||||
|
||||
Dart support is available through the [Dart extension](https://github.com/zed-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)
|
||||
|
||||
## Pre-requisites
|
||||
|
||||
You will need to install the Dart SDK.
|
||||
|
||||
You can install dart from [dart.dev/get-dart](https://dart.dev/get-dart) or via the [Flutter Version Management CLI (fvm)](https://fvm.app/documentation/getting-started/installation)
|
||||
|
||||
## Configuration
|
||||
|
||||
The dart extension requires no configuration if you have `dart` in your path:
|
||||
|
||||
```sh
|
||||
which dart
|
||||
dart --version
|
||||
```
|
||||
|
||||
If you would like to use a specific dart binary or use dart via FVM you can specify the `dart` binary in your Zed settings.jsons file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"dart": {
|
||||
"binary": {
|
||||
"path": "/opt/homebrew/bin/fvm",
|
||||
"arguments": ["dart", "language-server", "--protocol=lsp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Formatting
|
||||
|
||||
Dart by-default uses a very conservative maximum line length (80). If you would like the dart LSP to permit a longer line length when auto-formatting, add the following to your Zed settings.json:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"dart": {
|
||||
"settings": {
|
||||
"lineLength": 140
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Please see the Dart documentation for more information on [dart language-server capabilities](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/tool/lsp_spec/README.md).
|
||||
134
docs/src/languages/deno.md
Normal file
134
docs/src/languages/deno.md
Normal file
@@ -0,0 +1,134 @@
|
||||
---
|
||||
title: Deno
|
||||
description: "Configure Deno language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Deno
|
||||
|
||||
Deno support is available through the [Deno extension](https://github.com/zed-extensions/deno).
|
||||
|
||||
- Language server: [Deno Language Server](https://docs.deno.com/runtime/manual/advanced/language_server/overview/)
|
||||
|
||||
## Deno Configuration
|
||||
|
||||
To use the Deno Language Server with TypeScript and TSX files, you will likely wish to disable the default language servers and enable Deno.
|
||||
|
||||
Configure language servers and formatters in Settings ({#kb zed::OpenSettings}) under Languages > JavaScript/TypeScript/TSX, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"deno": {
|
||||
"settings": {
|
||||
"deno": {
|
||||
"enable": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"language_servers": [
|
||||
"deno",
|
||||
"!typescript-language-server",
|
||||
"!vtsls",
|
||||
"!eslint"
|
||||
],
|
||||
"formatter": "language_server"
|
||||
},
|
||||
"TypeScript": {
|
||||
"language_servers": [
|
||||
"deno",
|
||||
"!typescript-language-server",
|
||||
"!vtsls",
|
||||
"!eslint"
|
||||
],
|
||||
"formatter": "language_server"
|
||||
},
|
||||
"TSX": {
|
||||
"language_servers": [
|
||||
"deno",
|
||||
"!typescript-language-server",
|
||||
"!vtsls",
|
||||
"!eslint"
|
||||
],
|
||||
"formatter": "language_server"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See [Configuring supported languages](../configuring-languages.md) in the Zed documentation for more information.
|
||||
|
||||
<!--
|
||||
TBD: Deno TypeScript REPL instructions [docs/repl#typescript-deno](../repl.md#typescript-deno)
|
||||
-->
|
||||
|
||||
## Configuration completion
|
||||
|
||||
To get completions for `deno.json` or `package.json`, add the following to your settings file ([how to edit](../configuring-zed.md#settings-files)). For more details, see [JSON](./json.md).
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"json-language-server": {
|
||||
"settings": {
|
||||
"json": {
|
||||
"schemas": [
|
||||
{
|
||||
"fileMatch": [
|
||||
"deno.json",
|
||||
"deno.jsonc"
|
||||
],
|
||||
"url": "https://raw.githubusercontent.com/denoland/deno/refs/heads/main/cli/schemas/config-file.v1.json"
|
||||
},
|
||||
{
|
||||
"fileMatch": [
|
||||
"package.json"
|
||||
],
|
||||
"url": "https://www.schemastore.org/package"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## DAP support
|
||||
|
||||
To debug deno programs, add this to `.zed/debug.json`
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"adapter": "JavaScript",
|
||||
"label": "Deno",
|
||||
"request": "launch",
|
||||
"type": "pwa-node",
|
||||
"cwd": "$ZED_WORKTREE_ROOT",
|
||||
"program": "$ZED_FILE",
|
||||
"runtimeExecutable": "deno",
|
||||
"runtimeArgs": ["run", "--allow-all", "--inspect-wait"],
|
||||
"attachSimplePort": 9229
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Runnable support
|
||||
|
||||
To run deno tasks like tests from the ui, add this to `.zed/tasks.json`
|
||||
|
||||
```json [tasks]
|
||||
[
|
||||
{
|
||||
"label": "deno test",
|
||||
"command": "deno test -A '$ZED_FILE'",
|
||||
"tags": ["js-test"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## See also:
|
||||
|
||||
- [TypeScript](./typescript.md)
|
||||
- [JavaScript](./javascript.md)
|
||||
22
docs/src/languages/diff.md
Normal file
22
docs/src/languages/diff.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: Diff
|
||||
description: "Configure Diff language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Diff
|
||||
|
||||
Diff support is available natively in Zed.
|
||||
|
||||
- Tree-sitter: [zed-industries/the-mikedavis/tree-sitter-diff](https://github.com/the-mikedavis/tree-sitter-diff)
|
||||
|
||||
## Configuration
|
||||
|
||||
Zed will not attempt to format diff files and has [`remove_trailing_whitespace_on_save`](https://zed.dev/docs/reference/all-settings#remove-trailing-whitespace-on-save) and [`ensure-final-newline-on-save`](https://zed.dev/docs/reference/all-settings#ensure-final-newline-on-save) set to false.
|
||||
|
||||
Zed will automatically recognize files with `patch` and `diff` extensions as Diff files. To recognize other extensions, add them to `file_types` in your Zed settings.json:
|
||||
|
||||
```json [settings]
|
||||
"file_types": {
|
||||
"Diff": ["dif"]
|
||||
},
|
||||
```
|
||||
21
docs/src/languages/docker.md
Normal file
21
docs/src/languages/docker.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Docker
|
||||
description: "Configure Docker language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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 report 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)
|
||||
315
docs/src/languages/elixir.md
Normal file
315
docs/src/languages/elixir.md
Normal file
@@ -0,0 +1,315 @@
|
||||
---
|
||||
title: Elixir
|
||||
description: "Configure Elixir language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Elixir
|
||||
|
||||
Elixir support is available through the [Elixir extension](https://github.com/zed-extensions/elixir).
|
||||
|
||||
- Tree-sitter Grammars:
|
||||
- [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-lang/expert](https://github.com/elixir-lang/expert)
|
||||
- [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)
|
||||
- [remoteoss/dexter](https://github.com/remoteoss/dexter)
|
||||
|
||||
Furthermore, the extension provides support for [EEx](https://hexdocs.pm/eex/EEx.html) (Embedded Elixir) templates and [HEEx](https://hexdocs.pm/phoenix/components.html#heex) templates, a mix of HTML and EEx used by Phoenix LiveView applications.
|
||||
|
||||
## Language Servers
|
||||
|
||||
The Elixir extension offers language server support for ElixirLS, Expert, Dexter, Next LS, and Lexical. By default, only ElixirLS is enabled. You can change or disable the enabled language servers in your settings ({#kb zed::OpenSettings}) under Languages > Elixir/EEx/HEEx or directly within your settings file.
|
||||
|
||||
Some of the language servers can also accept initialization or workspace configuration options. See the sections below for an outline of what each server supports. The configuration can be passed in your settings file via `lsp.{language-server-id}.initialization_options` and `lsp.{language-server-id}.settings` respectively.
|
||||
|
||||
Visit the [Configuring Zed](../configuring-zed.md#settings-files) guide for more information on how to edit your settings file.
|
||||
|
||||
### Using ElixirLS
|
||||
|
||||
ElixirLS can accept workspace configuration options.
|
||||
|
||||
The following example disables [Dialyzer](https://github.com/elixir-lsp/elixir-ls#dialyzer-integration):
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"elixir-ls": {
|
||||
"settings": {
|
||||
"dialyzerEnabled": false
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See the official list of [ElixirLS configuration settings](https://github.com/elixir-lsp/elixir-ls#elixirls-configuration-settings) for all available options.
|
||||
|
||||
### Using Expert
|
||||
|
||||
Enable Expert by adding the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Elixir": {
|
||||
"language_servers": ["expert", "!elixir-ls", "!dexter", "!next-ls", "!lexical", "..."]
|
||||
},
|
||||
"EEx": {
|
||||
"language_servers": ["expert", "!elixir-ls", "!dexter", "!next-ls", "!lexical", "..."]
|
||||
},
|
||||
"HEEx": {
|
||||
"language_servers": ["expert", "!elixir-ls", "!dexter", "!next-ls", "!lexical", "..."]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Expert can accept workspace configuration options.
|
||||
|
||||
The following example sets the minimum number of characters required for a project symbol search to return results:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"expert": {
|
||||
"settings": {
|
||||
"workspaceSymbols": {
|
||||
"minQueryLength": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See the [Expert configuration](https://expert-lsp.org/docs/configuration/) page for all available options.
|
||||
|
||||
To use a custom Expert build, add the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"expert": {
|
||||
"binary": {
|
||||
"path": "/path/to/expert",
|
||||
"arguments": ["--stdio"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Using Dexter
|
||||
|
||||
[Dexter](https://github.com/remoteoss/dexter) is a fast, full-featured Elixir language server optimized for large codebases. It works by parsing source files directly, no compilation required. Supports go-to-definition, references, hover docs, autocompletion, rename, and format on save.
|
||||
|
||||
Enable Dexter by adding the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Elixir": {
|
||||
"language_servers": ["dexter", "!expert", "!elixir-ls", "!next-ls", "!lexical", "..."]
|
||||
},
|
||||
"EEx": {
|
||||
"language_servers": ["dexter", "!expert", "!elixir-ls", "!next-ls", "!lexical", "..."]
|
||||
},
|
||||
"HEEx": {
|
||||
"language_servers": ["dexter", "!expert", "!elixir-ls", "!next-ls", "!lexical", "..."]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Dexter can accept initialization options.
|
||||
|
||||
The following example disables following `defdelegate` to the target function:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"dexter": {
|
||||
"initialization_options": {
|
||||
"followDelegates": false
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To use a custom Dexter binary, add the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"dexter": {
|
||||
"binary": {
|
||||
"path": "/path/to/dexter",
|
||||
"arguments": ["lsp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See the [Dexter documentation](https://github.com/remoteoss/dexter) for more details.
|
||||
|
||||
### Using Next LS
|
||||
|
||||
Enable Next LS by adding the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Elixir": {
|
||||
"language_servers": ["next-ls", "!expert", "!elixir-ls", "!dexter", "!lexical", "..."]
|
||||
},
|
||||
"EEx": {
|
||||
"language_servers": ["next-ls", "!expert", "!elixir-ls", "!dexter", "!lexical", "..."]
|
||||
},
|
||||
"HEEx": {
|
||||
"language_servers": ["next-ls", "!expert", "!elixir-ls", "!dexter", "!lexical", "..."]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Next LS can accept initialization options.
|
||||
|
||||
Completions are an experimental feature within Next LS, they are enabled by default in Zed. Disable them by adding the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"next-ls": {
|
||||
"initialization_options": {
|
||||
"experimental": {
|
||||
"completions": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Next LS also has an extension for [Credo](https://hexdocs.pm/credo/overview.html) integration which is enabled by default. You can disable this by adding the following section to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"next-ls": {
|
||||
"initialization_options": {
|
||||
"extensions": {
|
||||
"credo": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Next LS can also pass CLI options directly to Credo. The following example passes `--min-priority high` to it:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"next-ls": {
|
||||
"initialization_options": {
|
||||
"extensions": {
|
||||
"credo": {
|
||||
"cli_options": ["--min-priority high"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See the [Credo Command Line Switches](https://hexdocs.pm/credo/suggest_command.html#command-line-switches) page for more CLI options.
|
||||
|
||||
### Using Lexical
|
||||
|
||||
Enable Lexical by adding the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Elixir": {
|
||||
"language_servers": ["lexical", "!expert", "!elixir-ls", "!dexter", "!next-ls", "..."]
|
||||
},
|
||||
"EEx": {
|
||||
"language_servers": ["lexical", "!expert", "!elixir-ls", "!dexter", "!next-ls", "..."]
|
||||
},
|
||||
"HEEx": {
|
||||
"language_servers": ["lexical", "!expert", "!elixir-ls", "!dexter", "!next-ls", "..."]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Formatting without a language server
|
||||
|
||||
If you prefer to work without a language server but would still like code formatting from [Mix](https://hexdocs.pm/mix/Mix.html), you can configure it as an external formatter by adding the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Elixir": {
|
||||
"enable_language_server": false,
|
||||
"format_on_save": "on",
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "mix",
|
||||
"arguments": ["format", "--stdin-filename", "{buffer_path}", "-"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"EEx": {
|
||||
"enable_language_server": false,
|
||||
"format_on_save": "on",
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "mix",
|
||||
"arguments": ["format", "--stdin-filename", "{buffer_path}", "-"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"HEEx": {
|
||||
"enable_language_server": false,
|
||||
"format_on_save": "on",
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "mix",
|
||||
"arguments": ["format", "--stdin-filename", "{buffer_path}", "-"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Using the Tailwind CSS Language Server with HEEx templates
|
||||
|
||||
To get all features (autocomplete, linting, and hover docs) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in HEEx templates, add the following to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"includeLanguages": {
|
||||
"elixir": "html",
|
||||
"heex": "html"
|
||||
},
|
||||
"experimental": {
|
||||
"classRegex": ["class=\"([^\"]*)\"", "class='([^']*)'"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With these settings, you will get completions for Tailwind CSS classes in HEEx templates. Examples:
|
||||
|
||||
```heex
|
||||
<%!-- Standard class attribute --%>
|
||||
<div class="flex items-center <completion here>">
|
||||
<p class="text-lg font-bold <completion here>">Hello World</p>
|
||||
</div>
|
||||
|
||||
<%!-- With Elixir expression --%>
|
||||
<div class={"flex #{@custom_class} <completion here>"}>
|
||||
Content
|
||||
</div>
|
||||
|
||||
<%!-- With Phoenix function --%>
|
||||
<div class={class_list(["flex", "items-center", "<completion here>"])}>
|
||||
Content
|
||||
</div>
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Erlang](./erlang.md)
|
||||
- [Gleam](./gleam.md)
|
||||
45
docs/src/languages/elm.md
Normal file
45
docs/src/languages/elm.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Elm
|
||||
description: "Configure Elm language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Elm
|
||||
|
||||
Elm support is available through the [Elm extension](https://github.com/zed-extensions/elm).
|
||||
|
||||
- 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)
|
||||
|
||||
## Setup
|
||||
|
||||
Zed support for Elm requires installation of `elm`, `elm-format`, and `elm-review`.
|
||||
|
||||
1. [Install Elm](https://guide.elm-lang.org/install/elm.html) (or run `brew install elm` on macOS).
|
||||
2. Install `elm-review` to support code linting:
|
||||
```sh
|
||||
npm install elm-review --save-dev
|
||||
```
|
||||
3. Install `elm-format` to support automatic formatting
|
||||
```sh
|
||||
npm install -g elm-format
|
||||
```
|
||||
|
||||
## Configuring `elm-language-server`
|
||||
|
||||
Elm language server can be configured in your `settings.json`, e.g.:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"elm-language-server": {
|
||||
"initialization_options": {
|
||||
"disableElmLSDiagnostics": true,
|
||||
"onlyUpdateDiagnosticsOnSave": false,
|
||||
"elmReviewDiagnostics": "warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`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).
|
||||
16
docs/src/languages/emmet.md
Normal file
16
docs/src/languages/emmet.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: Emmet
|
||||
description: "Configure Emmet language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Emmet
|
||||
|
||||
Emmet support is available through the [Emmet extension](https://github.com/zed-extensions/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)
|
||||
|
||||
<!--
|
||||
TBD: Document Emmet usage in zed with: HTML, PHP, ERB, Javascript, TSX, CSS
|
||||
-->
|
||||
36
docs/src/languages/erlang.md
Normal file
36
docs/src/languages/erlang.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: Erlang
|
||||
description: "Configure Erlang language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Erlang
|
||||
|
||||
Erlang support is available through the [Erlang extension](https://github.com/zed-extensions/erlang).
|
||||
|
||||
- Tree-sitter: [WhatsApp/tree-sitter-erlang](https://github.com/WhatsApp/tree-sitter-erlang)
|
||||
- Language Servers:
|
||||
- [erlang-ls/erlang_ls](https://github.com/erlang-ls/erlang_ls)
|
||||
- [WhatsApp/erlang-language-platform](https://github.com/WhatsApp/erlang-language-platform)
|
||||
|
||||
## Choosing a language server
|
||||
|
||||
The Erlang extension offers language server support for `erlang_ls` and `erlang-language-platform`.
|
||||
|
||||
`erlang_ls` is enabled by default.
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > Erlang, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Erlang": {
|
||||
"language_servers": ["elp", "!erlang-ls", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## See also:
|
||||
|
||||
- [Elixir](./elixir.md)
|
||||
- [Gleam](./gleam.md)
|
||||
36
docs/src/languages/fish.md
Normal file
36
docs/src/languages/fish.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: Fish
|
||||
description: "Configure Fish language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
|
||||
### Formatting
|
||||
|
||||
Zed supports auto-formatting fish code using external tools like [`fish_indent`](https://fishshell.com/docs/current/cmds/fish_indent.html), which is included with fish.
|
||||
|
||||
1. Ensure `fish_indent` is available in your path and check the version:
|
||||
|
||||
```sh
|
||||
which fish_indent
|
||||
fish_indent --version
|
||||
```
|
||||
|
||||
2. Configure Zed to automatically format fish code with `fish_indent`:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Fish": {
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "fish_indent"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
```
|
||||
31
docs/src/languages/gdscript.md
Normal file
31
docs/src/languages/gdscript.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: GDScript
|
||||
description: "Configure GDScript language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# GDScript
|
||||
|
||||
Godot [GDScript](https://gdscript.com/) language support in Zed is provided by the community-maintained [GDScript extension](https://github.com/GDQuest/zed-gdscript).
|
||||
Report issues to: [https://github.com/GDQuest/zed-gdscript/issues](https://github.com/GDQuest/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)
|
||||
|
||||
## Pre-requisites
|
||||
|
||||
You will need:
|
||||
|
||||
- [Godot](https://godotengine.org/download/).
|
||||
- netcat (`nc` or `ncat`) on your system PATH.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Inside your Godot editor, open Editor Settings, look for `Text Editor -> External` and set the following options:
|
||||
- Exec Path: `/path/to/zed`
|
||||
- Exec Flags: `{project} {file}:{line}:{col}`
|
||||
- Use External Editor: "✅ On"
|
||||
2. Open any \*.gd file through Godot 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 Ctrl/cmd and other language server features.
|
||||
16
docs/src/languages/gleam.md
Normal file
16
docs/src/languages/gleam.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: Gleam
|
||||
description: "Configure Gleam language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Gleam
|
||||
|
||||
Gleam support is available through the [Gleam extension](https://github.com/gleam-lang/zed-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)
|
||||
11
docs/src/languages/glsl.md
Normal file
11
docs/src/languages/glsl.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: GLSL
|
||||
description: "Configure GLSL language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
236
docs/src/languages/go.md
Normal file
236
docs/src/languages/go.md
Normal file
@@ -0,0 +1,236 @@
|
||||
---
|
||||
title: Go
|
||||
description: "Configure Go language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Go
|
||||
|
||||
Go support is available natively in Zed.
|
||||
|
||||
- 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)
|
||||
- Debug Adapter: [delve](https://github.com/go-delve/delve)
|
||||
|
||||
## Setup
|
||||
|
||||
We recommend installing gopls via go's package manager and not via Homebrew or your Linux distribution's package manager.
|
||||
|
||||
1. Make sure you have uninstalled any version of gopls you have installed via your package manager:
|
||||
|
||||
```sh
|
||||
# MacOS homebrew
|
||||
brew remove gopls
|
||||
# Ubuntu
|
||||
sudo apt-get remove gopls
|
||||
sudo snap remove gopls
|
||||
# Arch
|
||||
sudo pacman -R gopls
|
||||
```
|
||||
|
||||
2. Install/Update `gopls` to the latest version using the go module tool:
|
||||
|
||||
```sh
|
||||
go install golang.org/x/tools/gopls@latest
|
||||
```
|
||||
|
||||
3. Ensure that `gopls` is in your path:
|
||||
|
||||
```sh
|
||||
which gopls
|
||||
gopls version
|
||||
```
|
||||
|
||||
If `gopls` is not found you will likely need to add `export PATH="$PATH:$HOME/go/bin"` to your `.zshrc` / `.bash_profile`
|
||||
|
||||
## Inlay Hints
|
||||
|
||||
Zed sets the following initialization options for inlay hints:
|
||||
|
||||
```json
|
||||
"hints": {
|
||||
"assignVariableTypes": true,
|
||||
"compositeLiteralFields": true,
|
||||
"compositeLiteralTypes": true,
|
||||
"constantValues": true,
|
||||
"functionTypeParameters": true,
|
||||
"parameterNames": true,
|
||||
"rangeVariableTypes": true
|
||||
}
|
||||
```
|
||||
|
||||
to make the language server send back inlay hints when Zed has them enabled in the settings.
|
||||
|
||||
Use
|
||||
|
||||
```json
|
||||
"lsp": {
|
||||
"gopls": {
|
||||
"initialization_options": {
|
||||
"hints": {
|
||||
// ....
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
to override these settings.
|
||||
|
||||
See [gopls inlayHints documentation](https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md) for more information.
|
||||
|
||||
## Code Lens
|
||||
|
||||
Zed enables the `test` code lens for `gopls` by default. This shows "run test" and "run benchmark" links above `Test` and `Benchmark` functions in `*_test.go` files. To use them, enable the `code_lens` setting:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"code_lens": "on"
|
||||
}
|
||||
```
|
||||
|
||||
You can override the default code lens settings in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"gopls": {
|
||||
"initialization_options": {
|
||||
"codelenses": {
|
||||
"test": true,
|
||||
"generate": true,
|
||||
"regenerate_cgo": true,
|
||||
"tidy": true,
|
||||
"upgrade_dependency": true,
|
||||
"vendor": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See [gopls code lenses documentation](https://go.dev/gopls/codelenses) for more information.
|
||||
|
||||
## Debugging
|
||||
|
||||
Zed supports zero-configuration debugging of Go tests and entry points (`func main`) using Delve. Run {#action debugger::Start} ({#kb debugger::Start}) to see a contextual list of these preconfigured debug tasks.
|
||||
|
||||
For more control, you can add debug configurations to `.zed/debug.json`. See below for examples.
|
||||
|
||||
- [Delve configuration documentation](https://github.com/go-delve/delve/blob/master/Documentation/api/dap/README.md#launch-and-attach-configurations)
|
||||
|
||||
### Debug Go Packages
|
||||
|
||||
To debug a specific package, you can do so by setting the Delve mode to "debug". In this case "program" should be set to the package name.
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Go (Delve)",
|
||||
"adapter": "Delve",
|
||||
"program": "$ZED_FILE",
|
||||
"request": "launch",
|
||||
"mode": "debug"
|
||||
},
|
||||
{
|
||||
"label": "Run server",
|
||||
"adapter": "Delve",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
// For Delve, the program can be a package name
|
||||
"program": "./cmd/server"
|
||||
// "args": [],
|
||||
// "buildFlags": [],
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Debug Go Tests
|
||||
|
||||
To debug the tests for a package, set the Delve mode to "test".
|
||||
The "program" is still the package name, and you can use the "buildFlags" to do things like set tags, and the "args" to set args on the test binary. (See `go help testflags` for more information on doing that).
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Run integration tests",
|
||||
"adapter": "Delve",
|
||||
"request": "launch",
|
||||
"mode": "test",
|
||||
"program": ".",
|
||||
"buildFlags": ["-tags", "integration"]
|
||||
// To filter down to just the test your cursor is in:
|
||||
// "args": ["-test.run", "$ZED_SYMBOL"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Build and debug separately
|
||||
|
||||
If you need to build your application with a specific command, you can use the "exec" mode of Delve. In this case "program" should point to an executable,
|
||||
and the "build" command should build that.
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Debug Prebuilt Unit Tests",
|
||||
"adapter": "Delve",
|
||||
"request": "launch",
|
||||
"mode": "exec",
|
||||
"program": "${ZED_WORKTREE_ROOT}/__debug_unit",
|
||||
"args": ["-test.v", "-test.run=${ZED_SYMBOL}"],
|
||||
"build": {
|
||||
"command": "go",
|
||||
"args": [
|
||||
"test",
|
||||
"-c",
|
||||
"-tags",
|
||||
"unit",
|
||||
"-gcflags\"all=-N -l\"",
|
||||
"-o",
|
||||
"__debug_unit",
|
||||
"./pkg/..."
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Attaching to an existing instance of Delve
|
||||
|
||||
You might find yourself needing to connect to an existing instance of Delve that's not necessarily running on your machine; in such case, you can use `tcp_arguments` to instrument Zed's connection to Delve.
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"adapter": "Delve",
|
||||
"label": "Connect to a running Delve instance",
|
||||
"program": "/Users/zed/Projects/language_repositories/golang/hello/hello",
|
||||
"cwd": "/Users/zed/Projects/language_repositories/golang/hello",
|
||||
"args": [],
|
||||
"env": {},
|
||||
"request": "launch",
|
||||
"mode": "exec",
|
||||
"stopOnEntry": false,
|
||||
"tcp_connection": { "host": "127.0.0.1", "port": 53412 }
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
In such case Zed won't spawn a new instance of Delve, as it opts to use an existing one. The consequence of this is that _there will be no terminal_ in Zed; you have to interact with the Delve instance directly, as it handles stdin/stdout of the debuggee.
|
||||
|
||||
## Go Mod
|
||||
|
||||
- Tree-sitter: [camdencheek/tree-sitter-go-mod](https://github.com/camdencheek/tree-sitter-go-mod)
|
||||
- Language Server: N/A
|
||||
|
||||
## Go Sum
|
||||
|
||||
- Tree-sitter: [amaanq/tree-sitter-go-sum](https://github.com/amaanq/tree-sitter-go-sum)
|
||||
- Language Server: N/A
|
||||
|
||||
## Go Work
|
||||
|
||||
- Tree-sitter:
|
||||
[tree-sitter-go-work](https://github.com/d1y/tree-sitter-go-work)
|
||||
- Language Server: N/A
|
||||
12
docs/src/languages/groovy.md
Normal file
12
docs/src/languages/groovy.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Groovy
|
||||
description: "Configure Groovy language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
56
docs/src/languages/haskell.md
Normal file
56
docs/src/languages/haskell.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title: Haskell
|
||||
description: "Configure Haskell language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Haskell
|
||||
|
||||
Haskell support is available through the [Haskell extension](https://github.com/zed-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)
|
||||
|
||||
## Installing HLS
|
||||
|
||||
Recommended method to [install haskell-language-server](https://haskell-language-server.readthedocs.io/en/latest/installation.html) (HLS) is via [ghcup](https://www.haskell.org/ghcup/install/) (`curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
|
||||
`):
|
||||
|
||||
```sh
|
||||
ghcup install hls
|
||||
which haskell-language-server-wrapper
|
||||
```
|
||||
|
||||
## Configuring HLS
|
||||
|
||||
If you need to configure haskell-language-server (hls) you can add configuration options to your Zed settings.json:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"hls": {
|
||||
"initialization_options": {
|
||||
"haskell": {
|
||||
"formattingProvider": "fourmolu"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See the official [configuring haskell-language-server](https://haskell-language-server.readthedocs.io/en/latest/configuration.html) docs for more options.
|
||||
|
||||
If you would like to use a specific hls binary, or perhaps use [static-ls](https://github.com/josephsumabat/static-ls) as a drop-in replacement instead, you can specify the binary path and arguments:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"hls": {
|
||||
"binary": {
|
||||
"path": "static-ls",
|
||||
"arguments": ["--experimentalFeatures"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
30
docs/src/languages/helm.md
Normal file
30
docs/src/languages/helm.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: Helm
|
||||
description: "Configure Helm language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Helm
|
||||
|
||||
Support for Helm in Zed is provided by the community-maintained [Helm extension](https://github.com/cabrinha/helm.zed).
|
||||
|
||||
- Tree-sitter: [tree-sitter-go-template](https://github.com/ngalaiko/tree-sitter-go-template/tree/master)
|
||||
- Language Server: [mrjosh/helm-ls](https://github.com/mrjosh/helm-ls)
|
||||
|
||||
## Setup
|
||||
|
||||
Enable Helm language for Helm files by editing your `.zed/settings.json` and adding:
|
||||
|
||||
```json [settings]
|
||||
"file_types": {
|
||||
"Helm": [
|
||||
"**/templates/**/*.tpl",
|
||||
"**/templates/**/*.yaml",
|
||||
"**/templates/**/*.yml",
|
||||
"**/helmfile.d/**/*.yaml",
|
||||
"**/helmfile.d/**/*.yml",
|
||||
"**/values*.yaml"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This will also mark values.yaml files as the type helm, since helm-ls supports this.
|
||||
102
docs/src/languages/html.md
Normal file
102
docs/src/languages/html.md
Normal file
@@ -0,0 +1,102 @@
|
||||
---
|
||||
title: HTML
|
||||
description: "Configure HTML language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# HTML
|
||||
|
||||
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, but if you do not want to use it, you can add the following to your settings:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"auto_install_extensions": {
|
||||
"html": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
By default Zed uses [Prettier](https://prettier.io/) for formatting HTML.
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > HTML, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"HTML": {
|
||||
"format_on_save": "off",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can still trigger formatting manually with {#kb editor::Format} or by opening the [command palette](..//getting-started.md#command-palette) ({#kb command_palette::Toggle}) and selecting "Format Document".
|
||||
|
||||
### LSP Formatting
|
||||
|
||||
To use the `vscode-html-language-server` language server auto-formatting instead of Prettier, configure the formatter in Settings ({#kb zed::OpenSettings}) under Languages > HTML, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"HTML": {
|
||||
"formatter": "language_server",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can customize various [formatting options](https://code.visualstudio.com/docs/languages/html#_formatting) for `vscode-html-language-server` via your Zed `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"vscode-html-language-server": {
|
||||
"settings": {
|
||||
"html": {
|
||||
"format": {
|
||||
// Indent under <html> and <head> (default: false)
|
||||
"indentInnerHtml": true,
|
||||
// Disable formatting inside <svg> or <script>
|
||||
"contentUnformatted": "svg,script",
|
||||
// Add an extra newline before <div> and <p>
|
||||
"extraLiners": "div,p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Using the Tailwind CSS Language Server with HTML
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in HTML files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"experimental": {
|
||||
"classRegex": ["class=\"([^\"]*)\""]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With these settings, you will get completions for Tailwind CSS classes in HTML `class` attributes. Examples:
|
||||
|
||||
```html
|
||||
<div class="flex items-center <completion here>">
|
||||
<p class="text-lg font-bold <completion here>">Hello World</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [CSS](./css.md)
|
||||
- [JavaScript](./javascript.md)
|
||||
- [TypeScript](./typescript.md)
|
||||
172
docs/src/languages/java.md
Normal file
172
docs/src/languages/java.md
Normal file
@@ -0,0 +1,172 @@
|
||||
---
|
||||
title: Java
|
||||
description: "Configure Java language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Java
|
||||
|
||||
Java language support in Zed is provided by:
|
||||
|
||||
- Zed Java: [zed-extensions/java](https://github.com/zed-extensions/java)
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java)
|
||||
- Language Server: [eclipse-jdtls/eclipse.jdt.ls](https://github.com/eclipse-jdtls/eclipse.jdt.ls)
|
||||
|
||||
## Install OpenJDK
|
||||
|
||||
You will need to install a Java runtime (OpenJDK).
|
||||
|
||||
- macOS: `brew install openjdk`
|
||||
- Ubuntu: `sudo add-apt-repository ppa:openjdk-23 && sudo apt-get install openjdk-23`
|
||||
- Windows: `choco install openjdk`
|
||||
- Arch Linux: `sudo pacman -S jre-openjdk-headless`
|
||||
|
||||
Or manually download and install [OpenJDK 23](https://jdk.java.net/23/).
|
||||
|
||||
## Extension Install
|
||||
|
||||
You can install by opening {#action zed::Extensions}({#kb zed::Extensions}) and searching for `java`.
|
||||
|
||||
## Quick start and configuration
|
||||
|
||||
For the majority of users, Java support should work out of the box.
|
||||
|
||||
- It is generally recommended to open projects with the Zed-project root at the Java project root folder (where you would commonly have your `pom.xml` or `build.gradle` file).
|
||||
|
||||
- By default the extension will download and run the latest official version of JDTLS for you, but this requires Java version 21 to be available on your system via either the `$JAVA_HOME` environment variable or as a `java(.exe)` executable on your `$PATH`. If your project requires a lower Java version in the environment, you can specify a different JDK to use for running JDTLS via the `java_home` configuration option.
|
||||
|
||||
- You can provide a **custom launch script for JDTLS**, by adding an executable named `jdtls` (or `jdtls.bat` on Windows) to your `$PATH` environment variable. If this is present, the extension will skip downloading and launching a managed instance and use the one from the environment.
|
||||
|
||||
- To support [Lombok](https://projectlombok.org/), the lombok-jar must be downloaded and registered as a Java-Agent when launching JDTLS. By default the extension automatically takes care of that, but in case you don't want that you can set the `lombok_support` configuration-option to `false`.
|
||||
|
||||
Here is a common `settings.json` including the above mentioned configurations:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"lsp": {
|
||||
"jdtls": {
|
||||
"settings": {
|
||||
"java_home": "/path/to/your/JDK21+",
|
||||
"lombok_support": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Debug support is enabled via our [Fork of Java Debug](https://github.com/zed-industries/java-debug), which the extension will automatically download and start for you. Please refer to the [Debugger Documentation](https://zed.dev/docs/debugger#getting-started) for general information about how debugging works in Zed.
|
||||
|
||||
To get started with Java, click the `edit debug.json` button in the Debug menu, and replace the contents of the file with the following:
|
||||
|
||||
```jsonc
|
||||
[
|
||||
{
|
||||
"adapter": "Java",
|
||||
"request": "launch",
|
||||
"label": "Launch Debugger",
|
||||
// if your project has multiple entry points, specify the one to use:
|
||||
// "mainClass": "com.myorganization.myproject.MyMainClass",
|
||||
//
|
||||
// this effectively sets a breakpoint at your program entry:
|
||||
"stopOnEntry": true,
|
||||
// the working directory for the debug process
|
||||
"cwd": "$ZED_WORKTREE_ROOT",
|
||||
},
|
||||
]
|
||||
```
|
||||
|
||||
You should then be able to start a new Debug Session with the "Launch Debugger" scenario from the debug menu.
|
||||
|
||||
## Launch Scripts (aka Tasks) in Windows
|
||||
|
||||
This extension provides tasks for running your application and tests from within Zed via little play buttons next to tests/entry points. However, due to current limitations of Zed's extension interface, we can not provide scripts that will work across Maven and Gradle on both Windows and Unix-compatible systems, so out of the box the launch scripts only work on Mac and Linux.
|
||||
|
||||
There is a fairly straightforward fix that you can apply to make it work on Windows by supplying your own task scripts. Please see [this Issue](https://github.com/zed-extensions/java/issues/94) for information on how to do that and read the [Tasks section in Zeds documentation](https://zed.dev/docs/tasks) for more information.
|
||||
|
||||
## Advanced Configuration/JDTLS initialization Options
|
||||
|
||||
JDTLS provides many configuration options that can be passed via the `initialize` LSP-request. The extension will pass the JSON-object from `lsp.jdtls.settings.initialization_options` in your settings on to JDTLS. Please refer to the [JDTLS Configuration Wiki Page](https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request) for the available options and values. Below is an example `settings.json` that would pass on the example configuration from the above wiki page to JDTLS:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"lsp": {
|
||||
"jdtls": {
|
||||
"settings": {
|
||||
// this will be sent to JDTLS as initializationOptions:
|
||||
"initialization_options": {
|
||||
"bundles": [],
|
||||
// use this if your zed project root folder is not the same as the java project root:
|
||||
"workspaceFolders": ["file:///home/snjeza/Project"],
|
||||
"settings": {
|
||||
"java": {
|
||||
"home": "/usr/local/jdk-9.0.1",
|
||||
"errors": {
|
||||
"incompleteClasspath": {
|
||||
"severity": "warning",
|
||||
},
|
||||
},
|
||||
"configuration": {
|
||||
"updateBuildConfiguration": "interactive",
|
||||
"maven": {
|
||||
"userSettings": null,
|
||||
},
|
||||
},
|
||||
"import": {
|
||||
"gradle": {
|
||||
"enabled": true,
|
||||
},
|
||||
"maven": {
|
||||
"enabled": true,
|
||||
},
|
||||
"exclusions": [
|
||||
"**/node_modules/**",
|
||||
"**/.metadata/**",
|
||||
"**/archetype-resources/**",
|
||||
"**/META-INF/maven/**",
|
||||
"/**/test/**",
|
||||
],
|
||||
},
|
||||
"referencesCodeLens": {
|
||||
"enabled": false,
|
||||
},
|
||||
"signatureHelp": {
|
||||
"enabled": false,
|
||||
},
|
||||
"implementationCodeLens": "all",
|
||||
"format": {
|
||||
"enabled": true,
|
||||
},
|
||||
"saveActions": {
|
||||
"organizeImports": false,
|
||||
},
|
||||
"contentProvider": {
|
||||
"preferred": null,
|
||||
},
|
||||
"autobuild": {
|
||||
"enabled": false,
|
||||
},
|
||||
"completion": {
|
||||
"favoriteStaticMembers": [
|
||||
"org.junit.Assert.*",
|
||||
"org.junit.Assume.*",
|
||||
"org.junit.jupiter.api.Assertions.*",
|
||||
"org.junit.jupiter.api.Assumptions.*",
|
||||
"org.junit.jupiter.api.DynamicContainer.*",
|
||||
"org.junit.jupiter.api.DynamicTest.*",
|
||||
],
|
||||
"importOrder": ["java", "javax", "com", "org"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[Zed Java Repo](https://github.com/zed-extensions/java)
|
||||
[Eclipse JDTLS Repo](https://github.com/eclipse-jdtls/eclipse.jdt.ls)
|
||||
275
docs/src/languages/javascript.md
Normal file
275
docs/src/languages/javascript.md
Normal file
@@ -0,0 +1,275 @@
|
||||
---
|
||||
title: JavaScript
|
||||
description: "Configure JavaScript language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# JavaScript
|
||||
|
||||
JavaScript support is available natively in Zed.
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript)
|
||||
- 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)
|
||||
- Debug Adapter: [vscode-js-debug](https://github.com/microsoft/vscode-js-debug)
|
||||
|
||||
## 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 docs](../reference/all-settings.md) for more information.
|
||||
|
||||
For example, if you have Prettier installed and on your `PATH`, you can use it to format JavaScript files.
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > JavaScript, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "prettier",
|
||||
"arguments": ["--stdin-filepath", "{buffer_path}"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## JSX
|
||||
|
||||
Zed supports JSX syntax highlighting out of the box.
|
||||
|
||||
In JSX strings, the [`tailwindcss-language-server`](./tailwindcss.md) is used to provide autocompletion for Tailwind CSS classes.
|
||||
|
||||
## JSDoc
|
||||
|
||||
Zed supports JSDoc syntax in JavaScript and TypeScript comments that match the JSDoc syntax.
|
||||
Zed uses [tree-sitter/tree-sitter-jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) for parsing and highlighting JSDoc.
|
||||
|
||||
## ESLint
|
||||
|
||||
You can configure Zed to format code using `eslint --fix` by running the ESLint code action when formatting.
|
||||
|
||||
Configure code actions on format in Settings ({#kb zed::OpenSettings}) under Languages > JavaScript, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"code_actions_on_format": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can also only execute a single ESLint rule when using `fixAll`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"code_actions_on_format": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"lsp": {
|
||||
"eslint": {
|
||||
"settings": {
|
||||
"codeActionOnSave": {
|
||||
"rules": ["import/order"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> **Note:** the other formatter you have configured will still run, after ESLint.
|
||||
> So if your language server or Prettier configuration don't format according to
|
||||
> ESLint's rules, then they will overwrite what ESLint fixed and you end up with
|
||||
> errors.
|
||||
|
||||
If you **only** want to run ESLint on save, you can configure code actions as the formatter.
|
||||
|
||||
Configure in Settings ({#kb zed::OpenSettings}) under Languages > JavaScript, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"formatter": [],
|
||||
"code_actions_on_format": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configure ESLint's `nodePath`:
|
||||
|
||||
You can configure ESLint's `nodePath` setting:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"eslint": {
|
||||
"settings": {
|
||||
"nodePath": ".yarn/sdks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configure ESLint's `problems`:
|
||||
|
||||
You can configure ESLint's `problems` setting.
|
||||
|
||||
For example, here's how to set `problems.shortenToSingleLine`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"eslint": {
|
||||
"settings": {
|
||||
"problems": {
|
||||
"shortenToSingleLine": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configure ESLint's `rulesCustomizations`:
|
||||
|
||||
You can configure ESLint's `rulesCustomizations` setting:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"eslint": {
|
||||
"settings": {
|
||||
"rulesCustomizations": [
|
||||
// set all eslint errors/warnings to show as warnings
|
||||
{ "rule": "*", "severity": "warn" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configure ESLint's `workingDirectory`:
|
||||
|
||||
You can configure ESLint's `workingDirectory` setting:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"eslint": {
|
||||
"settings": {
|
||||
"workingDirectory": {
|
||||
"mode": "auto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Using the Tailwind CSS Language Server with JavaScript
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in vanilla JavaScript files (`.js`), you can customize the `classRegex` field under it in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"experimental": {
|
||||
"classRegex": [
|
||||
"\\.className\\s*[+]?=\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.setAttributeNS\\(.*,\\s*['\"]class['\"],\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.setAttribute\\(['\"]class['\"],\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.add\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.remove\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.toggle\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.contains\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.replace\\(\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.replace\\([^,)]+,\\s*['\"]([^'\"]*)['\"]"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Zed supports debugging JavaScript code out of the box with `vscode-js-debug`.
|
||||
The following can be debugged without writing additional configuration:
|
||||
|
||||
- Tasks from `package.json`
|
||||
- Tests written using several popular frameworks (Jest, Mocha, Vitest, Jasmine, Bun, Node)
|
||||
|
||||
Run {#action debugger::Start} ({#kb debugger::Start}) to see a contextual list of these predefined debug tasks.
|
||||
|
||||
> **Note:** Bun test is automatically detected when `@types/bun` is present in `package.json`.
|
||||
|
||||
> **Note:** Node test is automatically detected when `@types/node` is present in `package.json` (requires Node.js 20+).
|
||||
|
||||
As for all languages, configurations from `.vscode/launch.json` are also available for debugging in Zed.
|
||||
|
||||
If your use-case isn't covered by any of these, you can take full control by adding debug configurations to `.zed/debug.json`. See below for example configurations.
|
||||
|
||||
### Configuring JavaScript debug tasks
|
||||
|
||||
JavaScript debugging is more complicated than other languages because there are two different environments: Node.js and the browser. `vscode-js-debug` exposes a `type` field, that you can use to specify the environment, either `node` or `chrome`.
|
||||
|
||||
- [vscode-js-debug configuration documentation](https://github.com/microsoft/vscode-js-debug/blob/main/OPTIONS.md)
|
||||
|
||||
### Debug the current file with Node
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"adapter": "JavaScript",
|
||||
"label": "Debug JS file",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "$ZED_FILE",
|
||||
"skipFiles": ["<node_internals>/**"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Launch a web app in Chrome
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"adapter": "JavaScript",
|
||||
"label": "Debug app in Chrome",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"file": "$ZED_WORKTREE_ROOT/index.html",
|
||||
"webRoot": "$ZED_WORKTREE_ROOT",
|
||||
"console": "integratedTerminal",
|
||||
"skipFiles": ["<node_internals>/**"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.
|
||||
- [TypeScript documentation](./typescript.md)
|
||||
90
docs/src/languages/json.md
Normal file
90
docs/src/languages/json.md
Normal file
@@ -0,0 +1,90 @@
|
||||
---
|
||||
title: JSON
|
||||
description: "Configure JSON language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# JSON
|
||||
|
||||
JSON support is available natively in Zed.
|
||||
|
||||
- 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.
|
||||
|
||||
## JSONC Prettier Formatting
|
||||
|
||||
If you use files with the `*.jsonc` extension when using `Format Document` or have `format_on_save` enabled, Zed invokes Prettier as the formatter. Prettier has an [outstanding issue](https://github.com/prettier/prettier/issues/15956) where it will add trailing commas to files with a `jsonc` extension. JSONC files which have a `.json` extension are unaffected.
|
||||
|
||||
To workaround this behavior you can add the following to your `.prettierrc` configuration file:
|
||||
|
||||
```json
|
||||
{
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.jsonc"],
|
||||
"options": {
|
||||
"parser": "json",
|
||||
"trailingComma": "none"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## JSON Language Server
|
||||
|
||||
Zed automatically out of the box supports JSON Schema validation of `package.json` and `tsconfig.json` files, but `json-language-server` can use JSON Schema definitions in project files, from the [JSON Schema Store](https://www.schemastore.org) or other publicly available URLs for JSON validation.
|
||||
|
||||
### Inline Schema Specification
|
||||
|
||||
To specify a schema inline with your JSON files, add a `$schema` top level key linking to your json schema file.
|
||||
|
||||
For example to for a `.luarc.json` for use with [lua-language-server](https://github.com/LuaLS/lua-language-server/):
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||
"runtime.version": "Lua 5.4"
|
||||
}
|
||||
```
|
||||
|
||||
### Schema Specification via Settings
|
||||
|
||||
You can associate JSON Schemas with file paths using relative paths in your language server settings. Zed resolves paths relative to your project root:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"json-language-server": {
|
||||
"settings": {
|
||||
"json": {
|
||||
"schemas": [
|
||||
{
|
||||
"fileMatch": ["config/*.json"],
|
||||
"url": "./schemas/custom-schema.json"
|
||||
},
|
||||
{
|
||||
"fileMatch": ["*.config.json"],
|
||||
"url": "~/global-schemas/shared.json"
|
||||
},
|
||||
{
|
||||
"fileMatch": ["*/*.luarc.json"],
|
||||
"url": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Paths starting with `./` resolve relative to the worktree root. Paths starting with `~/` expand to your home directory.
|
||||
|
||||
You can also pass any of the [supported settings](https://github.com/Microsoft/vscode/blob/main/extensions/json-language-features/server/README.md#settings) to json-language-server by specifying them in your Zed settings.json:
|
||||
|
||||
<!--
|
||||
TBD: Add formatter (prettier) settings (autoformat, tab_size, etc)
|
||||
-->
|
||||
29
docs/src/languages/jsonnet.md
Normal file
29
docs/src/languages/jsonnet.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: Jsonnet
|
||||
description: "Configure Jsonnet language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Jsonnet
|
||||
|
||||
Jsonnet language support in Zed is provided by the community-maintained [Jsonnet extension](https://github.com/narqo/zed-jsonnet).
|
||||
|
||||
- Tree-sitter: [sourcegraph/tree-sitter-jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet)
|
||||
- Language Server: [grafana/jsonnet-language-server](https://github.com/grafana/jsonnet-language-server)
|
||||
|
||||
## Configuration
|
||||
|
||||
Workspace configuration options can be passed to the language server via the `lsp` settings of the `settings.json`.
|
||||
|
||||
The following example configures `jsonnet-language-server` to resolve [tanka](https://tanka.dev) import paths:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"jsonnet-language-server": {
|
||||
"settings": {
|
||||
"resolve_paths_with_tanka": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
17
docs/src/languages/julia.md
Normal file
17
docs/src/languages/julia.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: Julia
|
||||
description: "Configure Julia language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
|
||||
<!--
|
||||
TBD: Document Julia Installation
|
||||
TBD: Julia REPL Setup instructions
|
||||
-->
|
||||
61
docs/src/languages/kotlin.md
Normal file
61
docs/src/languages/kotlin.md
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
title: Kotlin
|
||||
description: "Configure Kotlin language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
- Alternate Language Server: [kotlin/kotlin-lsp](https://github.com/kotlin/kotlin-lsp)
|
||||
|
||||
## Configuration
|
||||
|
||||
Workspace configuration options can be passed to the language server via lsp
|
||||
settings in `settings.json`.
|
||||
|
||||
The full list of lsp `settings` can be found
|
||||
[here](https://github.com/fwcd/kotlin-language-server/blob/main/server/src/main/kotlin/org/javacs/kt/Configuration.kt)
|
||||
under `class Configuration` and initialization_options under `class InitializationOptions`.
|
||||
|
||||
### JVM Target
|
||||
|
||||
The following example changes the JVM target from `default` (which is 1.8) to
|
||||
`17`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"kotlin-language-server": {
|
||||
"settings": {
|
||||
"compiler": {
|
||||
"jvm": {
|
||||
"target": "17"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### JAVA_HOME
|
||||
|
||||
To use a specific java installation, just specify the `JAVA_HOME` environment variable with:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"kotlin-language-server": {
|
||||
"binary": {
|
||||
"env": {
|
||||
"JAVA_HOME": "/Users/whatever/Applications/Work/Android Studio.app/Contents/jbr/Contents/Home"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
188
docs/src/languages/lua.md
Normal file
188
docs/src/languages/lua.md
Normal file
@@ -0,0 +1,188 @@
|
||||
---
|
||||
title: Lua
|
||||
description: "Configure Lua language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Lua
|
||||
|
||||
Lua support is available through the [Lua extension](https://github.com/zed-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 project.
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||
"runtime.version": "Lua 5.4",
|
||||
"format.enable": true,
|
||||
"workspace.library": ["../somedir/library"]
|
||||
}
|
||||
```
|
||||
|
||||
See [LuaLS Settings Documentation](https://luals.github.io/wiki/settings/) for all available configuration options, or when editing this file in Zed available settings options will autocomplete, (e.g `runtime.version` will show `"Lua 5.1"`, `"Lua 5.2"`, `"Lua 5.3"`, `"Lua 5.4"` and `"LuaJIT"` as allowed values). Note when importing settings options from VS Code, remove the `Lua.` prefix. (e.g. `runtime.version` instead of `Lua.runtime.version`).
|
||||
|
||||
### LuaCATS Definitions
|
||||
|
||||
LuaLS can provide enhanced LSP autocompletion suggestions and type validation with the help of LuaCATS (Lua Comment and Type System) definitions. These definitions are available for many common Lua libraries, and local paths containing them can be specified via `workspace.library` in `luarc.json`. You can do this via relative paths if you checkout your definitions into the same partent directory of your project (`../playdate-luacats`, `../love2d`, etc). Alternatively you can create submodule(s) inside your project for each LuaCATS definition repo.
|
||||
|
||||
### LÖVE (Love2D) {#love2d}
|
||||
|
||||
To use [LÖVE (Love2D)](https://love2d.org/) in Zed, checkout [LuaCATS/love2d](https://github.com/LuaCATS/love2d) into a folder called `love2d-luacats` into the parent folder of your project:
|
||||
|
||||
```sh
|
||||
cd .. && git clone https://github.com/LuaCATS/love2d love2d-luacats
|
||||
```
|
||||
|
||||
Then in your `.luarc.json`:
|
||||
|
||||
```
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||
"runtime.version": "Lua 5.4",
|
||||
"workspace.library": ["../love2d-luacats"],
|
||||
"runtime.special": {
|
||||
"love.filesystem.load": "loadfile"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### PlaydateSDK
|
||||
|
||||
To use [Playdate Lua SDK](https://play.date/dev/) in Zed, checkout [playdate-luacats](https://github.com/notpeter/playdate-luacats) into the parent folder of your project:
|
||||
|
||||
```sh
|
||||
cd .. && git clone https://github.com/notpeter/playdate-luacats
|
||||
```
|
||||
|
||||
Then in your `.luarc.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||
"runtime.version": "Lua 5.4",
|
||||
"runtime.nonstandardSymbol": [
|
||||
"+=",
|
||||
"-=",
|
||||
"*=",
|
||||
"/=",
|
||||
"//=",
|
||||
"%=",
|
||||
"<<=",
|
||||
">>=",
|
||||
"&=",
|
||||
"|=",
|
||||
"^="
|
||||
],
|
||||
"diagnostics.severity": { "duplicate-set-field": "Hint" },
|
||||
"diagnostics.globals": ["import"],
|
||||
"workspace.library": ["../playdate-luacats"],
|
||||
"format.defaultConfig": {
|
||||
"indent_style": "space",
|
||||
"indent_size": "4"
|
||||
},
|
||||
"format.enable": true,
|
||||
"runtime.builtin": { "io": "disable", "os": "disable", "package": "disable" }
|
||||
}
|
||||
```
|
||||
|
||||
### Inlay Hints
|
||||
|
||||
To enable [Inlay Hints](../configuring-languages.md#inlay-hints) for LuaLS in Zed
|
||||
|
||||
1. Configure inlay hints in Settings ({#kb zed::OpenSettings}) under Languages > Lua, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Lua": {
|
||||
"inlay_hints": {
|
||||
"enabled": true,
|
||||
"show_type_hints": true,
|
||||
"show_parameter_hints": true,
|
||||
"show_other_hints": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. Add `"hint.enable": true` to your `.luarc.json`.
|
||||
|
||||
## Formatting
|
||||
|
||||
### LuaLS Formatting
|
||||
|
||||
To enable auto-formatting with your LuaLS (provided by [CppCXY/EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle)) make sure you have `"format.enable": true,` in your .luarc.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||
"format.enable": true
|
||||
}
|
||||
```
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Lua, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Lua": {
|
||||
"format_on_save": "on",
|
||||
"formatter": "language_server"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can customize various EmmyLuaCodeStyle style options via `.editorconfig`, see [lua.template.editorconfig](https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/lua.template.editorconfig) for all available options.
|
||||
|
||||
### StyLua Formatting
|
||||
|
||||
Alternatively to use [StyLua](https://github.com/JohnnyMorganz/StyLua) for auto-formatting:
|
||||
|
||||
1. Install [StyLua](https://github.com/JohnnyMorganz/StyLua): `brew install stylua` or `cargo install stylua --features lua52,lua53,lua54,luau,luajit` (feel free to remove any Lua versions you don't need).
|
||||
2. Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Lua, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Lua": {
|
||||
"format_on_save": "on",
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "stylua",
|
||||
"arguments": [
|
||||
"--syntax=Lua54",
|
||||
"--respect-ignores",
|
||||
"--stdin-filepath",
|
||||
"{buffer_path}",
|
||||
"-"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can specify various options to StyLua either on the command line above (like `--syntax=Lua54`) or in a `stylua.toml` in your project:
|
||||
|
||||
```toml
|
||||
syntax = "Lua54"
|
||||
column_width = 100
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 4
|
||||
quote_style = "AutoPreferDouble"
|
||||
call_parentheses = "Always"
|
||||
collapse_simple_statement = "All"
|
||||
|
||||
[sort_requires]
|
||||
enabled = true
|
||||
```
|
||||
|
||||
For a complete list of available options, see: [StyLua Options](https://github.com/JohnnyMorganz/StyLua?tab=readme-ov-file#options).
|
||||
46
docs/src/languages/luau.md
Normal file
46
docs/src/languages/luau.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: Luau
|
||||
description: "Configure Luau language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Luau
|
||||
|
||||
[Luau](https://luau.org/) is a fast, small, safe, gradually typed, embeddable scripting language derived from Lua. Luau was developed by Roblox and is 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: [4teapo/tree-sitter-luau](https://github.com/4teapo/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
|
||||
```
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Luau, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Luau": {
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "stylua",
|
||||
"arguments": ["-"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
11
docs/src/languages/makefile.md
Normal file
11
docs/src/languages/makefile.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Makefile
|
||||
description: "Configure Makefile language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
89
docs/src/languages/markdown.md
Normal file
89
docs/src/languages/markdown.md
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
title: Markdown
|
||||
description: "Configure Markdown language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Markdown
|
||||
|
||||
Markdown support is available natively in Zed.
|
||||
|
||||
- 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 <kbd>```</kbd> 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
|
||||
|
||||
### Format
|
||||
|
||||
Zed supports using Prettier to automatically re-format Markdown documents. You can trigger this manually via the {#action editor::Format} action or via the {#kb editor::Format} keyboard shortcut. Alternately, you can enable format on save.
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Markdown": {
|
||||
"format_on_save": "on"
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
### List Continuation
|
||||
|
||||
Zed automatically continues lists when you press Enter at the end of a list item. Supported list types:
|
||||
|
||||
- Unordered lists (`-`, `*`, or `+` markers)
|
||||
- Ordered lists (numbers are auto-incremented)
|
||||
- Task lists (`- [ ]` and `- [x]`)
|
||||
|
||||
Pressing Enter on an empty list item removes the marker and exits the list.
|
||||
|
||||
To disable this behavior, configure in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Markdown": {
|
||||
"extend_list_on_newline": false
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
### List Indentation
|
||||
|
||||
Zed indents list items when you press Tab while the cursor is on a line containing only a list marker. This allows you to quickly create nested lists.
|
||||
|
||||
To disable this behavior, configure in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Markdown": {
|
||||
"indent_list_on_tab": false
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
### Trailing Whitespace
|
||||
|
||||
By default Zed will remove trailing whitespace on save. If you rely on invisible trailing whitespace being converted to `<br />` in Markdown files you can disable this behavior.
|
||||
|
||||
Configure in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Markdown": {
|
||||
"remove_trailing_whitespace_on_save": false
|
||||
}
|
||||
},
|
||||
```
|
||||
31
docs/src/languages/nim.md
Normal file
31
docs/src/languages/nim.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: Nim
|
||||
description: "Configure Nim language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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).
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Nim, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Nim": {
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "nph",
|
||||
"arguments": ["-"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
41
docs/src/languages/ocaml.md
Normal file
41
docs/src/languages/ocaml.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: OCaml
|
||||
description: "Configure OCaml language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# OCaml
|
||||
|
||||
OCaml support is available through the [OCaml extension](https://github.com/zed-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)
|
||||
|
||||
### Using Opam
|
||||
|
||||
Opam is the official package manager for OCaml and is highly recommended for getting started with OCaml. To get started using Opam, please follow the instructions provided [here](https://ocaml.org/install).
|
||||
|
||||
Once you install opam and setup a switch with your development environment as per the instructions, you can proceed.
|
||||
|
||||
### Launching Zed
|
||||
|
||||
By now you should have `ocamllsp` installed, you can verify so by running
|
||||
|
||||
```sh
|
||||
ocamllsp --help
|
||||
```
|
||||
|
||||
in your terminal. If you get a help message, you're good to go. If not, please revisit the installation instructions for `ocamllsp` and ensure it's properly installed.
|
||||
|
||||
With that aside, we can now launch Zed. Given how the OCaml package manager works, we require you to run Zed from the terminal, so please make sure you install the [Zed cli](https://zed.dev/features#cli) if you haven't already.
|
||||
|
||||
Once you have the cli, simply from a terminal, navigate to your project and run
|
||||
|
||||
```sh
|
||||
zed .
|
||||
```
|
||||
|
||||
You should now have Zed running with OCaml support, with no additional setup required.
|
||||
25
docs/src/languages/opentofu.md
Normal file
25
docs/src/languages/opentofu.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: OpenTofu
|
||||
description: "Configure OpenTofu language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# OpenTofu
|
||||
|
||||
OpenTofu support is available through the [OpenTofu extension](https://github.com/ashpool37/zed-extension-opentofu).
|
||||
|
||||
- Tree-sitter: [MichaHoffmann/tree-sitter-hcl](https://github.com/MichaHoffmann/tree-sitter-hcl)
|
||||
- Language Server: [opentofu/tofu-ls](https://github.com/opentofu/tofu-ls)
|
||||
|
||||
## Configuration
|
||||
|
||||
To automatically use the OpenTofu extension and language server when editing `.tf` and `.tfvars` files,
|
||||
either uninstall the Terraform extension or add this to your settings.json:
|
||||
|
||||
```json
|
||||
"file_types": {
|
||||
"OpenTofu": ["tf"],
|
||||
"OpenTofu Vars": ["tfvars"]
|
||||
},
|
||||
```
|
||||
|
||||
See the [full list of server settings here](https://github.com/opentofu/tofu-ls/blob/main/docs/SETTINGS.md).
|
||||
233
docs/src/languages/php.md
Normal file
233
docs/src/languages/php.md
Normal file
@@ -0,0 +1,233 @@
|
||||
---
|
||||
title: PHP
|
||||
description: "Configure PHP language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# PHP
|
||||
|
||||
PHP support is available through the [PHP extension](https://github.com/zed-extensions/php).
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-php](https://github.com/tree-sitter/tree-sitter-php)
|
||||
- Language Server: [phpactor/phpactor](https://github.com/phpactor/phpactor)
|
||||
- Alternate Language Server: [bmewburn/vscode-intelephense](https://github.com/bmewburn/vscode-intelephense/)
|
||||
|
||||
## Install PHP
|
||||
|
||||
The PHP extension requires PHP to be installed and available in your `PATH`:
|
||||
|
||||
```sh
|
||||
# macOS via Homebrew
|
||||
brew install php
|
||||
|
||||
# Debian/Ubuntu
|
||||
sudo apt-get install php-cli
|
||||
|
||||
# CentOS 8+/RHEL
|
||||
sudo dnf install php-cli
|
||||
|
||||
# Arch Linux
|
||||
sudo pacman -S php
|
||||
|
||||
# check PHP path
|
||||
## macOS and Linux
|
||||
which php
|
||||
|
||||
## Windows
|
||||
where php
|
||||
```
|
||||
|
||||
## Choosing a language server
|
||||
|
||||
The PHP extension uses [LSP language servers](https://microsoft.github.io/language-server-protocol) with Phpactor as the default. If you want to use other language servers that support Zed (e.g. Intelephense or PHP Tools), make sure to follow the documentation on how to implement it.
|
||||
|
||||
### 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/buy).
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > PHP, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"PHP": {
|
||||
"language_servers": ["intelephense", "!phpactor", "!phptools", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To use the premium features, you can place your license file inside your home directory at `~/intelephense/licence.txt` for macOS and Linux, or `%USERPROFILE%/intelephense/licence.txt` on Windows.
|
||||
|
||||
Alternatively, you can pass the licence key or a path to a file containing the licence key as an initialization option. To do this, add the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"intelephense": {
|
||||
"initialization_options": {
|
||||
"licenceKey": "/path/to/licence.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### PHP Tools
|
||||
|
||||
[PHP Tools](https://www.devsense.com/) is a proprietary language server that offers free and premium features. You need to [purchase a license](https://www.devsense.com/en/purchase) to activate the premium features.
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > PHP, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"PHP": {
|
||||
"language_servers": ["phptools", "!intelephense", "!phpactor", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To use the premium features, you can add your license in `initialization_options` in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"phptools": {
|
||||
"initialization_options": {
|
||||
"0": "your_license_key"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
or, set environment variable `DEVSENSE_PHP_LS_LICENSE` on `.env` file in your project.
|
||||
|
||||
```env
|
||||
DEVSENSE_PHP_LS_LICENSE="your_license_key"
|
||||
```
|
||||
|
||||
Check out the documentation of [PHP Tools for Zed](https://docs.devsense.com/other/zed/) for more details.
|
||||
|
||||
### Phpactor
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > PHP, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"PHP": {
|
||||
"language_servers": ["phpactor", "!intelephense", "!phptools", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## PHPDoc
|
||||
|
||||
Zed supports syntax highlighting for PHPDoc comments.
|
||||
|
||||
- Tree-sitter: [claytonrcarter/tree-sitter-phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc)
|
||||
|
||||
## Debugging
|
||||
|
||||
The PHP extension provides a debug adapter for PHP via Xdebug. There are several ways to use it:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"label": "PHP: Listen to Xdebug",
|
||||
"adapter": "Xdebug",
|
||||
"request": "launch",
|
||||
"port": 9003
|
||||
},
|
||||
{
|
||||
"label": "PHP: Debug this test",
|
||||
"adapter": "Xdebug",
|
||||
"request": "launch",
|
||||
"program": "vendor/bin/phpunit",
|
||||
"args": ["--filter", "$ZED_SYMBOL"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
These are common troubleshooting tips, in case you run into issues:
|
||||
|
||||
- Ensure that you have Xdebug installed for the version of PHP you're running.
|
||||
- Ensure that Xdebug is configured to run in `debug` mode.
|
||||
- Ensure that Xdebug is actually starting a debugging session.
|
||||
- Ensure that the host and port matches between Xdebug and Zed.
|
||||
- Look at the diagnostics log by using the `xdebug_info()` function in the page you're trying to debug.
|
||||
|
||||
## Using the Tailwind CSS Language Server with PHP
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in PHP files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"includeLanguages": {
|
||||
"php": "html"
|
||||
},
|
||||
"experimental": {
|
||||
"classRegex": [
|
||||
"class=\"([^\"]*)\"",
|
||||
"class='([^']*)'",
|
||||
"class=\\\"([^\\\"]*)\\\""
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With these settings, you will get completions for Tailwind CSS classes in HTML attributes inside PHP files. Examples:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// PHP file with HTML:
|
||||
?>
|
||||
<div class="flex items-center <completion here>">
|
||||
<p class="text-lg font-bold <completion here>">Hello World</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Laravel/Blade
|
||||
|
||||
For Laravel/Blade files, you may need additional configuration to handle Blade directives:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"includeLanguages": {
|
||||
"php": "html",
|
||||
"blade": "html"
|
||||
},
|
||||
"experimental": {
|
||||
"classRegex": [
|
||||
"class=\"([^\"]*)\"",
|
||||
"class='([^']*)'",
|
||||
"class=\\\"([^\\\"]*)\\\"",
|
||||
"@class\\(\\[([^\\]]*)\\]\\)"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This will also provide completions in Blade directives like:
|
||||
|
||||
```blade
|
||||
{{-- Blade file --}}
|
||||
<div class="flex {{ $customClass }} <completion here>">
|
||||
@class(['flex', 'items-center', '<completion here>'])
|
||||
</div>
|
||||
```
|
||||
40
docs/src/languages/powershell.md
Normal file
40
docs/src/languages/powershell.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: PowerShell
|
||||
description: "Configure PowerShell language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# PowerShell
|
||||
|
||||
PowerShell language support in Zed is provided by the community-maintained [Zed PowerShell extension](https://github.com/wingyplus/zed-powershell). Please report issues to: [github.com/wingyplus/zed-powershell/issues](https://github.com/wingyplus/zed-powershell/issues)
|
||||
|
||||
- Tree-sitter: [airbus-cert/tree-sitter-powershell](https://github.com/airbus-cert/tree-sitter-powershell)
|
||||
- Language Server: [PowerShell/PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices)
|
||||
|
||||
## Setup
|
||||
|
||||
### Install PowerShell 7+ {#powershell-install}
|
||||
|
||||
- macOS: `brew install powershell/tap/powershell`
|
||||
- Alpine: [Installing PowerShell on Alpine Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/install-alpine)
|
||||
- Debian: [Install PowerShell on Debian Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/install-debian)
|
||||
- RedHat: [Install PowerShell on RHEL](https://learn.microsoft.com/en-us/powershell/scripting/install/install-rhel)
|
||||
- Ubuntu: [Install PowerShell on RHEL](https://learn.microsoft.com/en-us/powershell/scripting/install/install-ubuntu)
|
||||
- Windows: [Install PowerShell on Windows](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows)
|
||||
|
||||
The Zed PowerShell extension will default to the `pwsh` executable found in your path.
|
||||
|
||||
### Install PowerShell Editor Services (Optional) {#powershell-editor-services}
|
||||
|
||||
The Zed PowerShell extensions will attempt to download [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) automatically.
|
||||
|
||||
If want to use a specific binary, you can specify in your that in your Zed settings.json:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"powershell-es": {
|
||||
"binary": {
|
||||
"path": "/path/to/PowerShellEditorServices"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
15
docs/src/languages/prisma.md
Normal file
15
docs/src/languages/prisma.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Prisma
|
||||
description: "Configure Prisma language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Prisma
|
||||
|
||||
Prisma support is available through the [Prisma extension](https://github.com/zed-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)
|
||||
|
||||
<!--
|
||||
TBD: Prisma usage and configuration documentation
|
||||
-->
|
||||
84
docs/src/languages/proto.md
Normal file
84
docs/src/languages/proto.md
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title: Proto
|
||||
description: "Configure Proto language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Proto
|
||||
|
||||
Proto/proto3 (Protocol Buffers definition language) support is available through the [Proto extension](https://github.com/zed-industries/zed/tree/main/extensions/proto).
|
||||
|
||||
- Tree-sitter: [coder3101/tree-sitter-proto](https://github.com/coder3101/tree-sitter-proto)
|
||||
- Language Servers: [protobuf-language-server](https://github.com/lasorda/protobuf-language-server)
|
||||
|
||||
<!--
|
||||
TBD: Clarify which language server(s) to use / Feature support.
|
||||
|
||||
## Setup
|
||||
|
||||
### Install protobuf-language-server
|
||||
|
||||
Install protobuf-language-server and make sure it's in your PATH:
|
||||
|
||||
```
|
||||
go install github.com/lasorda/protobuf-language-server@latest
|
||||
which protobuf-language-server
|
||||
```
|
||||
|
||||
### Install ProtoLS
|
||||
|
||||
Install protols and make sure it's in your PATH:
|
||||
|
||||
```
|
||||
cargo install protols
|
||||
which protols
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"protobuf-language-server": {
|
||||
"binary": {
|
||||
"path": "protols"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
ProtoLS supports formatting if you have `clang-format` installed.
|
||||
|
||||
```sh
|
||||
# MacOS:
|
||||
brew install clang-format
|
||||
# Ubuntu
|
||||
sudo apt-get install clang-format
|
||||
# Fedora
|
||||
sudo dnf install clang-tools-extra
|
||||
```
|
||||
|
||||
To customize your formatting preferences, create a `.clang-format` file, e.g.:
|
||||
|
||||
```clang-format
|
||||
IndentWidth: 4
|
||||
ColumnLimit: 120
|
||||
```
|
||||
|
||||
Or you can have zed directly invoke `clang-format` by specifying it as a [formatter](https://zed.dev/docs/reference/all-settings#formatter) in your settings:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Proto": {
|
||||
"format_on_save": "on",
|
||||
"tab_size": 4,
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "clang-format",
|
||||
"arguments": ["-style={IndentWidth: 4, ColumnLimit: 0}"]
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
```
|
||||
-->
|
||||
11
docs/src/languages/purescript.md
Normal file
11
docs/src/languages/purescript.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: PureScript
|
||||
description: "Configure PureScript language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# PureScript
|
||||
|
||||
PureScript support is available through the [PureScript extension](https://github.com/zed-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)
|
||||
447
docs/src/languages/python.md
Normal file
447
docs/src/languages/python.md
Normal file
@@ -0,0 +1,447 @@
|
||||
---
|
||||
title: Python
|
||||
description: "Configure Python language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# How to Set Up Python in Zed
|
||||
|
||||
Python support is available natively in Zed.
|
||||
|
||||
- Tree-sitter: [tree-sitter-python](https://github.com/zed-industries/tree-sitter-python)
|
||||
- Language Servers:
|
||||
- [DetachHead/basedpyright](https://github.com/DetachHead/basedpyright)
|
||||
- [astral-sh/ruff](https://github.com/astral-sh/ruff)
|
||||
- [astral-sh/ty](https://github.com/astral-sh/ty)
|
||||
- [microsoft/pyright](https://github.com/microsoft/pyright)
|
||||
- [python-lsp/python-lsp-server](https://github.com/python-lsp/python-lsp-server) (PyLSP)
|
||||
- Debug Adapter: [debugpy](https://github.com/microsoft/debugpy)
|
||||
|
||||
## Install Python
|
||||
|
||||
You'll need both Zed and Python installed before you can begin.
|
||||
|
||||
### Step 1: Install Python
|
||||
|
||||
Zed does not bundle a Python runtime, so you’ll need to install one yourself.
|
||||
Choose one of the following options:
|
||||
|
||||
- uv (recommended)
|
||||
|
||||
```bash
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
```
|
||||
|
||||
To learn more, visit [Astral’s installation guide](https://docs.astral.sh/uv/getting-started/installation/).
|
||||
|
||||
- Homebrew:
|
||||
|
||||
```bash
|
||||
brew install python
|
||||
```
|
||||
|
||||
- Python.org installer: Download the latest version from [python.org/downloads](https://python.org/downloads).
|
||||
|
||||
### Step 2: Verify Python Installation
|
||||
|
||||
Confirm Python is installed and available in your shell:
|
||||
|
||||
```bash
|
||||
python3 --version
|
||||
```
|
||||
|
||||
You should see an output like `Python 3.x.x`.
|
||||
|
||||
## Open Your First Python Project in Zed
|
||||
|
||||
Once Zed and Python are installed, open a folder containing Python code to start working.
|
||||
|
||||
### Step 1: Launch Zed with a Python Project
|
||||
|
||||
Open Zed.
|
||||
From the menu bar, choose File > Open Folder, or launch from the terminal:
|
||||
|
||||
```bash
|
||||
zed path/to/your/project
|
||||
```
|
||||
|
||||
Zed will recognize `.py` files automatically using its native tree-sitter-python parser, with no plugins or manual setup required.
|
||||
|
||||
### Step 2: Use the Integrated Terminal (Optional)
|
||||
|
||||
Zed includes an integrated terminal, accessible from the bottom panel. If Zed detects that your project is using a [virtual environment](#virtual-environments), it will be activated automatically in newly-created terminals. You can configure this behavior with the [`detect_venv`](../reference/all-settings.md#terminal-detect_venv) setting.
|
||||
|
||||
## Configure Python Language Servers in Zed
|
||||
|
||||
Zed provides several Python language servers out of the box. By default, [basedpyright](https://github.com/DetachHead/basedpyright) is the primary language server, and [Ruff](https://github.com/astral-sh/ruff) is used for formatting and linting.
|
||||
|
||||
Other built-in language servers are:
|
||||
|
||||
- [ty](https://docs.astral.sh/ty/)—Up-and-coming language server from Astral, built for speed.
|
||||
- [Pyright](https://github.com/microsoft/pyright)—The basis for basedpyright.
|
||||
- [PyLSP](https://github.com/python-lsp/python-lsp-server)—A plugin-based language server that integrates with tools like `pycodestyle`, `autopep8`, and `yapf`.
|
||||
|
||||
These are disabled by default, but can be enabled in your settings.
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > Python, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Python": {
|
||||
"language_servers": [
|
||||
// Enable ty, disable basedpyright, and enable all
|
||||
// other registered language servers (ruff, pylsp, pyright).
|
||||
"ty",
|
||||
"!basedpyright",
|
||||
"..."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See: [Working with Language Servers](https://zed.dev/docs/configuring-languages#working-with-language-servers) for more information about how to enable and disable language servers.
|
||||
|
||||
### Basedpyright
|
||||
|
||||
[basedpyright](https://docs.basedpyright.com/latest/) is the primary Python language server in Zed beginning with Zed v0.204.0. It provides core language server functionality like navigation (go to definition/find all references) and type checking. Compared to Pyright, it adds support for additional language server features (like inlay hints) and checking rules.
|
||||
|
||||
Note that while basedpyright in isolation defaults to the `recommended` [type-checking mode](https://docs.basedpyright.com/latest/benefits-over-pyright/better-defaults/#typecheckingmode), Zed configures it to use the less-strict `standard` mode by default, which matches the behavior of Pyright. You can set the type-checking mode for your project using the `typeCheckingMode` setting in `pyrightconfig.json` or `pyproject.toml`, which will override Zed's default. Read on more for more details about how to configure basedpyright.
|
||||
|
||||
#### Basedpyright Configuration
|
||||
|
||||
basedpyright reads configuration options from two different kinds of sources:
|
||||
|
||||
- Language server settings ("workspace configuration"), which must be configured per-editor (using `settings.json` in Zed's case) but apply to all projects opened in that editor
|
||||
- Configuration files (`pyrightconfig.json`, `pyproject.toml`), which are editor-independent but specific to the project where they are placed
|
||||
|
||||
As a rule of thumb, options that are only relevant when using basedpyright from an editor must be set in language server settings, and options that are relevant even if you're running it [as a command-line tool](https://docs.basedpyright.com/latest/configuration/command-line/) must be set in configuration files. Settings related to inlay hints are examples of the first category, and the [diagnostic category](https://docs.basedpyright.com/latest/configuration/config-files/#diagnostic-categories) settings are examples of the second category.
|
||||
|
||||
Examples of both kinds of configuration are provided below. Refer to the basedpyright documentation on [language server settings](https://docs.basedpyright.com/latest/configuration/language-server-settings/) and [configuration files](https://docs.basedpyright.com/latest/configuration/config-files/) for comprehensive lists of available options.
|
||||
|
||||
##### Language server settings
|
||||
|
||||
Language server settings for basedpyright in Zed can be set in the `lsp` section of your `settings.json`.
|
||||
|
||||
For example, to:
|
||||
|
||||
- diagnose all files in the workspace instead of the only open files default
|
||||
- disable inlay hints on function arguments
|
||||
|
||||
You can use the following configuration:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"basedpyright": {
|
||||
"settings": {
|
||||
"basedpyright.analysis": {
|
||||
"diagnosticMode": "workspace",
|
||||
"inlayHints": {
|
||||
"callArgumentNames": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Configuration files
|
||||
|
||||
basedpyright reads project-specific configuration from the `pyrightconfig.json` configuration file and from the `[tool.basedpyright]` and `[tool.pyright]` sections of `pyproject.toml` manifests. `pyrightconfig.json` overrides `pyproject.toml` if configuration is present in both places.
|
||||
|
||||
Here's an example `pyrightconfig.json` file that configures basedpyright to use the `strict` type-checking mode and not to issue diagnostics for any files in `__pycache__` directories:
|
||||
|
||||
```json
|
||||
{
|
||||
"typeCheckingMode": "strict",
|
||||
"ignore": ["**/__pycache__"]
|
||||
}
|
||||
```
|
||||
|
||||
### PyLSP
|
||||
|
||||
[python-lsp-server](https://github.com/python-lsp/python-lsp-server/), more commonly known as PyLSP, by default integrates with a number of external tools (autopep8, mccabe, pycodestyle, yapf) while others are optional and must be explicitly enabled and configured (flake8, pylint).
|
||||
|
||||
See [Python Language Server Configuration](https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md) for more.
|
||||
|
||||
## Virtual Environments
|
||||
|
||||
[Virtual environments](https://docs.python.org/3/library/venv.html) are a useful tool for fixing a Python version and set of dependencies for a specific project, in a way that's isolated from other projects on the same machine. Zed has built-in support for discovering, configuring, and activating virtual environments, based on the language-agnostic concept of a [toolchain](../toolchains.md).
|
||||
|
||||
Note that if you have a global Python installation, it is also counted as a toolchain for Zed's purposes.
|
||||
|
||||
### Create a Virtual Environment
|
||||
|
||||
If your project doesn't have a virtual environment set up already, you can create one as follows:
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
```
|
||||
|
||||
Alternatively, if you're using `uv`, running `uv sync` will create a virtual environment the first time you run it.
|
||||
|
||||
### How Zed Uses Python Toolchains
|
||||
|
||||
Zed uses the selected Python toolchain for your project in the following ways:
|
||||
|
||||
- Built-in language servers will be automatically configured with the path to the toolchain's Python interpreter and, if applicable, virtual environment. This is important so that they can resolve dependencies. (Note that language servers provided by extensions can't be automatically configured like this currently.)
|
||||
- Python tasks (such as pytest tests) will be run using the toolchain's Python interpreter.
|
||||
- If the toolchain is a virtual environment, the environment's activation script will be run automatically when you launch a new shell in Zed's integrated terminal, giving you convenient access to the selected Python interpreter and dependency set.
|
||||
- If a built-in language server is installed in the active virtual environment, that binary will be used instead of Zed's private automatically-installed binary. This also applies to debugpy.
|
||||
|
||||
### Selecting a Toolchain
|
||||
|
||||
For most projects, Zed will automatically select the right Python toolchain. In complex projects with multiple virtual environments, it might be necessary to override this selection. You can use the [toolchain selector](../toolchains.md#selecting-toolchains) to pick a toolchain from the list discovered by Zed, or [specify the path to a toolchain manually](../toolchains.md#adding-toolchains-manually) if it's not on the list.
|
||||
|
||||
## Code Formatting & Linting
|
||||
|
||||
Zed uses [Ruff](https://github.com/astral-sh/ruff) for formatting and linting Python code. Specifically, it runs Ruff as an LSP server using the `ruff server` subcommand.
|
||||
|
||||
### Configuring Formatting
|
||||
|
||||
Formatting in Zed follows a two-phase pipeline: first, code actions on format (`code_actions_on_format`) are executed, followed by the configured formatter.
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Python, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Python": {
|
||||
"code_actions_on_format": {
|
||||
"source.organizeImports.ruff": true
|
||||
},
|
||||
"formatter": {
|
||||
"language_server": {
|
||||
"name": "ruff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
These two phases are independent. For example, if you prefer [Black](https://github.com/psf/black) for code formatting, but want to keep Ruff's import sorting, you only need to change the formatter phase.
|
||||
|
||||
Configure in Settings ({#kb zed::OpenSettings}) under Languages > Python, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Python": {
|
||||
"code_actions_on_format": {
|
||||
// Phase 1: Ruff still handles organize imports
|
||||
"source.organizeImports.ruff": true
|
||||
},
|
||||
"formatter": {
|
||||
// Phase 2: Black handles formatting
|
||||
"external": {
|
||||
"command": "black",
|
||||
"arguments": ["--stdin-filename", "{buffer_path}", "-"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To completely switch to another tool and prevent Ruff from modifying your code at all, you must explicitly set `source.organizeImports.ruff` to false in the `code_actions_on_format` section, in addition to changing the formatter.
|
||||
|
||||
To prevent any formatting actions when you save, you can disable format-on-save for Python files.
|
||||
|
||||
Configure in Settings ({#kb zed::OpenSettings}) under Languages > Python, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Python": {
|
||||
"format_on_save": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configuring Ruff
|
||||
|
||||
Like basedpyright, Ruff reads options from both Zed's language server settings and configuration files (`ruff.toml`) when used in Zed. Unlike basedpyright, _all_ options can be configured in either of these locations, so the choice of where to put your Ruff configuration comes down to whether you want it to be shared between projects but specific to Zed (in which case you should use language server settings), or specific to one project but common to all Ruff invocations (in which case you should use `ruff.toml`).
|
||||
|
||||
Here's an example of using language server settings in Zed's `settings.json` to disable all Ruff lints in Zed (while still using Ruff as a formatter):
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"ruff": {
|
||||
"initialization_options": {
|
||||
"settings": {
|
||||
"exclude": ["*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
And here's an example `ruff.toml` with linting and formatting options, adapted from the Ruff documentation:
|
||||
|
||||
```toml
|
||||
[lint]
|
||||
# Avoid enforcing line-length violations (`E501`)
|
||||
ignore = ["E501"]
|
||||
|
||||
[format]
|
||||
# Use single quotes when formatting.
|
||||
quote-style = "single"
|
||||
```
|
||||
|
||||
For more details, refer to the Ruff documentation about [configuration files](https://docs.astral.sh/ruff/configuration/) and [language server settings](https://docs.astral.sh/ruff/editors/settings/), and the [list of options](https://docs.astral.sh/ruff/settings/).
|
||||
|
||||
### Embedded Language Highlighting
|
||||
|
||||
Zed supports syntax highlighting for code embedded in Python strings by adding a comment with the language name.
|
||||
|
||||
```python
|
||||
# sql
|
||||
query = "SELECT * FROM users"
|
||||
|
||||
#sql
|
||||
query = """
|
||||
SELECT *
|
||||
FROM users
|
||||
"""
|
||||
|
||||
result = func( #sql
|
||||
"SELECT * FROM users"
|
||||
)
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Zed supports Python debugging through the `debugpy` adapter. You can start with no configuration or define custom launch profiles in `.zed/debug.json`.
|
||||
|
||||
### Start Debugging with No Setup
|
||||
|
||||
Zed can automatically detect debuggable Python entry points. Press F4 (or run debugger: start from the Command Palette) to see available options for your current project.
|
||||
This works for:
|
||||
|
||||
- Python scripts
|
||||
- Modules
|
||||
- pytest tests
|
||||
|
||||
Zed uses `debugpy` under the hood, but no manual adapter configuration is required.
|
||||
|
||||
### Define Custom Debug Configurations
|
||||
|
||||
For reusable setups, create a `.zed/debug.json` file in your project root. This gives you more control over how Zed runs and debugs your code.
|
||||
|
||||
- [debugpy configuration documentation](https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings#launchattach-settings)
|
||||
|
||||
#### Debug Active File
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Python Active File",
|
||||
"adapter": "Debugpy",
|
||||
"program": "$ZED_FILE",
|
||||
"request": "launch"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
This runs the file currently open in the editor.
|
||||
|
||||
#### Debug a Flask App
|
||||
|
||||
For projects using Flask, you can define a full launch configuration:
|
||||
|
||||
```
|
||||
.venv/
|
||||
app/
|
||||
init.py
|
||||
main.py
|
||||
routes.py
|
||||
templates/
|
||||
index.html
|
||||
static/
|
||||
style.css
|
||||
requirements.txt
|
||||
```
|
||||
|
||||
…the following configuration can be used:
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Python: Flask",
|
||||
"adapter": "Debugpy",
|
||||
"request": "launch",
|
||||
"module": "app",
|
||||
"cwd": "$ZED_WORKTREE_ROOT",
|
||||
"env": {
|
||||
"FLASK_APP": "app",
|
||||
"FLASK_DEBUG": "1"
|
||||
},
|
||||
"args": [
|
||||
"run",
|
||||
"--reload", // Enables Flask reloader that watches for file changes
|
||||
"--debugger" // Enables Flask debugger
|
||||
],
|
||||
"autoReload": {
|
||||
"enable": true
|
||||
},
|
||||
"jinja": true,
|
||||
"justMyCode": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
These can be combined to tailor the experience for web servers, test runners, or custom scripts.
|
||||
|
||||
#### Debug a Django App
|
||||
|
||||
For projects using Django with a structure similar to the following:
|
||||
|
||||
```
|
||||
my_django_project/
|
||||
manage.py
|
||||
…
|
||||
my_django_app/
|
||||
migrations/
|
||||
templates/
|
||||
models.py
|
||||
urls.py
|
||||
…
|
||||
```
|
||||
|
||||
…the following configuration can be used:
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Python: Django",
|
||||
"adapter": "Debugpy",
|
||||
"request": "launch",
|
||||
"program": "manage.py",
|
||||
"args": ["runserver"],
|
||||
"django": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Issues with Python in Zed typically involve virtual environments, language servers, or tooling configuration.
|
||||
|
||||
### Resolve Language Server Startup Issues
|
||||
|
||||
If a language server isn't responding or features like diagnostics or autocomplete aren't available:
|
||||
|
||||
- Check your Zed log (using the {#action zed::OpenLog} action) for errors related to the language server you're trying to use. This is where you're likely to find useful information if the language server failed to start up at all.
|
||||
- Use the language server logs view to understand the lifecycle of the affected language server. You can access this view using the {#action dev::OpenLanguageServerLogs} action, or by clicking the lightning bolt icon in the status bar and selecting your language server. The most useful pieces of data in this view are:
|
||||
- "Server Logs", which shows any errors printed by the language server
|
||||
- "Server Info", which shows details about how the language server was started
|
||||
- Verify your `settings.json` or `pyrightconfig.json` is syntactically correct.
|
||||
- Restart Zed to reinitialize language server connections, or try restarting the language server using the {#action editor::RestartLanguageServer}
|
||||
|
||||
If the language server is failing to resolve imports, and you're using a virtual environment, make sure that the right environment is chosen in the selector. You can use "Server Info" view to confirm which virtual environment Zed is sending to the language server—look for the `* Configuration` section at the end.
|
||||
170
docs/src/languages/r.md
Normal file
170
docs/src/languages/r.md
Normal file
@@ -0,0 +1,170 @@
|
||||
---
|
||||
title: R
|
||||
description: "Configure R language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# R
|
||||
|
||||
R support is available via multiple R Zed extensions:
|
||||
|
||||
- [ocsmit/zed-r](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)
|
||||
|
||||
- [posit-dev/air](https://github.com/posit-dev/air/tree/main/editors/zed)
|
||||
- Formatter: [posit-dev/air](https://posit-dev.github.io/air/)
|
||||
|
||||
## Installation
|
||||
|
||||
1. [Download and Install R](https://cloud.r-project.org/).
|
||||
2. Install the R packages `languageserver` and `lintr`:
|
||||
|
||||
```R
|
||||
install.packages("languageserver")
|
||||
install.packages("lintr")
|
||||
```
|
||||
|
||||
3. Install the [R](https://github.com/ocsmit/zed-r) extension through Zed's extensions manager for basic R language support (syntax highlighting, tree-sitter support) and for [REditorSupport/languageserver](https://github.com/REditorSupport/languageserver) support.
|
||||
|
||||
4. Install the [Air](https://posit-dev.github.io/air/) extension through Zed's extensions manager for R code formatting via Air.
|
||||
|
||||
## Linting
|
||||
|
||||
`REditorSupport/languageserver` bundles support for [r-lib/lintr](https://github.com/r-lib/lintr) as a linter. This can be configured via the use of a `.lintr` inside your project (or in your home directory for global defaults).
|
||||
|
||||
```r
|
||||
linters: linters_with_defaults(
|
||||
line_length_linter(120),
|
||||
commented_code_linter = NULL
|
||||
)
|
||||
exclusions: list(
|
||||
"inst/doc/creating_linters.R" = 1,
|
||||
"inst/example/bad.R",
|
||||
"tests/testthat/exclusions-test"
|
||||
)
|
||||
```
|
||||
|
||||
Or exclude it from linting anything,
|
||||
|
||||
```r
|
||||
exclusions: list(".")
|
||||
```
|
||||
|
||||
See [Using lintr](https://lintr.r-lib.org/articles/lintr.html) for a complete list of options,
|
||||
|
||||
## Formatting
|
||||
|
||||
### Air
|
||||
|
||||
[Air](https://posit-dev.github.io/air/) provides code formatting for R, including support for format-on-save. The [Air documentation for Zed](https://posit-dev.github.io/air/editor-zed.html) contains the most up-to-date advice for running Air in Zed.
|
||||
|
||||
Ensure that you have installed both the [ocsmit/zed-r](https://github.com/ocsmit/zed-r) extension (for general R language awareness in Zed) and the [Air](https://posit-dev.github.io/air/) extension.
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > R, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"R": {
|
||||
"language_servers": ["air"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you use the `"r_language_server"` from `REditorSupport/languageserver`, but would still like to use Air for formatting, configure in Settings ({#kb zed::OpenSettings}) under Languages > R, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"R": {
|
||||
"language_servers": ["air", "r_language_server"],
|
||||
"use_on_type_format": false
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that `"air"` must come first in this list, otherwise [r-lib/styler](https://github.com/r-lib/styler) will be invoked via `"r_language_server"`.
|
||||
|
||||
`"r_language_server"` provides on-type-formatting that differs from Air's formatting rules. To avoid this entirely and let Air be fully in charge of formatting your R files, also set `"use_on_type_format": false` as shown above.
|
||||
|
||||
#### Configuring Air
|
||||
|
||||
Air is minimally configurable via an `air.toml` file placed in the root folder of your project:
|
||||
|
||||
```toml
|
||||
[format]
|
||||
line-width = 80
|
||||
indent-width = 2
|
||||
```
|
||||
|
||||
For more details, refer to the Air documentation about [configuration](https://posit-dev.github.io/air/configuration.html).
|
||||
|
||||
### Styler
|
||||
|
||||
`REditorSupport/languageserver` bundles support for [r-lib/styler](https://github.com/r-lib/styler) as a formatter. See [Customizing Styler](https://cran.r-project.org/web/packages/styler/vignettes/customizing_styler.html) for more information on how to customize its behavior.
|
||||
|
||||
<!--
|
||||
TBD: Get this working
|
||||
|
||||
### REditorSupport/languageserver Configuration
|
||||
|
||||
You can configure the [R languageserver settings](https://github.com/REditorSupport/languageserver#settings) via Zed Project Settings `.zed/settings.json` or Zed User Settings `~/.config/zed/settings.json`:
|
||||
|
||||
For example to disable Lintr linting and suppress code snippet suggestions (both enabled by default):
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"r_language_server": {
|
||||
"settings": {
|
||||
"r": {
|
||||
"lsp": {
|
||||
"diagnostics": false,
|
||||
"snippet_support": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
-->
|
||||
|
||||
<!--
|
||||
TBD: R REPL Docs
|
||||
|
||||
## REPL
|
||||
|
||||
### Ark Installation
|
||||
|
||||
To use the Zed REPL with R you need to install [Ark](https://github.com/posit-dev/ark), an R Kernel for Jupyter applications.
|
||||
You can down the latest version from the [Ark GitHub Releases](https://github.com/posit-dev/ark/releases) and then extract the `ark` binary to a directory in your `PATH`.
|
||||
|
||||
For example to install the latest non-debug build:
|
||||
|
||||
```sh
|
||||
# macOS
|
||||
cd /tmp
|
||||
curl -L -o ark-latest-darwin.zip \
|
||||
$(curl -s "https://api.github.com/repos/posit-dev/ark/releases/latest" | \
|
||||
jq -r '.assets[] | select(.name | contains("darwin-universal") and (contains("debug") | not)) | .browser_download_url')
|
||||
unzip ark-latest-darwin.zip ark
|
||||
sudo mv /tmp/ark /usr/local/bin/
|
||||
```
|
||||
|
||||
```sh
|
||||
# Linux X86_64
|
||||
cd /tmp
|
||||
curl -L -o ark-latest-linux.zip \
|
||||
$(curl -s "https://api.github.com/repos/posit-dev/ark/releases/latest" \
|
||||
| jq -r '.assets[] | select(.name | contains("linux-x64") and (contains("debug") | not)) | .browser_download_url'
|
||||
)
|
||||
unzip ark-latest-linux.zip ark
|
||||
sudo mv /tmp/ark /usr/local/bin/
|
||||
```
|
||||
|
||||
-->
|
||||
12
docs/src/languages/racket.md
Normal file
12
docs/src/languages/racket.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Racket
|
||||
description: "Configure Racket language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Racket
|
||||
|
||||
Racket support is available through the [Racket extension](https://github.com/zed-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.
|
||||
43
docs/src/languages/rego.md
Normal file
43
docs/src/languages/rego.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Rego
|
||||
description: "Configure Rego language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Rego
|
||||
|
||||
Rego language support in Zed is provided by the community-maintained [Rego extension](https://github.com/StyraInc/zed-rego).
|
||||
|
||||
- Tree-sitter: [FallenAngel97/tree-sitter-rego](https://github.com/FallenAngel97/tree-sitter-rego)
|
||||
- Language Server: [open-policy-agent/regal](https://github.com/open-policy-agent/regal)
|
||||
|
||||
## Installation
|
||||
|
||||
The extension is largely based on the [Regal](https://docs.styra.com/regal/language-server) language server which should be installed to make use of the extension. Read the [getting started](https://docs.styra.com/regal#getting-started) instructions for more information.
|
||||
|
||||
## Configuration
|
||||
|
||||
The extension's behavior is configured in the `.regal/config.yaml` file. The following is an example configuration which disables the `todo-comment` rule, customizes the `line-length` rule, and ignores test files for the `opa-fmt` rule:
|
||||
|
||||
```yaml
|
||||
rules:
|
||||
style:
|
||||
todo-comment:
|
||||
# don't report on todo comments
|
||||
level: ignore
|
||||
line-length:
|
||||
# custom rule configuration
|
||||
max-line-length: 100
|
||||
# warn on too long lines, but don't fail
|
||||
level: warning
|
||||
opa-fmt:
|
||||
# not needed as error is the default, but
|
||||
# being explicit won't hurt
|
||||
level: error
|
||||
# files can be ignored for any individual rule
|
||||
# in this example, test files are ignored
|
||||
ignore:
|
||||
files:
|
||||
- "*_test.rego"
|
||||
```
|
||||
|
||||
Read Regal's [configuration documentation](https://docs.styra.com/regal#configuration) for more information.
|
||||
19
docs/src/languages/roc.md
Normal file
19
docs/src/languages/roc.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Roc
|
||||
description: "Configure Roc language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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.
|
||||
12
docs/src/languages/rst.md
Normal file
12
docs/src/languages/rst.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: reStructuredText
|
||||
description: "Configure reStructuredText language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
424
docs/src/languages/ruby.md
Normal file
424
docs/src/languages/ruby.md
Normal file
@@ -0,0 +1,424 @@
|
||||
---
|
||||
title: Ruby
|
||||
description: "Configure Ruby language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Ruby
|
||||
|
||||
Ruby support is available through the [Ruby extension](https://github.com/zed-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)
|
||||
- [Herb](https://herb-tools.dev)
|
||||
- Debug Adapter: [`rdbg`](https://github.com/ruby/debug)
|
||||
|
||||
The Ruby extension also provides support for ERB files.
|
||||
|
||||
## Language Servers
|
||||
|
||||
There are multiple language servers available for Ruby. Zed supports the two following:
|
||||
|
||||
- [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.
|
||||
- [sorbet](https://sorbet.org/) which is a static type checker for Ruby with a custom gradual type system.
|
||||
- [steep](https://github.com/soutaro/steep) which is a static type checker for Ruby that uses Ruby Signature (RBS).
|
||||
- [Herb](https://herb-tools.dev) which is a language server for ERB files.
|
||||
|
||||
When configuring a language server, it helps to open the LSP Logs window using the 'dev: Open Language Server Logs' command. You can then choose the corresponding language instance to see any logged information.
|
||||
|
||||
## Configuring a language server
|
||||
|
||||
The [Ruby extension](https://github.com/zed-extensions/ruby) offers both `solargraph` and `ruby-lsp` language server support.
|
||||
|
||||
### Language Server Activation
|
||||
|
||||
For all supported Ruby language servers (`solargraph`, `ruby-lsp`, `rubocop`, `sorbet`, and `steep`), the Ruby extension follows this activation sequence:
|
||||
|
||||
1. If the language server is found in your project's `Gemfile`, it will be used through `bundle exec`.
|
||||
2. If not found in the `Gemfile`, the Ruby extension will look for the executable in your system `PATH`.
|
||||
3. If the language server is not found in either location, the Ruby extension will automatically install it as a global gem (note: this will not install to your current Ruby gemset).
|
||||
|
||||
You can skip step 1 and force using the system executable by setting `use_bundler` to `false` in your settings:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"<SERVER_NAME>": {
|
||||
"settings": {
|
||||
"use_bundler": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Using `solargraph`
|
||||
|
||||
`solargraph` is enabled by default in the Ruby extension.
|
||||
|
||||
### Using `ruby-lsp`
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > Ruby, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Ruby": {
|
||||
"language_servers": ["ruby-lsp", "!solargraph", "!rubocop", "..."]
|
||||
},
|
||||
// Enable herb and ruby-lsp for *.html.erb files
|
||||
"HTML+ERB": {
|
||||
"language_servers": ["herb", "ruby-lsp", "..."]
|
||||
},
|
||||
// Enable ruby-lsp for *.js.erb files
|
||||
"JS+ERB": {
|
||||
"language_servers": ["ruby-lsp", "..."]
|
||||
},
|
||||
// Enable ruby-lsp for *.yaml.erb files
|
||||
"YAML+ERB": {
|
||||
"language_servers": ["ruby-lsp", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
That disables `solargraph` and `rubocop` and uses `ruby-lsp`.
|
||||
|
||||
### Using `rubocop`
|
||||
|
||||
The Ruby extension also provides support for `rubocop` language server for offense detection and autocorrection.
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > Ruby, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Ruby": {
|
||||
"language_servers": ["ruby-lsp", "rubocop", "!solargraph", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or, conversely, you can disable `ruby-lsp` and enable `solargraph` and `rubocop`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Ruby": {
|
||||
"language_servers": ["solargraph", "rubocop", "!ruby-lsp", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Setting up `solargraph`
|
||||
|
||||
Solargraph has formatting and diagnostics disabled by default. We can tell Zed to enable them by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"solargraph": {
|
||||
"initialization_options": {
|
||||
"diagnostics": true,
|
||||
"formatting": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
Solargraph reads its configuration from a file called `.solargraph.yml` in the root of your project. For more information about this file, see the [Solargraph configuration documentation](https://solargraph.org/guides/configuration).
|
||||
|
||||
## Setting up `ruby-lsp`
|
||||
|
||||
You can pass Ruby LSP configuration to `initialization_options`, e.g.
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Ruby": {
|
||||
"language_servers": ["ruby-lsp", "!solargraph", "..."]
|
||||
}
|
||||
},
|
||||
"lsp": {
|
||||
"ruby-lsp": {
|
||||
"initialization_options": {
|
||||
"enabledFeatures": {
|
||||
// "someFeature": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For full configuration options, see the [Ruby LSP website](https://shopify.github.io/ruby-lsp/editors.html).
|
||||
|
||||
LSP `settings` and `initialization_options` can also be project-specific. For example to use [standardrb/standard](https://github.com/standardrb/standard) as a formatter and linter for a particular project, add this to a `.zed/settings.json` inside your project repo:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"ruby-lsp": {
|
||||
"initialization_options": {
|
||||
"formatter": "standard",
|
||||
"linters": ["standard"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Setting up `rubocop` LSP
|
||||
|
||||
Rubocop has unsafe autocorrection disabled by default. We can tell Zed to enable it by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Ruby": {
|
||||
// Use ruby-lsp as the primary language server and rubocop as the secondary.
|
||||
"language_servers": ["ruby-lsp", "rubocop", "!solargraph", "..."]
|
||||
}
|
||||
},
|
||||
"lsp": {
|
||||
"rubocop": {
|
||||
"initialization_options": {
|
||||
"safeAutocorrect": false
|
||||
}
|
||||
},
|
||||
"ruby-lsp": {
|
||||
"initialization_options": {
|
||||
"enabledFeatures": {
|
||||
"diagnostics": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Setting up Sorbet
|
||||
|
||||
[Sorbet](https://sorbet.org/) is a popular static type checker for Ruby that includes a language server.
|
||||
|
||||
To enable Sorbet, add `\"sorbet\"` to the `language_servers` list for Ruby. You may want to disable other language servers if Sorbet is intended to be your primary LSP, or if you plan to use it alongside another LSP for specific features like type checking.
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > Ruby, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Ruby": {
|
||||
"language_servers": [
|
||||
"ruby-lsp",
|
||||
"sorbet",
|
||||
"!rubocop",
|
||||
"!solargraph",
|
||||
"..."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For all aspects of installing Sorbet, setting it up in your project, and configuring its behavior, please refer to the [official Sorbet documentation](https://sorbet.org/docs/overview).
|
||||
|
||||
## Setting up Steep
|
||||
|
||||
[Steep](https://github.com/soutaro/steep) is a static type checker for Ruby that uses RBS files to define types.
|
||||
|
||||
To enable Steep, add `\"steep\"` to the `language_servers` list for Ruby. You may need to adjust the order or disable other LSPs depending on your desired setup.
|
||||
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > Ruby, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"Ruby": {
|
||||
"language_servers": [
|
||||
"ruby-lsp",
|
||||
"steep",
|
||||
"!solargraph",
|
||||
"!rubocop",
|
||||
"..."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Setting up Herb
|
||||
|
||||
`Herb` is enabled by default for the `HTML+ERB` language.
|
||||
|
||||
## Using the Tailwind CSS Language Server with Ruby
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in Ruby/ERB files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"experimental": {
|
||||
"classRegex": ["\\bclass:\\s*['\"]([^'\"]*)['\"]"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With these settings, you will get completions for Tailwind CSS classes in HTML attributes inside ERB files and inside Ruby/ERB strings that are coming after a `class:` key. Examples:
|
||||
|
||||
```rb
|
||||
# Ruby file:
|
||||
def method
|
||||
div(class: "pl-2 <completion here>") do
|
||||
p(class: "mt-2 <completion here>") { "Hello World" }
|
||||
end
|
||||
end
|
||||
|
||||
# ERB file:
|
||||
<%= link_to "Hello", "/hello", class: "pl-2 <completion here>" %>
|
||||
<a href="/hello" class="pl-2 <completion here>">Hello</a>
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
To run tests in your Ruby project, you can set up custom tasks in your local `.zed/tasks.json` configuration file. These tasks can be defined to work with different test frameworks like Minitest, RSpec, quickdraw, and tldr. Below are some examples of how to set up these tasks to run your tests from within your editor.
|
||||
|
||||
### Minitest with Rails
|
||||
|
||||
```json [tasks]
|
||||
[
|
||||
{
|
||||
"label": "test $ZED_RELATIVE_FILE -n /$ZED_CUSTOM_RUBY_TEST_NAME/",
|
||||
"command": "bin/rails",
|
||||
"args": [
|
||||
"test",
|
||||
"$ZED_RELATIVE_FILE",
|
||||
"-n",
|
||||
"\"$ZED_CUSTOM_RUBY_TEST_NAME\""
|
||||
],
|
||||
"cwd": "$ZED_WORKTREE_ROOT",
|
||||
"tags": ["ruby-test"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Minitest
|
||||
|
||||
Plain minitest does not support running tests by line number, only by name, so we need to use `$ZED_CUSTOM_RUBY_TEST_NAME` instead:
|
||||
|
||||
```json [tasks]
|
||||
[
|
||||
{
|
||||
"label": "-Itest $ZED_RELATIVE_FILE -n /$ZED_CUSTOM_RUBY_TEST_NAME/",
|
||||
"command": "bundle",
|
||||
"args": [
|
||||
"exec",
|
||||
"ruby",
|
||||
"-Itest",
|
||||
"$ZED_RELATIVE_FILE",
|
||||
"-n",
|
||||
"\"$ZED_CUSTOM_RUBY_TEST_NAME\""
|
||||
],
|
||||
"cwd": "$ZED_WORKTREE_ROOT",
|
||||
"tags": ["ruby-test"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### RSpec
|
||||
|
||||
```json [tasks]
|
||||
[
|
||||
{
|
||||
"label": "test $ZED_RELATIVE_FILE:$ZED_ROW",
|
||||
"command": "bundle",
|
||||
"args": ["exec", "rspec", "\"$ZED_RELATIVE_FILE:$ZED_ROW\""],
|
||||
"cwd": "$ZED_WORKTREE_ROOT",
|
||||
"tags": ["ruby-test"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
Similar task syntax can be used for other test frameworks such as `quickdraw` or `tldr`.
|
||||
|
||||
## Debugging
|
||||
|
||||
The Ruby extension provides a debug adapter for debugging Ruby code. Zed's name for the adapter (in the UI and `debug.json`) is `rdbg`, and under the hood, it uses the [`debug`](https://github.com/ruby/debug) gem. The extension uses the [same activation logic](#language-server-activation) as the language servers.
|
||||
|
||||
### Examples
|
||||
|
||||
#### Debug a Ruby script
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Debug current file",
|
||||
"adapter": "rdbg",
|
||||
"request": "launch",
|
||||
"script": "$ZED_FILE",
|
||||
"cwd": "$ZED_WORKTREE_ROOT"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### Debug Rails server
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Debug Rails server",
|
||||
"adapter": "rdbg",
|
||||
"request": "launch",
|
||||
"command": "./bin/rails",
|
||||
"args": ["server"],
|
||||
"cwd": "$ZED_WORKTREE_ROOT",
|
||||
"env": {
|
||||
"RUBY_DEBUG_OPEN": "true"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Formatters
|
||||
|
||||
### `erb-formatter`
|
||||
|
||||
To format ERB templates, you can use the `erb-formatter` formatter. This formatter uses the [`erb-formatter`](https://rubygems.org/gems/erb-formatter) gem to format ERB templates.
|
||||
|
||||
Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > HTML+ERB, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"HTML+ERB": {
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "erb-formatter",
|
||||
"arguments": ["--stdin-filename", "{buffer_path}"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
345
docs/src/languages/rust.md
Normal file
345
docs/src/languages/rust.md
Normal file
@@ -0,0 +1,345 @@
|
||||
---
|
||||
title: Rust
|
||||
description: "Configure Rust language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Rust
|
||||
|
||||
Rust support is available natively in Zed.
|
||||
|
||||
- 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)
|
||||
- Debug Adapter: [CodeLLDB](https://github.com/vadimcn/codelldb) (primary), [GDB](https://sourceware.org/gdb/) (secondary, not available on Apple silicon)
|
||||
|
||||
<!--
|
||||
TBD: Polish Rust docs. Zed has strong Rust support, and the docs should reflect that clearly.
|
||||
TBD: Users may not know what inlayHints, don't start there.
|
||||
TBD: Provide explicit examples not just `....`
|
||||
-->
|
||||
|
||||
## Inlay Hints
|
||||
|
||||
The following configuration can be used to change the inlay hint settings for `rust-analyzer` in Rust:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
"inlayHints": {
|
||||
"maxLength": null,
|
||||
"lifetimeElisionHints": {
|
||||
"enable": "skip_trivial",
|
||||
"useParameterNames": true
|
||||
},
|
||||
"closureReturnTypeHints": {
|
||||
"enable": "always"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See [Inlay Hints](https://rust-analyzer.github.io/book/features.html#inlay-hints) in the Rust Analyzer Manual for more information.
|
||||
|
||||
## Target directory
|
||||
|
||||
The `rust-analyzer` target directory can be set in `initialization_options`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
"rust": {
|
||||
"analyzerTargetDir": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
By default, Zed will try to find a `rust-analyzer` in your `$PATH` and try to use that. If that binary successfully executes `rust-analyzer --help`, it's used. Otherwise, Zed will fall back to installing its own stable `rust-analyzer` version and use that.
|
||||
|
||||
If you want to install pre-release `rust-analyzer` version instead you can instruct Zed to do so by setting `pre_release` to `true` in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"fetch": {
|
||||
"pre_release": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you want to disable Zed looking for a `rust-analyzer` binary, you can set `ignore_system_version` to `true` in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"binary": {
|
||||
"ignore_system_version": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you want to use a binary in a custom location, you can specify a `path` and optional `arguments`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"binary": {
|
||||
"path": "/Users/example/bin/rust-analyzer",
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This `"path"` has to be an absolute path.
|
||||
|
||||
## Alternate Targets
|
||||
|
||||
If you want rust-analyzer to provide diagnostics for a target other than your current platform (e.g. for windows when running on macOS) you can use the following Zed lsp settings:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
"cargo": {
|
||||
"target": "x86_64-pc-windows-msvc"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you are using `rustup`, you can find a list of available target triples (`aarch64-apple-darwin`, `x86_64-unknown-linux-gnu`, etc) by running:
|
||||
|
||||
```sh
|
||||
rustup target list --installed
|
||||
```
|
||||
|
||||
## LSP tasks
|
||||
|
||||
Zed provides tasks using tree-sitter, but rust-analyzer has an LSP extension method for querying file-related tasks via LSP.
|
||||
This is enabled by default and can be configured as
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"enable_lsp_tasks": true,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Manual Cargo Diagnostics fetch
|
||||
|
||||
By default, rust-analyzer has `checkOnSave: true` enabled, which causes every buffer save to trigger a `cargo check --workspace --all-targets` command.
|
||||
If disabled with `checkOnSave: false` (see the example of the server configuration json above), it's still possible to fetch the diagnostics manually, with the `editor: run/clear/cancel flycheck` commands in Rust files to refresh cargo diagnostics; the project diagnostics editor will also refresh cargo diagnostics with {#action editor::RunFlycheck} command when the setting is enabled.
|
||||
|
||||
## More server configuration
|
||||
|
||||
<!--
|
||||
TBD: Is it possible to specify RUSTFLAGS? https://github.com/zed-industries/zed/issues/14334
|
||||
-->
|
||||
|
||||
Rust-analyzer [manual](https://rust-analyzer.github.io/book/) describes various features and configuration options for rust-analyzer language server.
|
||||
Rust-analyzer in Zed runs with the default parameters.
|
||||
|
||||
### Large projects and performance
|
||||
|
||||
One of the main caveats that might cause extensive resource usage on large projects, is the combination of the following features:
|
||||
|
||||
```
|
||||
rust-analyzer.checkOnSave (default: true)
|
||||
Run the check command for diagnostics on save.
|
||||
```
|
||||
|
||||
```
|
||||
rust-analyzer.check.workspace (default: true)
|
||||
Whether --workspace should be passed to cargo check. If false, -p <package> will be passed instead.
|
||||
```
|
||||
|
||||
```
|
||||
rust-analyzer.cargo.allTargets (default: true)
|
||||
Pass --all-targets to cargo invocation
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
The alternatives would be to use [tasks](../tasks.md), as Zed already provides a `cargo check --workspace --all-targets` task and the ability to cmd/ctrl-click on the terminal output to navigate to the error, and limit or turn off the check on save feature entirely.
|
||||
|
||||
Check on save feature is responsible for returning part of the diagnostics based on cargo check output, so turning it off will limit rust-analyzer with its own [diagnostics](https://rust-analyzer.github.io/book/diagnostics.html).
|
||||
|
||||
Consider more `rust-analyzer.cargo.` and `rust-analyzer.check.` and `rust-analyzer.diagnostics.` settings from the manual for more fine-grained configuration.
|
||||
Here's a snippet for Zed settings.json (the language server will restart automatically after the `lsp.rust-analyzer` section is edited and saved):
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
// get more cargo-less diagnostics from rust-analyzer,
|
||||
// which might include false-positives (those can be turned off by their names)
|
||||
"diagnostics": {
|
||||
"experimental": {
|
||||
"enable": true
|
||||
}
|
||||
},
|
||||
// To disable the checking entirely
|
||||
// (ignores all cargo and check settings below)
|
||||
"checkOnSave": false,
|
||||
// To check the `lib` target only.
|
||||
"cargo": {
|
||||
"allTargets": false
|
||||
},
|
||||
// Use `-p` instead of `--workspace` for cargo check
|
||||
"check": {
|
||||
"workspace": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Multi-project workspaces
|
||||
|
||||
If you want rust-analyzer to analyze multiple Rust projects in the same folder that are not listed in `[members]` in the Cargo workspace,
|
||||
you can list them in `linkedProjects` in the local project settings:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
"linkedProjects": ["./path/to/a/Cargo.toml", "./path/to/b/Cargo.toml"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Snippets
|
||||
|
||||
There's a way to get custom completion items from rust-analyzer, that will transform the code according to the snippet body:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
"completion": {
|
||||
"snippets": {
|
||||
"custom": {
|
||||
"Arc::new": {
|
||||
"postfix": "arc",
|
||||
"body": ["Arc::new(${receiver})"],
|
||||
"requires": "std::sync::Arc",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Some": {
|
||||
"postfix": "some",
|
||||
"body": ["Some(${receiver})"],
|
||||
"scope": "expr"
|
||||
},
|
||||
"Ok": {
|
||||
"postfix": "ok",
|
||||
"body": ["Ok(${receiver})"],
|
||||
"scope": "expr"
|
||||
},
|
||||
"Rc::new": {
|
||||
"postfix": "rc",
|
||||
"body": ["Rc::new(${receiver})"],
|
||||
"requires": "std::rc::Rc",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Box::pin": {
|
||||
"postfix": "boxpin",
|
||||
"body": ["Box::pin(${receiver})"],
|
||||
"requires": "std::boxed::Box",
|
||||
"scope": "expr"
|
||||
},
|
||||
"vec!": {
|
||||
"postfix": "vec",
|
||||
"body": ["vec![${receiver}]"],
|
||||
"description": "vec![]",
|
||||
"scope": "expr"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Zed supports debugging Rust binaries and tests out of the box with `CodeLLDB` and `GDB`. Run {#action debugger::Start} ({#kb debugger::Start}) to launch one of these preconfigured debug tasks.
|
||||
|
||||
For more control, you can add debug configurations to `.zed/debug.json`. See the examples below.
|
||||
|
||||
- [CodeLLDB configuration documentation](https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#starting-a-new-debug-session)
|
||||
- [GDB configuration documentation](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Debugger-Adapter-Protocol.html)
|
||||
|
||||
### Build binary then debug
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Build & Debug native binary",
|
||||
"build": {
|
||||
"command": "cargo",
|
||||
"args": ["build"]
|
||||
},
|
||||
"program": "$ZED_WORKTREE_ROOT/target/debug/binary",
|
||||
// sourceLanguages is required for CodeLLDB (not GDB) when using Rust
|
||||
"sourceLanguages": ["rust"],
|
||||
"request": "launch",
|
||||
"adapter": "CodeLLDB"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Automatically locate a debug target based on build command
|
||||
|
||||
When you use `cargo build` or `cargo test` as the build command, Zed can infer the path to the output binary.
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Build & Debug native binary",
|
||||
"adapter": "CodeLLDB",
|
||||
"build": {
|
||||
"command": "cargo",
|
||||
"args": ["build"]
|
||||
},
|
||||
// sourceLanguages is required for CodeLLDB (not GDB) when using Rust
|
||||
"sourceLanguages": ["rust"]
|
||||
}
|
||||
]
|
||||
```
|
||||
34
docs/src/languages/scala.md
Normal file
34
docs/src/languages/scala.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: Scala
|
||||
description: "Configure Scala language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
<!--
|
||||
TBD: Provide LSP configuration example for metals in Zed settings.json. metals.{javaHome,excludedPackages,customProjectRoot} etc.
|
||||
-->
|
||||
10
docs/src/languages/scheme.md
Normal file
10
docs/src/languages/scheme.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Scheme
|
||||
description: "Configure Scheme language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Scheme
|
||||
|
||||
Scheme support is available through the [Scheme extension](https://github.com/zed-extensions/scheme).
|
||||
|
||||
- Tree-sitter: [6cdh/tree-sitter-scheme](https://github.com/6cdh/tree-sitter-scheme)
|
||||
67
docs/src/languages/sh.md
Normal file
67
docs/src/languages/sh.md
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: Shell Script
|
||||
description: "Configure Shell Script language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Shell Scripts
|
||||
|
||||
Shell Scripts (bash, zsh, dash, sh) are supported natively by Zed.
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash)
|
||||
|
||||
## Settings
|
||||
|
||||
Configure settings in Settings ({#kb zed::OpenSettings}) under Languages > Shell Script, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Shell Script": {
|
||||
"tab_size": 2,
|
||||
"hard_tabs": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Formatting
|
||||
|
||||
Zed supports auto-formatting Shell Scripts using external tools like [`shfmt`](https://github.com/mvdan/sh).
|
||||
|
||||
1. Install `shfmt`:
|
||||
|
||||
```sh
|
||||
brew install shfmt # macos (homebrew)
|
||||
sudo apt-get install shfmt # debian/ubuntu
|
||||
dnf install shfmt # fedora
|
||||
yum install shfmt # redhat
|
||||
pacman -Sy shfmt # archlinux
|
||||
choco install shfmt # windows (chocolatey)
|
||||
```
|
||||
|
||||
2. Ensure `shfmt` is available in your path and check the version:
|
||||
|
||||
```sh
|
||||
which shfmt
|
||||
shfmt --version
|
||||
```
|
||||
|
||||
3. Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Shell Script, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Shell Script": {
|
||||
"format_on_save": "on",
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "shfmt",
|
||||
// Change `--indent 2` to match your preferred tab_size
|
||||
"arguments": ["--filename", "{buffer_path}", "--indent", "2"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## See also:
|
||||
|
||||
- [Zed Docs: Language Support: Bash](./bash.md)
|
||||
- [Zed Docs: Language Support: Fish](./fish.md)
|
||||
28
docs/src/languages/sml.md
Normal file
28
docs/src/languages/sml.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Standard ML
|
||||
description: "Configure Standard ML language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Standard ML
|
||||
|
||||
Standard ML support is available through the community-maintained [Standard ML extension](https://github.com/omarjatoi/zed-sml).
|
||||
|
||||
- Tree-sitter: [MatthewFluet/tree-sitter-sml](https://github.com/MatthewFluet/tree-sitter-sml)
|
||||
- Language Server: [Millet](https://github.com/azdavis/millet)
|
||||
|
||||
## Setup
|
||||
|
||||
1. Install a Standard ML implementation such as [SML/NJ](https://www.smlnj.org/) or [MLton](http://mlton.org/) to compile and run your code.
|
||||
2. [Install Millet](https://github.com/azdavis/millet#install) and ensure `millet-ls` is on your `$PATH`.
|
||||
|
||||
## Project setup
|
||||
|
||||
For projects with more than one source file, Millet expects a single root group file. Create a `millet.toml` in the directory you open in Zed:
|
||||
|
||||
```toml
|
||||
version = 1
|
||||
[workspace]
|
||||
root = "sources.mlb"
|
||||
```
|
||||
|
||||
The root must be either a [ML Basis (MLB)](http://mlton.org/MLBasis) file (`.mlb`, used with MLton) or a [SML/NJ Compilation Manager (CM)](https://www.smlnj.org/doc/CM/new.pdf) file (`.cm`, used with SML/NJ). Files not transitively reachable from the root are not analyzed. See the [Millet manual](https://github.com/azdavis/millet/blob/main/docs/manual.md) for more options.
|
||||
75
docs/src/languages/sql.md
Normal file
75
docs/src/languages/sql.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
title: SQL
|
||||
description: "Configure SQL language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# SQL
|
||||
|
||||
SQL files are handled by the [SQL Extension](https://github.com/zed-extensions/sql).
|
||||
|
||||
- Tree-sitter: [nervenes/tree-sitter-sql](https://github.com/nervenes/tree-sitter-sql)
|
||||
|
||||
### Formatting
|
||||
|
||||
Zed supports auto-formatting SQL using external tools like [`sql-formatter`](https://github.com/sql-formatter-org/sql-formatter).
|
||||
|
||||
1. Install `sql-formatter`:
|
||||
|
||||
```sh
|
||||
npm install -g sql-formatter
|
||||
```
|
||||
|
||||
2. Ensure `sql-formatter` is available in your path and check the version:
|
||||
|
||||
```sh
|
||||
which sql-formatter
|
||||
sql-formatter --version
|
||||
```
|
||||
|
||||
3. Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > SQL, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"SQL": {
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "sql-formatter",
|
||||
"arguments": ["--language", "mysql"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
Substitute your preferred [SQL Dialect] for `mysql` above (`duckdb`, `hive`, `mariadb`, `postgresql`, `redshift`, `snowflake`, `sqlite`, `spark`, etc).
|
||||
|
||||
You can add this to Zed project settings (`.zed/settings.json`) or via your Zed user settings (`~/.config/zed/settings.json`).
|
||||
|
||||
### Advanced Formatting
|
||||
|
||||
Sql-formatter also allows more precise control by providing [sql-formatter configuration options](https://github.com/sql-formatter-org/sql-formatter#configuration-options). To provide these, create a `.sql-formatter.json` file in your project:
|
||||
|
||||
```json
|
||||
{
|
||||
"language": "postgresql",
|
||||
"tabWidth": 2,
|
||||
"keywordCase": "upper",
|
||||
"linesBetweenQueries": 2
|
||||
}
|
||||
```
|
||||
|
||||
When using a `.sql-formatter.json` file you can use a simplified Zed settings configuration:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"SQL": {
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "sql-formatter"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
122
docs/src/languages/svelte.md
Normal file
122
docs/src/languages/svelte.md
Normal file
@@ -0,0 +1,122 @@
|
||||
---
|
||||
title: Svelte
|
||||
description: "Configure Svelte language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Svelte
|
||||
|
||||
Svelte support is available through the [Svelte extension](https://github.com/zed-extensions/svelte).
|
||||
|
||||
- Tree-sitter: [tree-sitter-grammars/tree-sitter-svelte](https://github.com/tree-sitter-grammars/tree-sitter-svelte)
|
||||
- Language Server: [sveltejs/language-tools](https://github.com/sveltejs/language-tools)
|
||||
|
||||
## Extra theme styling configuration
|
||||
|
||||
You can modify how certain styles, such as directives and modifiers, appear in attributes:
|
||||
|
||||
```json
|
||||
"syntax": {
|
||||
// Styling for directives (e.g., `class:foo` or `on:click`) (the `on` or `class` part of the attribute).
|
||||
"attribute.function": {
|
||||
"color": "#ff0000"
|
||||
},
|
||||
// Styling for modifiers at the end of attributes, e.g. `on:<click|preventDefault|stopPropagation>`
|
||||
"attribute.special": {
|
||||
"color": "#00ff00"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Inlay Hints
|
||||
|
||||
When inlay hints is enabled in Zed, to make the language server send them back, Zed sets the following initialization options:
|
||||
|
||||
```json
|
||||
"inlayHints": {
|
||||
"parameterNames": {
|
||||
"enabled": "all",
|
||||
"suppressWhenArgumentMatchesName": false
|
||||
},
|
||||
"parameterTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"variableTypes": {
|
||||
"enabled": true,
|
||||
"suppressWhenTypeMatchesName": false
|
||||
},
|
||||
"propertyDeclarationTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"functionLikeReturnTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"enumMemberValues": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To override these settings, use the following:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"svelte-language-server": {
|
||||
"initialization_options": {
|
||||
"configuration": {
|
||||
"typescript": {
|
||||
// ......
|
||||
},
|
||||
"javascript": {
|
||||
// ......
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See [the TypeScript language server `package.json`](https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/package.json) for more information.
|
||||
|
||||
## Using the Tailwind CSS Language Server with Svelte
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in Svelte files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"includeLanguages": {
|
||||
"svelte": "html"
|
||||
},
|
||||
"experimental": {
|
||||
"classRegex": [
|
||||
"class=\"([^\"]*)\"",
|
||||
"class='([^']*)'",
|
||||
"class:\\s*([^\\s{]+)",
|
||||
"\\{\\s*class:\\s*\"([^\"]*)\"",
|
||||
"\\{\\s*class:\\s*'([^']*)'"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With these settings, you will get completions for Tailwind CSS classes in Svelte files. Examples:
|
||||
|
||||
```svelte
|
||||
<!-- Standard class attribute -->
|
||||
<div class="flex items-center <completion here>">
|
||||
<p class="text-lg font-bold <completion here>">Hello World</p>
|
||||
</div>
|
||||
|
||||
<!-- Class directive -->
|
||||
<button class:active="bg-blue-500 <completion here>">Click me</button>
|
||||
|
||||
<!-- Expression -->
|
||||
<div class={active ? "flex <completion here>" : "hidden <completion here>"}>
|
||||
Content
|
||||
</div>
|
||||
```
|
||||
45
docs/src/languages/swift.md
Normal file
45
docs/src/languages/swift.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Swift
|
||||
description: "Configure Swift language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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)
|
||||
- Debug Adapter: [`lldb-dap`](https://github.com/swiftlang/llvm-project/blob/next/lldb/tools/lldb-dap/README.md)
|
||||
|
||||
## Language Server Configuration
|
||||
|
||||
You can modify the behavior of SourceKit LSP by creating a `.sourcekit-lsp/config.json` under your home directory or in your project root. See [SourceKit-LSP configuration file](https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Configuration%20File.md) for complete documentation.
|
||||
|
||||
## Debugging
|
||||
|
||||
The Swift extension provides a debug adapter for debugging Swift code.
|
||||
Zed's name for the adapter (in the UI and `debug.json`) is `Swift`, and under the hood it uses [`lldb-dap`](https://github.com/swiftlang/llvm-project/blob/next/lldb/tools/lldb-dap/README.md), as provided by the Swift toolchain.
|
||||
The extension tries to find an `lldb-dap` binary using `swiftly`, using `xcrun`, and by searching `$PATH`, in that order of preference.
|
||||
The extension doesn't attempt to download `lldb-dap` if it's not found.
|
||||
|
||||
- [lldb-dap configuration documentation](https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/README.md#configuration-settings-reference)
|
||||
|
||||
### Examples
|
||||
|
||||
#### Build and debug a Swift binary
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Debug Swift",
|
||||
"build": {
|
||||
"command": "swift",
|
||||
"args": ["build"]
|
||||
},
|
||||
"program": "$ZED_WORKTREE_ROOT/swift-app/.build/arm64-apple-macosx/debug/swift-app",
|
||||
"request": "launch",
|
||||
"adapter": "Swift"
|
||||
}
|
||||
]
|
||||
```
|
||||
77
docs/src/languages/tailwindcss.md
Normal file
77
docs/src/languages/tailwindcss.md
Normal file
@@ -0,0 +1,77 @@
|
||||
---
|
||||
title: Tailwind CSS
|
||||
description: "Configure Tailwind CSS language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Tailwind CSS
|
||||
|
||||
Zed has built-in support for Tailwind CSS autocomplete, linting, and hover previews.
|
||||
|
||||
- Language Server: [tailwindlabs/tailwindcss-intellisense](https://github.com/tailwindlabs/tailwindcss-intellisense)
|
||||
|
||||
Languages which can be used with Tailwind CSS in Zed:
|
||||
|
||||
- [Astro](./astro.md#using-the-tailwind-css-language-server-with-astro)
|
||||
- [CSS](./css.md)
|
||||
- [ERB](./ruby.md#using-the-tailwind-css-language-server-with-ruby)
|
||||
- [Gleam](./gleam.md)
|
||||
- [HEEx](./elixir.md#using-the-tailwind-css-language-server-with-heex-templates)
|
||||
- [HTML](./html.md#using-the-tailwind-css-language-server-with-html)
|
||||
- [TypeScript](./typescript.md#using-the-tailwind-css-language-server-with-typescript)
|
||||
- [JavaScript](./javascript.md#using-the-tailwind-css-language-server-with-javascript)
|
||||
- [PHP](./php.md#using-the-tailwind-css-language-server-with-php)
|
||||
- [Svelte](./svelte.md#using-the-tailwind-css-language-server-with-svelte)
|
||||
- [Vue](./vue.md#using-the-tailwind-css-language-server-with-vue)
|
||||
|
||||
## Configuration
|
||||
|
||||
If by default the language server isn't enough to make Tailwind work for a given language, you can configure the language server settings and add them to the `lsp` section of your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"classFunctions": ["cva", "cx"],
|
||||
"experimental": {
|
||||
"classRegex": ["[cls|className]\\s\\:\\=\\s\"([^\"]*)"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Refer to [the Tailwind CSS language server settings docs](https://github.com/tailwindlabs/tailwindcss-intellisense?tab=readme-ov-file#extension-settings) for more information.
|
||||
|
||||
### Using Tailwind CSS Mode in CSS Files
|
||||
|
||||
Zed includes support for the Tailwind CSS language mode, which provides full CSS IntelliSense support even when using Tailwind-specific at-rules like `@apply`, `@layer`, and `@theme`.
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > CSS, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"CSS": {
|
||||
"language_servers": [
|
||||
"tailwindcss-intellisense-css",
|
||||
"!vscode-css-language-server",
|
||||
"..."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `tailwindcss-intellisense-css` language server serves as an alternative to the default CSS language server, maintaining all standard CSS IntelliSense features while adding support for Tailwind-specific syntax.
|
||||
|
||||
### Prettier Plugin
|
||||
|
||||
Zed supports Prettier out of the box, which means that if you have the [Tailwind CSS Prettier plugin](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) installed, adding it to your Prettier configuration will make it work automatically:
|
||||
|
||||
```json
|
||||
// .prettierrc
|
||||
{
|
||||
"plugins": ["prettier-plugin-tailwindcss"]
|
||||
}
|
||||
```
|
||||
35
docs/src/languages/terraform.md
Normal file
35
docs/src/languages/terraform.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: Terraform
|
||||
description: "Configure Terraform language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Terraform
|
||||
|
||||
Terraform support is available through the [Terraform extension](https://github.com/zed-extensions/terraform).
|
||||
|
||||
- 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
|
||||
|
||||
<!--
|
||||
TBD: Add example using `rootModulePaths` to match upstream example https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md#vs-code
|
||||
-->
|
||||
|
||||
The Terraform language server can be configured in your `settings.json`, e.g.:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"terraform-ls": {
|
||||
"initialization_options": {
|
||||
"experimentalFeatures": {
|
||||
"prefillRequiredFields": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See the [full list of server settings here](https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md).
|
||||
12
docs/src/languages/toml.md
Normal file
12
docs/src/languages/toml.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: TOML
|
||||
description: "Configure TOML language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# TOML
|
||||
|
||||
TOML support is available through the [TOML extension](https://zed.dev/extensions/toml).
|
||||
|
||||
- Tree-sitter: [tree-sitter/tree-sitter-toml](https://github.com/tree-sitter/tree-sitter-toml)
|
||||
|
||||
A TOML language server is available in the [Tombi extension](https://zed.dev/extensions/tombi).
|
||||
287
docs/src/languages/typescript.md
Normal file
287
docs/src/languages/typescript.md
Normal file
@@ -0,0 +1,287 @@
|
||||
---
|
||||
title: TypeScript
|
||||
description: "Configure TypeScript language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# TypeScript
|
||||
|
||||
TypeScript and TSX support are available natively in Zed.
|
||||
|
||||
- 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)
|
||||
- Debug Adapter: [vscode-js-debug](https://github.com/microsoft/vscode-js-debug)
|
||||
|
||||
<!--
|
||||
TBD: Document the difference between Language servers
|
||||
-->
|
||||
|
||||
## Language servers
|
||||
|
||||
By default Zed uses [vtsls](https://github.com/yioneko/vtsls) for TypeScript, TSX, and JavaScript files.
|
||||
Configure language servers in Settings ({#kb zed::OpenSettings}) under Languages > TypeScript/TSX/JavaScript, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"TypeScript": {
|
||||
"language_servers": ["typescript-language-server", "!vtsls", "..."]
|
||||
},
|
||||
"TSX": {
|
||||
"language_servers": ["typescript-language-server", "!vtsls", "..."]
|
||||
},
|
||||
"JavaScript": {
|
||||
"language_servers": ["typescript-language-server", "!vtsls", "..."]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Prettier will also be used for TypeScript files by default. To disable this, configure in Settings ({#kb zed::OpenSettings}) under Languages > TypeScript, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"languages": {
|
||||
"TypeScript": {
|
||||
"prettier": { "allowed": false }
|
||||
}
|
||||
//...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Using the Tailwind CSS Language Server with TypeScript
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in vanilla TypeScript files (`.ts`), you can customize the `classRegex` field under it in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"experimental": {
|
||||
"classRegex": [
|
||||
"\\.className\\s*[+]?=\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.setAttributeNS\\(.*,\\s*['\"]class['\"],\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.setAttribute\\(['\"]class['\"],\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.add\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.remove\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.toggle\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.contains\\(['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.replace\\(\\s*['\"]([^'\"]*)['\"]",
|
||||
"\\.classList\\.replace\\([^,)]+,\\s*['\"]([^'\"]*)['\"]"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Large projects
|
||||
|
||||
`vtsls` may run out of memory on very large projects. We default the limit to 8092 (8 GiB) vs. the default of 3072 but this may not be sufficient for you:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"vtsls": {
|
||||
"settings": {
|
||||
// For TypeScript:
|
||||
"typescript": { "tsserver": { "maxTsServerMemory": 16184 } },
|
||||
// For JavaScript:
|
||||
"javascript": { "tsserver": { "maxTsServerMemory": 16184 } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Inlay Hints
|
||||
|
||||
Zed sets the following initialization options to make the language server send back inlay hints (that is, when Zed has inlay hints enabled in the settings).
|
||||
|
||||
You can override these settings in your Zed `settings.json` when using `typescript-language-server`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"typescript-language-server": {
|
||||
"initialization_options": {
|
||||
"preferences": {
|
||||
"includeInlayParameterNameHints": "all",
|
||||
"includeInlayParameterNameHintsWhenArgumentMatchesName": true,
|
||||
"includeInlayFunctionParameterTypeHints": true,
|
||||
"includeInlayVariableTypeHints": true,
|
||||
"includeInlayVariableTypeHintsWhenTypeMatchesName": true,
|
||||
"includeInlayPropertyDeclarationTypeHints": true,
|
||||
"includeInlayFunctionLikeReturnTypeHints": true,
|
||||
"includeInlayEnumMemberValueHints": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
When using `vtsls`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"vtsls": {
|
||||
"settings": {
|
||||
// For JavaScript:
|
||||
"javascript": {
|
||||
"inlayHints": {
|
||||
"parameterNames": {
|
||||
"enabled": "all",
|
||||
"suppressWhenArgumentMatchesName": false
|
||||
},
|
||||
"parameterTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"variableTypes": {
|
||||
"enabled": true,
|
||||
"suppressWhenTypeMatchesName": true
|
||||
},
|
||||
"propertyDeclarationTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"functionLikeReturnTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"enumMemberValues": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
// For TypeScript:
|
||||
"typescript": {
|
||||
"inlayHints": {
|
||||
"parameterNames": {
|
||||
"enabled": "all",
|
||||
"suppressWhenArgumentMatchesName": false
|
||||
},
|
||||
"parameterTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"variableTypes": {
|
||||
"enabled": true,
|
||||
"suppressWhenTypeMatchesName": true
|
||||
},
|
||||
"propertyDeclarationTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"functionLikeReturnTypes": {
|
||||
"enabled": true
|
||||
},
|
||||
"enumMemberValues": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Code Lens
|
||||
|
||||
Zed enables references and implementations code lenses for `vtsls` by default. These show reference counts and implementation counts above functions, classes, and interfaces. To use them, enable the `code_lens` setting:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"code_lens": "on"
|
||||
}
|
||||
```
|
||||
|
||||
You can override the default code lens settings in your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"vtsls": {
|
||||
"settings": {
|
||||
"typescript": {
|
||||
"implementationsCodeLens": {
|
||||
"enabled": true,
|
||||
"showOnAllClassMethods": true,
|
||||
"showOnInterfaceMethods": true
|
||||
},
|
||||
"referencesCodeLens": {
|
||||
"enabled": true,
|
||||
"showOnAllFunctions": true
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"implementationsCodeLens": {
|
||||
"enabled": true,
|
||||
"showOnAllClassMethods": true,
|
||||
"showOnInterfaceMethods": true
|
||||
},
|
||||
"referencesCodeLens": {
|
||||
"enabled": true,
|
||||
"showOnAllFunctions": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Zed supports debugging TypeScript code out of the box with `vscode-js-debug`.
|
||||
The following can be debugged without writing additional configuration:
|
||||
|
||||
- Tasks from `package.json`
|
||||
- Tests written using several popular frameworks (Jest, Mocha, Vitest, Jasmine, Bun, Node)
|
||||
|
||||
Run {#action debugger::Start} ({#kb debugger::Start}) to see a contextual list of these predefined debug tasks.
|
||||
|
||||
> **Note:** Bun test is automatically detected when `@types/bun` is present in `package.json`.
|
||||
|
||||
> **Note:** Node test is automatically detected when `@types/node` is present in `package.json` (requires Node.js 20+).
|
||||
|
||||
As for all languages, configurations from `.vscode/launch.json` are also available for debugging in Zed.
|
||||
|
||||
If your use-case isn't covered by any of these, you can take full control by adding debug configurations to `.zed/debug.json`. See below for example configurations.
|
||||
|
||||
### Configuring JavaScript debug tasks
|
||||
|
||||
JavaScript debugging is more complicated than other languages because there are two different environments: Node.js and the browser. `vscode-js-debug` exposes a `type` field, that you can use to specify the environment, either `node` or `chrome`.
|
||||
|
||||
- [vscode-js-debug configuration documentation](https://github.com/microsoft/vscode-js-debug/blob/main/OPTIONS.md)
|
||||
|
||||
### Attach debugger to a server running in web browser (`npx serve`)
|
||||
|
||||
Given an externally-ran web server (e.g., with `npx serve` or `npx live-server`) one can attach to it and open it with a browser.
|
||||
|
||||
```json [debug]
|
||||
[
|
||||
{
|
||||
"label": "Launch Chrome (TypeScript)",
|
||||
"adapter": "JavaScript",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:5500",
|
||||
"program": "$ZED_FILE",
|
||||
"webRoot": "${ZED_WORKTREE_ROOT}",
|
||||
"build": {
|
||||
"command": "npx",
|
||||
"args": ["tsc"]
|
||||
},
|
||||
"skipFiles": ["<node_internals>/**"]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Zed Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.
|
||||
- [Zed Deno documentation](./deno.md)
|
||||
13
docs/src/languages/uiua.md
Normal file
13
docs/src/languages/uiua.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: Uiua
|
||||
description: "Configure Uiua language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# 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-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/)
|
||||
122
docs/src/languages/vue.md
Normal file
122
docs/src/languages/vue.md
Normal file
@@ -0,0 +1,122 @@
|
||||
---
|
||||
title: Vue
|
||||
description: "Configure Vue language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Vue
|
||||
|
||||
Vue support is available through the [Vue extension](https://github.com/zed-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)
|
||||
|
||||
## Initialization Options
|
||||
|
||||
### Specifying location of TypeScript SDK
|
||||
|
||||
By default, this extension assumes that you are working in a project with a `node_modules` directory, and searches for
|
||||
the TypeScript SDK inside that directory.
|
||||
|
||||
This may not always be true; for example, when working in a project that uses Yarn PnP, there is no `node_modules`. For
|
||||
editor support, the [documented](https://yarnpkg.com/getting-started/editor-sdks) approach is to run something like
|
||||
`yarn dlx @yarnpkg/sdks`. In that case, you can provide the following initialization options in your Zed settings:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"vue": {
|
||||
"initialization_options": {
|
||||
"typescript": {
|
||||
"tsdk": ".yarn/sdks/typescript/lib"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Settings Options
|
||||
|
||||
`lsp.vue.settings` is passed through to the Vue language server (Volar / [`vuejs/language-tools`](https://github.com/vuejs/language-tools)). The following settings are enabled by default:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"vue": {
|
||||
"settings": {
|
||||
// Display inlay hints for the `$event` parameter in inline event handlers.
|
||||
"vue.inlayHints.inlineHandlerLeading": true,
|
||||
// Display hints when required component props are missing in templates.
|
||||
"vue.inlayHints.missingProps": true,
|
||||
// Display inlay hints for patterns that wrap component options.
|
||||
"vue.inlayHints.optionsWrapper": true,
|
||||
// Display inlay hints related to `v-bind` shorthand (`:`).
|
||||
"vue.inlayHints.vBindShorthand": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can find the upstream settings configuration schema [`here`](https://github.com/vuejs/language-tools/blob/ee5041d27940cf6f9a5150635d3b13140a9dff54/extensions/vscode/package.json#L252).
|
||||
|
||||
> Note: Some settings (e.g. `vue.editor.focusMode`) may not take effect.
|
||||
|
||||
## Using the Tailwind CSS Language Server with Vue
|
||||
|
||||
To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in Vue files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
"includeLanguages": {
|
||||
"vue": "html"
|
||||
},
|
||||
"experimental": {
|
||||
"classRegex": [
|
||||
"class=\"([^\"]*)\"",
|
||||
"class='([^']*)'",
|
||||
":class=\"([^\"]*)\"",
|
||||
":class='([^']*)'"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With these settings, you will get completions for Tailwind CSS classes in Vue template files. Examples:
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<!-- Static class attribute -->
|
||||
<div class="flex items-center <completion here>">
|
||||
<p class="text-lg font-bold <completion here>">Hello World</p>
|
||||
</div>
|
||||
|
||||
<!-- Dynamic class binding -->
|
||||
<div
|
||||
:class="
|
||||
active ? 'bg-blue-500 <completion here>' : 'bg-gray-200 <completion here>'
|
||||
"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
|
||||
<!-- Array syntax -->
|
||||
<div :class="['flex', 'items-center', '<completion here>']">Content</div>
|
||||
|
||||
<!-- Object syntax -->
|
||||
<div
|
||||
:class="{
|
||||
'flex <completion here>': isFlex,
|
||||
'block <completion here>': isBlock,
|
||||
}"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
20
docs/src/languages/xml.md
Normal file
20
docs/src/languages/xml.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: XML
|
||||
description: "Configure XML language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# XML
|
||||
|
||||
XML support is available through the [XML extension](https://github.com/sweetppro/zed-xml/).
|
||||
|
||||
- Tree-sitter: [tree-sitter-grammars/tree-sitter-xml](https://github.com/tree-sitter-grammars/tree-sitter-xml)
|
||||
|
||||
## Configuration
|
||||
|
||||
If you have additional file extensions that are not being automatically recognized as XML just add them to [file_types](../reference/all-settings.md#file-types) in your Zed settings:
|
||||
|
||||
```json [settings]
|
||||
"file_types": {
|
||||
"XML": ["rdf", "gpx", "kml"]
|
||||
}
|
||||
```
|
||||
174
docs/src/languages/yaml.md
Normal file
174
docs/src/languages/yaml.md
Normal file
@@ -0,0 +1,174 @@
|
||||
---
|
||||
title: YAML
|
||||
description: "Configure YAML language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# YAML
|
||||
|
||||
YAML support is available natively in Zed.
|
||||
|
||||
- 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)
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure various [yaml-language-server settings](https://github.com/redhat-developer/yaml-language-server?tab=readme-ov-file#language-server-settings) by adding them to your Zed settings.json in a `yaml-language-server` block under the `lsp` key.
|
||||
|
||||
You can configure custom YAML schemas using relative paths. Zed resolves paths relative to your project root:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"yaml-language-server": {
|
||||
"settings": {
|
||||
"yaml": {
|
||||
"keyOrdering": true,
|
||||
"format": {
|
||||
"singleQuote": true
|
||||
},
|
||||
"schemas": {
|
||||
"https://getcomposer.org/schema.json": ["/*"],
|
||||
"./schemas/kubernetes.yaml": "k8s/**/*.yaml",
|
||||
"~/global-schemas/docker-compose.yaml": "docker-compose*.yml"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Paths starting with `./` resolve relative to the worktree root. Paths starting with `~/` expand to your home directory.
|
||||
|
||||
Note, settings keys must be nested, so `yaml.keyOrdering` becomes `{"yaml": { "keyOrdering": true }}`.
|
||||
|
||||
## Formatting
|
||||
|
||||
By default, Zed uses Prettier for formatting YAML files.
|
||||
|
||||
### Prettier Formatting
|
||||
|
||||
You can customize the formatting behavior of Prettier. For example to use single-quotes in yaml files add the following to your `.prettierrc` configuration file:
|
||||
|
||||
```json
|
||||
{
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.yaml", "*.yml"],
|
||||
"options": {
|
||||
"singleQuote": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### yaml-language-server Formatting
|
||||
|
||||
To use `yaml-language-server` instead of Prettier for YAML formatting, configure in Settings ({#kb zed::OpenSettings}) under Languages > YAML, or add to your settings file:
|
||||
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"YAML": {
|
||||
"formatter": "language_server"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Schemas
|
||||
|
||||
By default yaml-language-server will attempt to determine the correct schema for a given yaml file and retrieve the appropriate JSON Schema from [Json Schema Store](https://schemastore.org/).
|
||||
|
||||
You can override any auto-detected schema via the `schemas` settings key (demonstrated above) or by providing an [inlined schema](https://github.com/redhat-developer/yaml-language-server#using-inlined-schema) reference via a modeline comment at the top of your yaml file:
|
||||
|
||||
```yaml
|
||||
# yaml-language-server: $schema=https://www.schemastore.org/github-action.json
|
||||
name: Issue Assignment
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
```
|
||||
|
||||
You can disable the automatic detection and retrieval of schemas from the JSON Schema if desired:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"yaml-language-server": {
|
||||
"settings": {
|
||||
"yaml": {
|
||||
"schemaStore": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Tags
|
||||
|
||||
Yaml-language-server supports [custom tags](https://github.com/redhat-developer/yaml-language-server#adding-custom-tags) which can be used to inject custom application functionality at runtime into your yaml files.
|
||||
|
||||
For example Amazon CloudFormation YAML uses a number of custom tags, to support these you can add the following to your settings.json:
|
||||
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"yaml-language-server": {
|
||||
"settings": {
|
||||
"yaml": {
|
||||
"customTags": [
|
||||
"!And scalar",
|
||||
"!And mapping",
|
||||
"!And sequence",
|
||||
"!If scalar",
|
||||
"!If mapping",
|
||||
"!If sequence",
|
||||
"!Not scalar",
|
||||
"!Not mapping",
|
||||
"!Not sequence",
|
||||
"!Equals scalar",
|
||||
"!Equals mapping",
|
||||
"!Equals sequence",
|
||||
"!Or scalar",
|
||||
"!Or mapping",
|
||||
"!Or sequence",
|
||||
"!FindInMap scalar",
|
||||
"!FindInMap mapping",
|
||||
"!FindInMap sequence",
|
||||
"!Base64 scalar",
|
||||
"!Base64 mapping",
|
||||
"!Base64 sequence",
|
||||
"!Cidr scalar",
|
||||
"!Cidr mapping",
|
||||
"!Cidr sequence",
|
||||
"!Ref scalar",
|
||||
"!Ref mapping",
|
||||
"!Ref sequence",
|
||||
"!Sub scalar",
|
||||
"!Sub mapping",
|
||||
"!Sub sequence",
|
||||
"!GetAtt scalar",
|
||||
"!GetAtt mapping",
|
||||
"!GetAtt sequence",
|
||||
"!GetAZs scalar",
|
||||
"!GetAZs mapping",
|
||||
"!GetAZs sequence",
|
||||
"!ImportValue scalar",
|
||||
"!ImportValue mapping",
|
||||
"!ImportValue sequence",
|
||||
"!Select scalar",
|
||||
"!Select mapping",
|
||||
"!Select sequence",
|
||||
"!Split scalar",
|
||||
"!Split mapping",
|
||||
"!Split sequence",
|
||||
"!Join scalar",
|
||||
"!Join mapping",
|
||||
"!Join sequence",
|
||||
"!Condition scalar",
|
||||
"!Condition mapping",
|
||||
"!Condition sequence"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
11
docs/src/languages/yara.md
Normal file
11
docs/src/languages/yara.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Yara
|
||||
description: "Configure Yara language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Yara
|
||||
|
||||
`Yara` language support in Zed is provided by the [Yara language extension](https://github.com/egibs/yara.zed). Please report issues to [https://github.com/egibs/yara.zed/issues](https://github.com/egibs/yara.zed/issues).
|
||||
|
||||
- Tree-sitter: [egibs/tree-sitter-yara](https://github.com/egibs/tree-sitter-yara)
|
||||
- Language Server: [avast/yls](https://github.com/avast/yls)
|
||||
15
docs/src/languages/yarn.md
Normal file
15
docs/src/languages/yarn.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Yarn
|
||||
description: "Configure Yarn language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Yarn
|
||||
|
||||
[Yarn](https://yarnpkg.com/) is a JavaScript package manager that provides deterministic dependency resolution and offline caching.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Run `yarn dlx @yarnpkg/sdks base` to generate a `.yarn/sdks` directory.
|
||||
2. Set your language server (e.g. VTSLS) to use TypeScript SDK from `.yarn/sdks/typescript/lib` directory in [LSP initialization options](../reference/all-settings.md#lsp). The actual setting depends on your language server; for example, for VTSLS set [`typescript.tsdk`](https://github.com/yioneko/vtsls/blob/6adfb5d3889ad4b82c5e238446b27ae3ee1e3767/packages/service/configuration.schema.json#L5).
|
||||
|
||||
After configuration, language server features (Go to Definition, completions, hover documentation) should work correctly.
|
||||
11
docs/src/languages/zig.md
Normal file
11
docs/src/languages/zig.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Zig
|
||||
description: "Configure Zig language support in Zed, including language servers, formatting, and debugging."
|
||||
---
|
||||
|
||||
# Zig
|
||||
|
||||
Zig support is available through the [Zig extension](https://github.com/zed-extensions/zig).
|
||||
|
||||
- Tree-sitter: [tree-sitter-zig](https://github.com/tree-sitter-grammars/tree-sitter-zig)
|
||||
- Language Server: [zls](https://github.com/zigtools/zls)
|
||||
Reference in New Issue
Block a user