package catala-format

All checked builds pass
  1. Overview
  2. Docs
A formatter for Catala based on the Topiary universal formatting engine

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.3.2.tar.gz
md5=da1eee373f073f9481feb12cc2777f8b
sha512=eea305aff5e41615fa0617dff243b979b074fed01e3100f2f90f915c73030eaf67f1eb42fb056d07a38589a96e0c8659f158d1dea986e33c6ef25a34c2c6ea0d

doc/README.html

Catala Code Formatting tool

catala-format is a code formatter for Catala.

This tool is based on topiary, a generic formatting tool.

Installation

Pre-requisite: opam package manager.

opam

Run opam install catala-format in a terminal.

From sources

Run opam install . in the root directory after cloning the repository.

Usage

Run catala-format <CATALA_FILE>

Note: it may be slow the first time invoking the command at it requires downloading and compiling the Catala's tree-sitter grammar in background.

Integration in editors

VSCode

catala-format is linked to the Format document VSCode command in the Catala extension. Installing catala-lsp is required.

Emacs

An Emacs plugin is present in emacs/catala-format.el. This plugin is installed in the opam's Emacs shared plugins directory, i.e., <opam_dir>/share/emacs/site-lisp/. The default <opam_dir> can be found by invoking the opam var prefix shell command.

This script depends on the catala-ts-mode.el plugin which can be found in root directory of the Catala tree-sitter repository which needs to be copied over manually (e.g., in the same opam directory).

An example of .emacs configuration would look like:

;; Change the <opam_dir> path by yours - find it with
(add-to-list 'load-path "~/<opam_dir>/share/emacs/site-lisp")

(require 'catala-ts-mode)
(require 'catala-format)

;; Attempt to format the Catala file when saving
(add-hook 'before-save-hook 'catala-format-before-save)

License

The code contained in this repository is released under the Apache license (version 2) unless another license is explicited for a sub-directory.