Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9d0a584

Browse files
feat(plugin): installation
update readme with new instructions, update queries folder to automatically work when consumed
1 parent 6376fa0 commit 9d0a584

File tree

6 files changed

+63
-2
lines changed

6 files changed

+63
-2
lines changed

‎README.md‎

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,56 @@ Queries for text objects are also included which help you to navigate, select, a
88

99
## Installation
1010

11-
- If you want ReScript Tree-sitter in NeoVim, refer to [`nvim-treesitter-rescript`](https://github.com/nkrkv/nvim-tree-sitter-rescript/) installation notes;
11+
### Neovim
12+
13+
If you want ReScript Tree-sitter in NeoVim, you will first need to register a new parser for it like so:
14+
15+
```lua
16+
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
17+
parser_config.rescript = {
18+
install_info = {
19+
url = "https://github.com/nkrkv/tree-sitter-rescript",
20+
branch = "main",
21+
files = { "src/scanner.c" },
22+
generate_requires_npm = false,
23+
requires_generate_from_grammar = true,
24+
use_makefile = true, -- macOS specific instruction
25+
},
26+
}
27+
```
28+
29+
This will make `TSInstall rescript` globally available. For more persistent approach you should add this parser to your Lua configuration.
30+
Default configuration detects `.res` and `.resi` files. You can confirm that it's correctly installed by using [`nvim-treesitter/playground`](https://github.com/nvim-treesitter/playground) and invoking `TSPlaygroundToggle` when you are in the ReScript file.
31+
Notice that by default you will not see the highlighting! To enable highlighting, you will need to install this package either as a dependency or directly.
32+
If you are using `lazy.nvim` example configuration will look like so:
33+
34+
```lua
35+
{
36+
"nvim-treesitter/nvim-treesitter",
37+
dependencies = {
38+
"nkrkv/tree-sitter-rescript"
39+
},
40+
opts = function(_, opts) -- this is needed so you won't override your default nvim-treesitter configuration
41+
vim.list_extend(opts.ensure_installed, {
42+
"rescript",
43+
})
44+
45+
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
46+
parser_config.rescript = {
47+
install_info = {
48+
url = "https://github.com/nkrkv/tree-sitter-rescript",
49+
branch = "main",
50+
files = { "src/scanner.c" },
51+
generate_requires_npm = false,
52+
requires_generate_from_grammar = true,
53+
use_makefile = true, -- macOS specific instruction
54+
},
55+
}
56+
end,
57+
}
58+
```
59+
60+
- Legacy way of installing the parser is available via [`nvim-treesitter-rescript`](https://github.com/nkrkv/nvim-tree-sitter-rescript/);
1261
- If you want it for other purposes, you probably know what to do.
1362

1463
## Contributing

‎package.json‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@
1717
"res",
1818
"resi"
1919
],
20-
"injection-regex": "rescript"
20+
"injection-regex": "rescript",
21+
"highlights": [
22+
"queries/rescript/highlights.scm"
23+
],
24+
"locals": [
25+
"queries/rescript/locals.scm"
26+
],
27+
"injections": [
28+
"queries/rescript/injections.scm"
29+
],
30+
"textobjects": [
31+
"queries/rescript/textobjects.scm"
32+
]
2133
}
2234
]
2335
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /