Syntax highlighting¶
Definitions for syntax coloring are available for the applications below.
Emacs¶
See https://github.com/qezz/rcl-mode.
Helix¶
Helix can use the Tree-sitter grammar. In your configuration directory, ensure languages.toml exists, and add the following sections:
[[language]]
auto-format = false
comment-tokens = ["//"]
file-types = ["rcl"]
formatter = { command = "rcl", args = ["format", "-"] }
grammar = "rcl"
indent = { tab-width = 2, unit = " " }
name = "rcl"
roots = ["build.rcl"]
scope = "source.rcl"
[[grammar]]
name = "rcl"
source = { git = "https://github.com/rcl-lang/tree-sitter-rcl.git", rev = "master" }
Furthermore, copy grammar/tree-sitter-rcl/queries/highlights_helix.scm into your Helix configuation directory at runtime/queries/rcl/highlights.scm.
JetBrains¶
JetBrains IDEs can, through the integrated TextMate plugin, use the Visual Studio Code extension. First clone the RCL repository. Then in the IDE, go to Settings > Editor > TextMate Bundles, click the + button, and select the grammar/vscode directory in the repository. That’s it, everything is configured automatically!
Neovim¶
Neovim can use the Tree-sitter grammar through the nvim-treesitter plugin. Clone the rcl repository, and add the following to your init.lua:
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.rcl = {
install_info = {
url = "/checkout/rcl/grammar/tree-sitter-rcl",
files = {},
generate_requires_npm = false,
requires_generate_from_grammar = true,
}
}
If you haven’t done so already, configure nvim-treesitter, including enabling syntax highlighting. Run :TSInstall rcl to compile the parser and put the shared object on the runtimepath, and copy the highlight query into the queries subdirectory:
cp /checkout/rcl/grammar/tree-sitter-rcl/queries/highlights_nvim.scm /pasers-path/queries/rcl/highlights.scm
Then either :set filetype=rcl on a buffer to highlight as RCL, or enable autodetection on the file extension:
vim.cmd "au BufNewFile,BufRead *.rcl setf rcl"
Pygments¶
The directory grammar/pygments contains a file rcl.py that you can drop into a Pygments fork in the pygments/lexers directory. This lexer powers the syntax highlighting in this manual.
Tree-sitter¶
The directory grammar/tree-sitter-rcl contains a Tree-sitter grammar. It can be used by various tools, see the other sections on this page. For hacking on the grammar, see also the Tree-sitter chapter.
Vim¶
The directory grammar/rcl.vim contains support for highlighting in Vim. You can symlink the contents into your ~/.vim, or use a plugin manager like Pathogen and symlink the directory into ~/.vim/bundle.
Visual Studio Code¶
The Visual Studio Code extension is available from the Visual Studio marketplace.
If you want to install a development version of the extension, the extension is developed in the main repository. See the section in the grammars chapter for how to build it, then install the extension using Extensions: Install from VSIX… from the command panel.
Zed¶
The Zed extension is available from the Zed extension registry. Open the command panel, search for zed: extensions, then search for RCL in the search box.
If you want to install a development version of the extension, the extension is developed in the main repository. You can install it from the Zed command panel with the zed: install dev extension command, and picking the grammar/zed directory.
External¶
Aside from editor support, rcl highlight will highlight an expression using its internal lexer, and rcl format formats and highlights a document. The latter produces more advanced highlighting, because it uses the richer syntax tree, rather than the more basic token stream.