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.0.tar.gz
md5=52505db27b7208b40a74ed2861ff593e
sha512=39d15017493c8d0c7faf86f9add56335e30132c6d10fcf93ebc3fd4c951455457916db969f3f7c839e9218535a5b5f9a3cea4897f2ec9670398608222220a193

Description

A formatter for Catala based on the Topiary universal formatting engine.

Topiary repository: https://github.com/tweag/topiary

Added to opam-repository:

README

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.

Dependencies (6)

  1. re >= "1.11"
  2. conf-c++
  3. topiary >= "0.6.0" & < "0.7"
  4. cmdliner >= "2.0.0"
  5. dune >= "3.13"
  6. ocaml >= "4.14.0"

Dev Dependencies (1)

  1. lwt with-test

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building catala-format with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
1.3.0 (this version) n/a good good good good
0.3.0 good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure