Skip to content

VS Code extension that formats Drools (.drl) rule files

License

Notifications You must be signed in to change notification settings

jhhtaylor/drools-formatter

Repository files navigation

Logo

Drools Formatter is VS Code extension that formats Drools (.drl) rule files.

Drools Formatter in action

Support the creator

Buy Me A Coffee

Love this extension? You can support its development with a small donation - completely optional! Your support helps me keep creating and improving tools like this.

Features

  • Format the entire document with Ctrl+Shift+I or Format Document command.
  • Format the selected lines with Ctrl+K Ctrl+F or Format Selection.

The formatter follows the basic layout in the Drools reference documentation. Lines beginning with rule, rule attributes such as dialect, and end are flush with the left margin. The when and then keywords also start at the left margin, and their contents are indented based on your editor preferences—use tabs or select between one and eight spaces. Blocks are closed with end at column zero.

Only the main structural keywords (rule, when, then, end) affect indentation. Other Drools keywords such as accumulate, exists, or query are formatted as normal lines inside the blocks.

Development

npm install
npm run watch

# For a single build
npm run compile

The compiled extension code is output to the dist folder.

Usage

Open a .drl file in VS Code and use the standard formatting commands. The extension registers the drl language, so .drl files are recognized automatically when the extension is installed.

Disclaimer

This extension is an independent project and is not affiliated with or endorsed by the Drools project or Red Hat. The Drools name and logo are trademarks of their respective owners; use here is for identification purposes only.

About

VS Code extension that formats Drools (.drl) rule files

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors