Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ShuguangSun/tree-sitter-ess-r
Browse files Browse the repository at this point in the history
  • Loading branch information
ShuguangSun committed Nov 20, 2024
2 parents 9999f4e + e8c7247 commit 7568489
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
emacs_version:
- 27.2
- 29.1

steps:
- name: Setup GNU Emacs
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/eldev_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
emacs_version:
- 27.2
- 29.1

steps:
- name: Setup GNU Emacs
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/spell_check_wucuo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
matrix:
emacs_version:
- 27.2
- 29.1

steps:
- uses: purcell/setup-emacs@master
Expand Down
52 changes: 36 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,58 @@
[![MELPA](https://melpa.org/packages/tree-sitter-ess-r-badge.svg)](https://melpa.org/#/tree-sitter-ess-r)
[![MELPA Stable](https://stable.melpa.org/packages/tree-sitter-ess-r-badge.svg)](https://stable.melpa.org/#/tree-sitter-ess-r)
[![Build Status](https://github.com/ShuguangSun/tree-sitter-ess-r/workflows/CI/badge.svg)](https://github.com/ShuguangSun/tree-sitter-ess-r/actions)
[![Build Status](https://github.com/ShuguangSun/tree-sitter-ess-r/actions/workflows/ci.yml/badge.svg)](https://github.com/ShuguangSun/tree-sitter-ess-r/actions)
[![License](http://img.shields.io/:license-gpl3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0.html)


# tree-sitter-ess-r

R with tree-sitter support.
[R](https://r-project.org) with [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) support.

## Installation

Clone this repository, or install from MELPA. Add the following to your `.emacs`:
Clone this repository, or install from MELPA. Add the following to your `init.el`:

``` elisp
(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 :

``` elisp
(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`

## Make tree-sitter to support r
## Make tree-sitter to support R

You can install the [tree-sitter-langs](https://github.com/emacs-tree-sitter/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.

Linux
In the following `/path/to/tree-sitter-langs/` is the path of your
[tree-sitter-langs](https://github.com/emacs-tree-sitter/tree-sitter-langs) package.

1. git clone https://github.com/r-lib/tree-sitter-r.git
2. gcc ./src/parser.c ./src/scanner.cc -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.so
3. cp ./r.so /path/to/tree-sitter-langs/langs/bin (/path/to/tree-sitter-langs/ is path of your tree-sitter-langs package)
4. mkdir /path/to/tree-sitter-langs/queries/r
5. cp ./queries/* /path/to/tree-sitter-langs/queries/r
### Linux

``` bash
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
```

Windows (MINGW64)
### Windows (MINGW64)

1. git clone https://github.com/r-lib/tree-sitter-r.git
2. gcc ./src/parser.c ./src/scanner.cc -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.dll
3. cp ./r.dll /path/to/tree-sitter-langs/langs/bin (/path/to/tree-sitter-langs/ is path of your tree-sitter-langs package)
4. mkdir /path/to/tree-sitter-langs/queries/r
5. cp ./queries/* /path/to/tree-sitter-langs/queries/r
``` bash
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
```

0 comments on commit 7568489

Please sign in to comment.