Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
!editors/zed/Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
Expand All @@ -20,6 +21,8 @@ tags
generated.rs
docs/public/vide-lab/
docs/public/schemas/
editors/zed/extension.wasm
editors/zed/grammars/systemverilog/

.DS_Store
.vscode/
Expand Down
1 change: 1 addition & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default defineConfig({
items: [
'user-guide/installation',
'user-guide/vscode-installation',
'user-guide/zed-installation',
'user-guide/neovim-installation',
'user-guide/emacs-installation',
],
Expand Down
29 changes: 28 additions & 1 deletion docs/src/content/docs/advanced-guide/user-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,33 @@ vim.lsp.enable('vide')

如果你的 `"vide"` 已经写成可执行文件的绝对路径,保留原来的路径即可。`t` 会发送成 JSON 里的 `true`。

## Zed

如果你使用 [Zed 安装](../../user-guide/zed-installation/),在 Zed settings 里把用户配置写到 `lsp.vide.initialization_options`:

```json
{
"lsp": {
"vide": {
"initialization_options": {
"diagnostics": {
"update": "onType"
},
"inlayHints": {
"port": {
"connection": {
"enable": true
}
}
}
}
}
}
}
```

如果你还需要指定本地 `vide` 二进制,可以在同一个 `lsp.vide` 下加入 `binary.path`。用户配置只需要放在 `initialization_options` 里。

## 其他 LSP 编辑器

不同编辑器或插件的字段名可能叫 `initializationOptions`、`init_options` 或类似名字。它们的含义相同:启动语言服务器时,把一个 JSON 对象一起发给服务器。
Expand Down Expand Up @@ -130,7 +157,7 @@ https://vide.pascal-lab.net/schemas/v1/user-config.schema.json
}
```

直接写在 Neovim `init_options`Emacs `:initializationOptions` 里时,通常不需要写 `$schema`。
直接写在 Neovim `init_options`Emacs `:initializationOptions` 或 Zed `initialization_options` 里时,通常不需要写 `$schema`。

## 修改后让配置生效

Expand Down
29 changes: 28 additions & 1 deletion docs/src/content/docs/en/advanced-guide/user-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,33 @@ If you use the Eglot setup from [Emacs Installation](../../user-guide/emacs-inst

If your `"vide"` entry already uses an absolute executable path, keep that path. `t` is sent as JSON `true`.

## Zed

If you use [Zed Installation](../../user-guide/zed-installation/), put user configuration under `lsp.vide.initialization_options` in Zed settings:

```json
{
"lsp": {
"vide": {
"initialization_options": {
"diagnostics": {
"update": "onType"
},
"inlayHints": {
"port": {
"connection": {
"enable": true
}
}
}
}
}
}
}
```

If you also need to point Zed at a local `vide` binary, add `binary.path` under the same `lsp.vide` object. User configuration only needs to live under `initialization_options`.

## Other LSP Editors

Different editors or plugins may call the field `initializationOptions`, `init_options`, or something similar. The meaning is the same: send a JSON object when the language server starts.
Expand Down Expand Up @@ -130,7 +157,7 @@ If you keep user configuration in a standalone JSON file, you can add `$schema`
}
```

When writing options directly in Neovim `init_options` or Emacs `:initializationOptions`, you usually do not need `$schema`.
When writing options directly in Neovim `init_options`, Emacs `:initializationOptions`, or Zed `initialization_options`, you usually do not need `$schema`.

## Apply Changes

Expand Down
7 changes: 6 additions & 1 deletion docs/src/content/docs/en/user-guide/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Install Vide for your editor.

import { CardGrid, LinkCard } from '@astrojs/starlight/components';

Vide's core is a language server that implements the [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/), so it can in principle be adapted to more LSP-capable editors and tools. We still recommend VS Code first: the extension gives you one-step installation of the Vide language server, along with the most complete and easiest setup. For Neovim and Emacs users, we also provide detailed guides that show how to download the Vide language server binary first and then configure the editor's LSP client to start it. We will continue to expand support for more editors based on user needs.
Vide's core is a language server that implements the [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/), so it can in principle be adapted to more LSP-capable editors and tools. We still recommend VS Code first: the extension gives you one-step installation of the Vide language server, along with the most complete and easiest setup. The Zed extension can download the language server from GitHub Releases on first start. For Neovim and Emacs users, we also provide detailed guides that show how to download the Vide language server binary first and then configure the editor's LSP client to start it. We will continue to expand support for more editors based on user needs.

<CardGrid>
<LinkCard
Expand All @@ -18,6 +18,11 @@ Vide's core is a language server that implements the [Language Server Protocol (
href="../neovim-installation/"
description="Download the Vide language server and configure Neovim's built-in LSP client."
/>
<LinkCard
title="Zed Installation"
href="../zed-installation/"
description="Install the Zed extension and let it download the Vide language server automatically."
/>
<LinkCard
title="Emacs Installation"
href="../emacs-installation/"
Expand Down
86 changes: 86 additions & 0 deletions docs/src/content/docs/en/user-guide/zed-installation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: Zed Installation
description: Install the Vide Zed extension and download the Vide language server automatically.
---

This page is for users who edit Verilog/SystemVerilog in [Zed](https://zed.dev/). The Vide Zed extension registers SystemVerilog language support and downloads the platform-specific `vide` binary from GitHub Releases the first time the language server starts.

## 1. Install the Extension

The extension source currently lives in `editors/zed`. Before it is published to the Zed extension registry, install it as a development extension:

1. Open Zed.
2. Open the Command Palette.
3. Run `zed: install dev extension`.
4. Select the repository's `editors/zed` directory.

After installation, Zed uses the extension's SystemVerilog language configuration and the Vide language server for `.v`, `.vh`, `.sv`, `.svh`, and `.svi` files.

## 2. Automatic Language Server Download

Without extra settings, the extension chooses the language server in this order:

1. Use `lsp.vide.binary.path` from Zed settings.
2. Look for `vide` (`vide.exe` on Windows) on the `PATH` visible to the current worktree.
3. Download the current platform's binary from the latest [`pascal-lab/vide`](https://github.com/pascal-lab/vide/releases/latest) GitHub Release.

Automatic download supports these release assets:

| Platform | Release asset |
| --- | --- |
| Linux x64 | `vide-linux-x64` |
| Linux arm64 | `vide-linux-arm64` |
| Windows x64 | `vide-win32-x64.exe` |
| macOS arm64 | `vide-darwin-arm64` |

## 3. Override the Server Path

If you want to use a locally built `vide`, or your environment cannot access GitHub, set a local binary path in Zed settings:

```json
{
"lsp": {
"vide": {
"binary": {
"path": "D:/tools/vide/vide.exe"
}
}
}
}
```

Linux or macOS example:

```json
{
"lsp": {
"vide": {
"binary": {
"path": "/home/user/.local/bin/vide"
}
}
}
}
```

## 4. Prepare Project Configuration

Create `vide.toml` in the project root so Vide knows which source files, include directories, and macros to analyze. See [Configure the First Project](../first-project/) for the first setup.

## 5. User Configuration

Zed sends `lsp.vide.initialization_options` to Vide. To tune diagnostics, inlay hints, or other language-server behavior, see [User Configuration for LSP Editors](../../advanced-guide/user-configuration/#zed).

## 6. Verify

Open a `.v` or `.sv` file in your project. If the language server needs to be downloaded on first start, Zed shows the language server installation status. After it starts, try go-to-definition, hover, completion, or diagnostics in code.

If the language server does not start, check these first:

- The current platform has a matching GitHub Release asset.
- Zed can access the GitHub Release download URL.
- `lsp.vide.binary.path` points to an existing executable.

## Next Step

Continue with [Features](../features/). Although the examples there focus on VS Code, most of those capabilities are provided by the Vide language server, so you can still use them in Zed.
7 changes: 6 additions & 1 deletion docs/src/content/docs/user-guide/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: 根据你使用的编辑器安装 Vide。

import { CardGrid, LinkCard } from '@astrojs/starlight/components';

Vide 的核心是一个实现了 [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/) 的语言服务器,因此理论上可以适配更多支持 LSP 的编辑器和工具。不过,我们仍然首推 VS Code:通过扩展即可一键安装并使用 Vide 语言服务器,体验最完整、上手也最便捷。对于 Neovim 和 Emacs 用户,我们同样提供了详细教程,指导你先下载 Vide 语言服务器二进制文件,再在对应编辑器的 LSP 客户端中配置启动命令。未来,我们也会根据用户需求,持续扩展对更多编辑器的支持。
Vide 的核心是一个实现了 [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/) 的语言服务器,因此理论上可以适配更多支持 LSP 的编辑器和工具。不过,我们仍然首推 VS Code:通过扩展即可一键安装并使用 Vide 语言服务器,体验最完整、上手也最便捷。Zed 扩展可以在首次启动时自动从 GitHub Release 下载语言服务器;对于 Neovim 和 Emacs 用户,我们同样提供了详细教程,指导你先下载 Vide 语言服务器二进制文件,再在对应编辑器的 LSP 客户端中配置启动命令。未来,我们也会根据用户需求,持续扩展对更多编辑器的支持。

<CardGrid>
<LinkCard
Expand All @@ -18,6 +18,11 @@ Vide 的核心是一个实现了 [Language Server Protocol (LSP)](https://micros
href="../neovim-installation/"
description="下载 Vide 语言服务器,并配置 Neovim 内置 LSP。"
/>
<LinkCard
title="Zed 安装"
href="../zed-installation/"
description="安装 Zed 扩展,并让扩展自动下载 Vide 语言服务器。"
/>
<LinkCard
title="Emacs 安装"
href="../emacs-installation/"
Expand Down
86 changes: 86 additions & 0 deletions docs/src/content/docs/user-guide/zed-installation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: Zed 安装
description: 安装 Vide Zed 扩展,并自动下载 Vide 语言服务器。
---

本页面面向使用 [Zed](https://zed.dev/) 编辑 Verilog/SystemVerilog 的用户。Vide 的 Zed 扩展会注册 SystemVerilog 语言支持,并在首次启动语言服务器时自动从 GitHub Release 下载当前平台的 `vide` 二进制文件。

## 1. 安装扩展

当前扩展源码位于仓库的 `editors/zed` 目录。发布到 Zed 扩展市场之前,可以通过 Zed 的开发扩展入口安装:

1. 打开 Zed。
2. 打开 Command Palette。
3. 运行 `zed: install dev extension`。
4. 选择仓库里的 `editors/zed` 目录。

安装后,打开 `.v`、`.vh`、`.sv`、`.svh` 或 `.svi` 文件时,Zed 会使用扩展提供的 SystemVerilog 语言配置和 Vide 语言服务器。

## 2. 自动下载语言服务器

如果没有额外配置,扩展会按下面的顺序选择语言服务器:

1. 使用 Zed 设置中的 `lsp.vide.binary.path`。
2. 在当前工作区可见的 `PATH` 中查找 `vide`(Windows 为 `vide.exe`)。
3. 从 [`pascal-lab/vide`](https://github.com/pascal-lab/vide/releases/latest) 最新 GitHub Release 下载当前平台的二进制文件。

自动下载支持以下 Release 资产:

| 平台 | Release 资产 |
| --- | --- |
| Linux x64 | `vide-linux-x64` |
| Linux arm64 | `vide-linux-arm64` |
| Windows x64 | `vide-win32-x64.exe` |
| macOS arm64 | `vide-darwin-arm64` |

## 3. 覆盖服务器路径

如果你想使用自己编译的 `vide`,或者所在环境无法访问 GitHub,可以在 Zed settings 里指定本地二进制:

```json
{
"lsp": {
"vide": {
"binary": {
"path": "D:/tools/vide/vide.exe"
}
}
}
}
```

Linux 或 macOS 示例:

```json
{
"lsp": {
"vide": {
"binary": {
"path": "/home/user/.local/bin/vide"
}
}
}
}
```

## 4. 准备项目配置

在项目根目录编写 `vide.toml`,让 Vide 知道要分析哪些源文件、include 目录和宏定义。第一次配置可以先看[配置第一个项目](../first-project/)。

## 5. 用户配置

Zed 会把 `lsp.vide.initialization_options` 发送给 Vide。要调整诊断、行内提示或其他语言服务器行为,请看 [LSP 编辑器的用户配置](../../advanced-guide/user-configuration/#zed)。

## 6. 验证

打开工程中的 `.v` 或 `.sv` 文件。如果首次启动需要下载语言服务器,Zed 会显示语言服务器安装状态。下载完成后,可以在代码中试试跳转定义、悬停、补全或诊断。

如果语言服务器没有启动,优先检查三件事:

- 当前平台是否有对应的 GitHub Release 资产。
- Zed 是否能访问 GitHub Release 下载地址。
- `lsp.vide.binary.path` 是否指向存在的可执行文件。

## 下一步

下一步可以阅读 [功能特性](../features/) 部分。尽管这些示例以 VS Code 为主,但大部分特性由 Vide 语言服务器提供,在 Zed 中也可以使用。
Loading
Loading