Rego

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

安装

该扩展主要基于 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 的 配置文档