blob: d1ae3df16948b14023c47c686c7273c6abf0763f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
-- Entry point for the SiSU spine markup Neovim integration.
--
-- Registers a tree-sitter parser config so users can run
-- :TSInstall sisu
-- to fetch and build the parser via nvim-treesitter.
--
-- The parser source lives can be found under the
-- `projects/` namespace on git.sisudoc.org.
local M = {}
--- Register the `sisu` parser with nvim-treesitter and ensure that
--- `.sst` / `.ssm` / `.ssi` are detected as filetype "sisu".
---
--- Call once from your init.lua before invoking `:TSInstall sisu`.
function M.setup()
local ok, parsers = pcall(require, "nvim-treesitter.parsers")
if not ok then
vim.notify(
"sisu-spine: nvim-treesitter is not installed; "
.. "syntax highlighting will not be available.",
vim.log.levels.WARN
)
return
end
local parser_config = parsers.get_parser_configs()
parser_config.sisu = {
install_info = {
url = "https://git.sisudoc.org/projects/tree-sitter-sisu",
files = {
"src/parser.c",
"src/scanner.c",
},
branch = "main",
generate_requires_npm = false,
requires_generate_from_grammar = false,
},
filetype = "sisu",
}
end
return M
|