入门 Zed Industries 2026-09-14 17:42:19 · 0 阅读

第102章 Zed 编辑器中 Rego 语言支持指南

Zed 对 Rego 语言的支持由社区维护的 Rego 扩展提供。

安装

该扩展主要基于 Regal language server 构建,使用前需要先安装 Regal。详情请参阅入门指南

配置

扩展的行为通过 .regal/config.yaml 文件配置。下面是一个示例配置,禁用了 todo-comment 规则、自定义了 line-length 规则,并在 opa-fmt 规则中忽略测试文件:

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"

更多信息请参阅 Regal 的配置文档

评论 (0)