R with Tree-sitter support.
Clone this repository, or install from MELPA. Add the following to your init.el
:
(require 'tree-sitter-ess-r)
(add-hook 'ess-r-mode-hook 'tree-sitter-ess-r-mode-activate)
If you use use-package
you can install and configure with :
(use-package tree-sitter-ess-r
:ensure t
:after (ess)
:hook (ess-r-mode . tree-sitter-ess-r-mode-activate))
or call interactively M-x tree-sitter-ess-r-using-r-faces
You can install the tree-sitter-langs which includes support
for R along with a number of other languages. Alternatively if you want to only add support for tree-sitter-ess-r
to
your existing Tree-sitter languages you can install manually.
In the following /path/to/tree-sitter-langs/
is the path of your
tree-sitter-langs package.
git clone https://github.com/r-lib/tree-sitter-r.git && cd tree-sitter-r
gcc ./src/parser.c ./src/scanner.c -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.so
cp ./r.so /path/to/tree-sitter-langs/langs/bin
mkdir /path/to/tree-sitter-langs/queries/r
cp ./queries/* /path/to/tree-sitter-langs/queries/r
git clone https://github.com/r-lib/tree-sitter-r.git
gcc ./src/parser.c ./src/scanner.c -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.dll
cp ./r.dll /path/to/tree-sitter-langs/langs/bin
mkdir /path/to/tree-sitter-langs/queries/r
cp ./queries/* /path/to/tree-sitter-langs/queries/r