Regal v0.21.0 released! #582
anderseknert
started this conversation in
Ecosystem
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a big release, bringing new
regal fix
command, several features to the Regal language server, a new linter rule, and many improvements and fixes.New command:
regal fix
The
regal fix
command allows you to automatically fix some of the (style) issues reported by the Regal linter. This command is available in the CLI and can be run on a single file or a directory. The following linter rules are supported by theregal fix
command:More rules will be added in future releases.
The
regal fix
command respects the.regal/config.yaml
file, and will only fix issues that aren't ignored by configuration.New rule:
unresolved-import
Category:
imports
OPA does not resolve imports until runtime, and when it does, unresolved imports are simply undefined. The unresolved-import rule helps catch these issues early by flagging imports that can't be statically resolved by Regal. Since imports could refer to data documents or rules imported at runtime, this linter rule allows providing a list of of references that should be ignored by the linter.
For more information, see the docs on unresolved-import.
Language Server: Code Actions
Similarly to the
regal fix
command, code actions allows fixing some issues reported by Regal but directly from the editor. This release adds code actions to remediate the following linter rules:Language Server: Go to Definition
Ctrl/cmd + clicking a reference in the editor now navigates to the definition of the reference, as Regal now implements the "go to definition" feature of the language server protocol.
Language Server: Formatting
The Regal language server now supports formatting Rego files using the
opa fmt
command. This can be triggered either by running the "Format document" command in your editor, or from where aopa-fmt
linter violation is reported in the package.Language Server: Document Symbols
Symbols — like packages, rules and functions, are now provided by Regal upon requests from an editor. This allows for a quick overview of the structure of a Rego file, and provides "breadcrumbs" to navigate the symbols of an open Rego document.
Language Server: Workspace Symbols
Similarly to document symbols, Regal now reports symbols from the entire workspace, allowing users to search and navigate to any top-level symbol (i.e. package, rule or function) in the workspace.
Language Server: Folding Ranges
Regal now provides folding ranges for Rego files in the workspace, allowing users to fold (i.e. expand or collapse) blocks of code, comments and imports in the editor.
Other improvements
.regal/config.yaml
file in directories above the workspace if not found before. This allows using a shared configuration file for multiple projects. Thanks @bdjgs for requesting this feature!Bugs fixed
Documentation
For the full changelog, and downloads, see the release page.
Beta Was this translation helpful? Give feedback.
All reactions