nvim-treesitter/lua/nvim-treesitter/parsers.lua

1069 lines
24 KiB
Lua
Raw Normal View History

local api = vim.api
local ts = vim.treesitter
local filetype_to_parsername = {
arduino = "cpp",
javascriptreact = "javascript",
ecma = "javascript",
jsx = "javascript",
PKGBUILD = "bash",
html_tags = "html",
["typescript.tsx"] = "tsx",
terraform = "hcl",
["html.handlebars"] = "glimmer",
systemverilog = "verilog",
cls = "latex",
sty = "latex",
OpenFOAM = "foam",
}
local list = setmetatable({}, {
__newindex = function(table, parsername, parserconfig)
2021-07-04 16:12:17 -05:00
rawset(
table,
parsername,
setmetatable(parserconfig, {
__newindex = function(parserconfigtable, key, value)
if key == "used_by" then
require("nvim-treesitter.utils").notify(
"used_by is deprecated, please use 'filetype_to_parsername'",
vim.log.levels.WARN
)
filetype_to_parsername[value] = parsername
2021-07-04 16:12:17 -05:00
else
rawset(parserconfigtable, key, value)
end
end,
})
)
filetype_to_parsername[parserconfig.filetype or parsername] = parsername
2021-07-04 16:12:17 -05:00
end,
})
list.javascript = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-javascript",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@steelsojka" },
}
list.c = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-c",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@vigoux" },
}
2020-10-29 22:59:36 +09:00
list.clojure = {
install_info = {
url = "https://github.com/sogaiu/tree-sitter-clojure",
2021-03-07 16:28:07 +01:00
files = { "src/parser.c" },
2020-10-29 22:59:36 +09:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@sogaiu" },
2020-10-29 22:59:36 +09:00
}
2021-04-04 09:45:45 +02:00
list.commonlisp = {
install_info = {
2021-04-05 14:37:53 +02:00
url = "https://github.com/theHamsta/tree-sitter-commonlisp",
2021-04-04 09:45:45 +02:00
files = { "src/parser.c" },
generate_requires_npm = true,
2021-04-04 09:45:45 +02:00
},
2021-07-04 16:12:17 -05:00
filetype = "lisp",
maintainers = { "@theHamsta" },
2021-04-04 09:45:45 +02:00
}
list.cpp = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-cpp",
2021-03-07 17:05:16 +01:00
files = { "src/parser.c", "src/scanner.cc" },
generate_requires_npm = true,
2020-07-15 16:03:21 +02:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@theHamsta" },
2021-06-09 18:47:31 +02:00
}
list.cuda = {
install_info = {
url = "https://github.com/theHamsta/tree-sitter-cuda",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c", "src/scanner.cc" },
2021-06-16 20:47:45 +02:00
generate_requires_npm = true,
2021-06-09 18:47:31 +02:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@theHamsta" },
}
2021-10-01 11:33:33 +02:00
list.d = {
install_info = {
url = "https://github.com/CyberShadow/tree-sitter-d",
files = { "src/parser.c", "src/scanner.cc" },
requires_generate_from_grammar = true,
},
maintainers = { "@nawordar" },
-- Generating grammar takes ~60s
experimental = true,
}
2021-09-11 17:26:06 +02:00
list.glsl = {
install_info = {
url = "https://github.com/theHamsta/tree-sitter-glsl",
files = { "src/parser.c" },
generate_requires_npm = true,
},
maintainers = { "@theHamsta" },
}
list.dockerfile = {
install_info = {
url = "https://github.com/camdencheek/tree-sitter-dockerfile",
branch = "main",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@camdencheek" },
}
list.dot = {
install_info = {
url = "https://github.com/rydesun/tree-sitter-dot",
branch = "main",
files = { "src/parser.c" },
},
maintainers = { "@rydesun" },
}
list.rust = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-rust",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@vigoux" },
}
list.fusion = {
install_info = {
url = "https://gitlab.com/jirgn/tree-sitter-fusion.git",
files = { "src/parser.c", "src/scanner.c" },
branch = "main",
},
maintainers = { "@jirgn" },
}
list.ledger = {
install_info = {
url = "https://github.com/cbarrete/tree-sitter-ledger",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@cbarrete" },
}
list.lua = {
install_info = {
url = "https://github.com/MunifTanjim/tree-sitter-lua",
branch = "main",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@muniftanjim" },
}
list.python = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-python",
files = { "src/parser.c", "src/scanner.cc" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@stsewd", "@theHamsta" },
}
list.go = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-go",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@theHamsta", "@WinWisely268" },
}
list.gomod = {
install_info = {
url = "https://github.com/camdencheek/tree-sitter-go-mod",
2021-04-28 08:12:20 -06:00
branch = "main",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@camdencheek" },
filetype = "gomod",
}
list.gowork = {
install_info = {
url = "https://github.com/omertuc/tree-sitter-go-work",
branch = "main",
files = { "src/parser.c" },
},
maintainers = { "@omertuc" },
filetype = "gowork",
}
2020-11-22 17:14:13 -06:00
list.graphql = {
install_info = {
url = "https://github.com/bkegley/tree-sitter-graphql",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@bkegley" },
2020-11-22 17:14:13 -06:00
}
list.ruby = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-ruby",
files = { "src/parser.c", "src/scanner.cc" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@TravonteD" },
}
2021-08-27 07:30:22 -07:00
list.perl = {
install_info = {
2021-08-27 07:38:34 -07:00
url = "https://github.com/ganezdragon/tree-sitter-perl",
2021-08-27 07:30:22 -07:00
files = { "src/parser.c", "src/scanner.cc" },
generate_requires_npm = true,
},
maintainers = { "@ganezdragon" },
}
list.bash = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-bash",
files = { "src/parser.c", "src/scanner.cc" },
},
2021-07-04 16:12:17 -05:00
filetype = "sh",
maintainers = { "@TravonteD" },
}
list.fish = {
install_info = {
2021-07-19 18:52:01 +02:00
url = "https://github.com/ram02z/tree-sitter-fish",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-19 18:52:01 +02:00
maintainers = { "@ram02z" },
}
list.php = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-php",
files = { "src/parser.c", "src/scanner.cc" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@tk-shirasaka" },
}
list.java = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-java",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@p00f" },
}
2021-03-11 00:57:54 +01:00
list.kotlin = {
install_info = {
url = "https://github.com/fwcd/tree-sitter-kotlin",
branch = "main",
files = { "src/parser.c", "src/scanner.c" },
2021-03-11 00:57:54 +01:00
},
2022-01-07 00:09:48 +03:00
maintainers = { "@SalBakraa" },
2021-03-11 00:57:54 +01:00
}
2020-11-30 22:58:52 +01:00
list.html = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-html",
files = { "src/parser.c", "src/scanner.cc" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@TravonteD" },
}
list.julia = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-julia",
files = { "src/parser.c", "src/scanner.c" },
2020-12-28 17:55:07 +01:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@mroavi", "@theHamsta" },
}
list.json = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-json",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@steelsojka" },
}
list.css = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-css",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@TravonteD" },
}
2021-03-27 18:10:31 +07:00
list.scss = {
install_info = {
url = "https://github.com/serenadeai/tree-sitter-scss",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c", "src/scanner.c" },
2021-03-27 18:10:31 +07:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@elianiva" },
2021-03-27 18:10:31 +07:00
}
2020-12-07 08:17:37 +01:00
list.erlang = {
install_info = {
url = "https://github.com/AbstractMachinesLab/tree-sitter-erlang",
2020-12-10 13:14:59 +01:00
files = { "src/parser.c" },
2020-12-10 17:23:21 +01:00
branch = "main",
2020-12-07 08:17:37 +01:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@ostera" },
2020-12-07 08:17:37 +01:00
}
2021-05-14 21:23:58 +02:00
list.elixir = {
install_info = {
2021-10-05 19:34:18 -07:00
url = "https://github.com/elixir-lang/tree-sitter-elixir",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c", "src/scanner.cc" },
2021-10-05 19:34:18 -07:00
branch = "main",
2021-05-14 21:23:58 +02:00
},
maintainers = { "@jonatanklosko", "@connorlay" },
2021-05-14 21:23:58 +02:00
}
2022-02-05 09:38:29 -08:00
list.gleam = {
install_info = {
url = "https://github.com/J3RN/tree-sitter-gleam",
files = { "src/parser.c" },
branch = "main",
},
maintainers = { "@connorlay" },
2022-02-05 09:38:29 -08:00
}
list.surface = {
install_info = {
url = "https://github.com/connorlay/tree-sitter-surface",
files = { "src/parser.c" },
branch = "main",
},
filetype = "sface",
maintainers = { "@connorlay" },
}
list.eex = {
install_info = {
url = "https://github.com/connorlay/tree-sitter-eex",
files = { "src/parser.c" },
branch = "main",
},
filetype = "eex",
maintainers = { "@connorlay" },
}
list.heex = {
install_info = {
url = "https://github.com/connorlay/tree-sitter-heex",
files = { "src/parser.c" },
branch = "main",
},
filetype = "heex",
maintainers = { "@connorlay" },
}
list.ocaml = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-ocaml",
files = { "src/parser.c", "src/scanner.cc" },
location = "tree-sitter-ocaml/ocaml",
},
2021-07-04 16:12:17 -05:00
maintainers = { "@undu" },
}
list.ocaml_interface = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-ocaml",
files = { "src/parser.c", "src/scanner.cc" },
location = "tree-sitter-ocaml_interface/interface",
},
2021-07-04 16:12:17 -05:00
maintainers = { "@undu" },
filetype = "ocamlinterface",
}
list.ocamllex = {
install_info = {
url = "https://github.com/atom-ocaml/tree-sitter-ocamllex",
files = { "src/parser.c", "src/scanner.cc" },
2021-07-04 16:12:17 -05:00
requires_generate_from_grammar = true,
},
2021-07-04 16:12:17 -05:00
maintainers = { "@undu" },
}
list.swift = {
install_info = {
url = "https://github.com/alex-pinkus/tree-sitter-swift",
files = { "src/parser.c", "src/scanner.c" },
2021-07-04 16:12:17 -05:00
requires_generate_from_grammar = true,
generate_requires_npm = true,
2021-07-04 16:12:17 -05:00
},
}
list.c_sharp = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-c-sharp",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-04 16:12:17 -05:00
filetype = "cs",
maintainers = { "@Luxed" },
}
2022-02-28 14:07:23 +01:00
list.todotxt = {
install_info = {
url = "https://github.com/arnarg/tree-sitter-todotxt.git",
files = { "src/parser.c" },
branch = "main",
},
filetype = "todotxt",
maintainers = { "@arnarg" },
experimental = true,
}
list.typescript = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-typescript",
files = { "src/parser.c", "src/scanner.c" },
2021-03-07 17:05:16 +01:00
location = "tree-sitter-typescript/typescript",
generate_requires_npm = true,
},
2021-07-04 16:12:17 -05:00
maintainers = { "@steelsojka" },
}
list.tsx = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-typescript",
files = { "src/parser.c", "src/scanner.c" },
2021-03-07 17:05:16 +01:00
location = "tree-sitter-tsx/tsx",
generate_requires_npm = true,
},
2021-07-04 16:12:17 -05:00
filetype = "typescriptreact",
maintainers = { "@steelsojka" },
}
list.scala = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-scala",
files = { "src/parser.c", "src/scanner.c" },
2021-07-04 16:12:17 -05:00
},
maintainers = { "@stevanmilic" },
}
list.supercollider = {
install_info = {
url = "https://github.com/madskjeldgaard/tree-sitter-supercollider",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c", "src/scanner.c" },
branch = "main",
},
2021-07-04 16:12:17 -05:00
maintainers = { "@madskjeldgaard" },
filetype = "supercollider",
}
list.slint = {
install_info = {
url = "https://github.com/jrmoulton/tree-sitter-slint",
files = { "src/parser.c" },
branch = "main",
},
maintainers = { "@jrmoulton" },
experimental = true,
}
list.haskell = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-haskell",
files = { "src/parser.c", "src/scanner.c" },
2021-07-04 16:12:17 -05:00
},
}
2021-06-28 19:11:33 +02:00
list.hcl = {
install_info = {
url = "https://github.com/MichaHoffmann/tree-sitter-hcl",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c", "src/scanner.cc" },
branch = "main",
2021-06-28 19:11:33 +02:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@MichaHoffmann" },
2021-06-28 19:11:33 +02:00
filetype = "hcl",
}
list.markdown = {
install_info = {
url = "https://github.com/MDeiml/tree-sitter-markdown",
files = { "src/parser.c", "src/scanner.cc" },
branch = "main",
},
experimental = true,
}
2021-08-18 12:48:01 -04:00
list.tlaplus = {
install_info = {
url = "https://github.com/tlaplus-community/tree-sitter-tlaplus",
files = { "src/parser.c", "src/scanner.cc" },
2021-08-18 12:48:01 -04:00
},
maintainers = { "@ahelwer", "@susliko" },
filetype = "tla",
2021-08-18 12:48:01 -04:00
}
list.toml = {
install_info = {
url = "https://github.com/ikatyang/tree-sitter-toml",
files = { "src/parser.c", "src/scanner.c" },
2021-03-07 17:05:16 +01:00
generate_requires_npm = true,
},
2021-07-04 16:12:17 -05:00
maintainers = { "@tk-shirasaka" },
}
2021-02-28 17:40:35 -05:00
list.glimmer = {
install_info = {
url = "https://github.com/alexlafroscia/tree-sitter-glimmer",
files = { "src/parser.c", "src/scanner.c" },
2021-07-04 16:12:17 -05:00
branch = "main",
2021-02-28 17:40:35 -05:00
},
readme_name = "Glimmer and Ember",
maintainers = { "@alexlafroscia" },
2021-07-04 16:12:17 -05:00
filetype = "handlebars",
2021-02-28 17:40:35 -05:00
}
list.pug = {
install_info = {
url = "https://github.com/zealot128/tree-sitter-pug",
files = { "src/parser.c", "src/scanner.cc" },
},
maintainers = { "@zealot128" },
filetype = "pug",
}
list.vue = {
install_info = {
url = "https://github.com/ikatyang/tree-sitter-vue",
files = { "src/parser.c", "src/scanner.cc" },
2021-02-17 09:37:56 +01:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@WhyNotHugo" },
}
2021-02-15 18:35:13 +01:00
list.jsonc = {
install_info = {
2021-03-02 17:44:20 +01:00
url = "https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git",
2021-02-15 18:35:13 +01:00
files = { "src/parser.c" },
2021-03-07 17:05:16 +01:00
generate_requires_npm = true,
2021-02-17 09:43:59 +01:00
},
readme_name = "JSON with comments",
2021-07-04 16:12:17 -05:00
maintainers = { "@WhyNotHugo" },
2021-02-15 18:35:13 +01:00
}
list.elm = {
install_info = {
url = "https://github.com/elm-tooling/tree-sitter-elm",
files = { "src/parser.c", "src/scanner.cc" },
2021-07-04 16:12:17 -05:00
},
}
list.yaml = {
install_info = {
url = "https://github.com/ikatyang/tree-sitter-yaml",
files = { "src/parser.c", "src/scanner.cc" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@stsewd" },
}
2021-07-19 07:44:03 +02:00
list.yang = {
install_info = {
url = "https://github.com/Hubro/tree-sitter-yang",
files = { "src/parser.c" },
},
maintainers = { "@Hubro" },
filetype = "yang",
}
list.ninja = {
install_info = {
url = "https://github.com/alemuller/tree-sitter-ninja",
files = { "src/parser.c" },
branch = "main",
},
maintainers = { "@alemuller" },
}
list.nix = {
install_info = {
url = "https://github.com/cstrahan/tree-sitter-nix",
2021-02-10 22:35:43 +01:00
files = { "src/parser.c", "src/scanner.c" },
2020-11-18 17:22:47 -05:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@leo60228" },
}
2020-07-22 16:09:23 +02:00
list.dart = {
install_info = {
url = "https://github.com/UserNobody14/tree-sitter-dart",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@Akin909" },
2020-07-22 16:09:23 +02:00
}
2020-07-26 09:38:53 -05:00
list.rst = {
install_info = {
url = "https://github.com/stsewd/tree-sitter-rst",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@stsewd" },
2020-07-26 09:38:53 -05:00
}
2020-08-16 20:11:56 -04:00
list.fennel = {
install_info = {
url = "https://github.com/travonted/tree-sitter-fennel",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@TravonteD" },
2020-08-16 20:11:56 -04:00
}
2020-10-04 19:39:12 -05:00
list.teal = {
install_info = {
url = "https://github.com/euclidianAce/tree-sitter-teal",
files = { "src/parser.c", "src/scanner.c" },
requires_generate_from_grammar = true,
2020-10-04 19:39:12 -05:00
},
2021-07-04 16:12:17 -05:00
maintainers = { "@euclidianAce" },
2020-10-04 19:39:12 -05:00
}
2020-09-30 00:30:26 +02:00
list.ql = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-ql",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@pwntester" },
2020-09-30 00:30:26 +02:00
}
2021-03-10 12:00:02 +01:00
list.verilog = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-verilog",
files = { "src/parser.c" },
generate_requires_npm = true,
},
maintainers = { "@zegervdv" },
-- The parser still uses API version 12, because it does not compile with 13
experimental = true,
2021-03-10 12:00:02 +01:00
}
2021-03-07 17:05:16 +01:00
list.pascal = {
install_info = {
url = "https://github.com/Isopod/tree-sitter-pascal.git",
files = { "src/parser.c" },
},
maintainers = { "@isopod" },
}
2020-07-16 12:59:35 +02:00
-- Parsers for injections
2022-02-01 12:51:31 +01:00
list.phpdoc = {
install_info = {
url = "https://github.com/claytonrcarter/tree-sitter-phpdoc",
files = { "src/parser.c", "src/scanner.c" },
-- parser.c in the repo still based on TS 0.17 due to other dependencies
requires_generate_from_grammar = true,
generate_requires_npm = true,
},
maintainers = { "@mikehaertl" },
experimental = true,
}
list.regex = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-regex",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@theHamsta" },
}
list.comment = {
install_info = {
url = "https://github.com/stsewd/tree-sitter-comment",
files = { "src/parser.c", "src/scanner.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@stsewd" },
}
2020-07-16 12:59:35 +02:00
list.jsdoc = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-jsdoc",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
maintainers = { "@steelsojka" },
2020-07-16 12:59:35 +02:00
}
list.query = {
2020-07-28 07:39:45 -05:00
install_info = {
url = "https://github.com/nvim-treesitter/tree-sitter-query",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c" },
},
readme_name = "Tree-sitter query language",
2021-07-04 16:12:17 -05:00
maintainers = { "@steelsojka" },
2020-07-28 07:39:45 -05:00
}
list.sparql = {
install_info = {
url = "https://github.com/BonaBeavis/tree-sitter-sparql",
files = { "src/parser.c" },
branch = "main",
},
maintainers = { "@bonabeavis" },
}
2020-11-17 17:28:53 -05:00
list.gdscript = {
install_info = {
url = "https://github.com/PrestonKnopp/tree-sitter-gdscript",
files = { "src/parser.c", "src/scanner.cc" },
},
readme_name = "Godot (gdscript)",
2021-07-04 16:12:17 -05:00
maintainers = { "@Shatur95" },
2020-11-17 17:28:53 -05:00
}
list.godot_resource = {
2021-07-28 19:52:29 +02:00
install_info = {
url = "https://github.com/PrestonKnopp/tree-sitter-godot-resource",
files = { "src/parser.c", "src/scanner.c" },
requires_generate_from_grammar = true,
},
filetype = "gdresource",
readme_name = "Godot Resources (gdresource)",
2021-07-28 19:52:29 +02:00
maintainers = { "@pierpo" },
}
2021-01-05 12:37:16 +01:00
list.turtle = {
install_info = {
url = "https://github.com/BonaBeavis/tree-sitter-turtle",
files = { "src/parser.c" },
branch = "main",
},
maintainers = { "@bonabeavis" },
}
list.devicetree = {
install_info = {
url = "https://github.com/joelspadin/tree-sitter-devicetree",
files = { "src/parser.c" },
branch = "main",
2021-07-04 16:12:17 -05:00
requires_generate_from_grammar = true,
},
2021-07-04 16:12:17 -05:00
filetype = "dts",
maintainers = { "@jedrzejboczar" },
}
2021-02-05 13:45:26 +07:00
list.svelte = {
install_info = {
url = "https://github.com/Himujjal/tree-sitter-svelte",
2021-03-07 17:05:16 +01:00
files = { "src/parser.c", "src/scanner.c" },
2021-02-05 13:45:26 +07:00
branch = "master",
},
maintainers = { "@elianiva" },
}
2021-03-09 21:06:07 +02:00
list.r = {
install_info = {
url = "https://github.com/r-lib/tree-sitter-r",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c" },
2021-03-09 21:06:07 +02:00
},
maintainers = { "@jimhester" },
}
2021-03-21 13:30:10 -04:00
list.beancount = {
2021-03-21 00:03:20 +01:00
install_info = {
url = "https://github.com/polarmutex/tree-sitter-beancount",
files = { "src/parser.c" },
branch = "master",
},
maintainers = { "@polarmutex" },
}
list.latex = {
install_info = {
url = "https://github.com/latex-lsp/tree-sitter-latex",
files = { "src/parser.c", "src/scanner.c" },
2021-03-21 00:03:20 +01:00
},
2021-07-04 16:12:17 -05:00
filetype = "tex",
maintainers = { "@theHamsta, @clason" },
2021-03-21 00:03:20 +01:00
}
list.bibtex = {
install_info = {
url = "https://github.com/latex-lsp/tree-sitter-bibtex",
files = { "src/parser.c" },
},
2021-07-04 16:12:17 -05:00
filetype = "bib",
maintainers = { "@theHamsta, @clason" },
2021-03-21 13:26:33 -04:00
}
2021-03-23 06:18:43 +05:30
list.zig = {
install_info = {
2021-08-08 18:54:24 +09:00
url = "https://github.com/maxxnino/tree-sitter-zig",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c" },
2021-08-08 18:54:24 +09:00
branch = "main",
2021-03-23 06:18:43 +05:30
},
filetype = "zig",
2021-08-08 18:54:24 +09:00
maintainers = { "@maxxnino" },
2021-03-23 06:18:43 +05:30
}
list.fortran = {
install_info = {
url = "https://github.com/stadelmanma/tree-sitter-fortran",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c", "src/scanner.cc" },
},
}
2021-06-20 21:37:07 +02:00
list.cmake = {
install_info = {
url = "https://github.com/uyha/tree-sitter-cmake",
2021-07-04 16:12:17 -05:00
files = { "src/parser.c", "src/scanner.cc" },
2021-06-20 21:37:07 +02:00
},
2021-06-21 21:25:03 +02:00
maintainers = { "@uyha" },
2021-06-20 21:37:07 +02:00
}
2021-04-18 09:57:02 +02:00
list.vim = {
install_info = {
url = "https://github.com/vigoux/tree-sitter-viml",
files = { "src/parser.c", "src/scanner.c" },
},
filetype = "vim",
maintainers = { "@vigoux" },
}
2021-08-24 18:23:16 -04:00
list.json5 = {
install_info = {
url = "https://github.com/Joakker/tree-sitter-json5",
files = { "src/parser.c" },
},
filetype = "json5",
maintainers = { "@Joakker" },
}
list.pioasm = {
install_info = {
url = "https://github.com/leo60228/tree-sitter-pioasm",
branch = "main",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@leo60228" },
}
2021-09-18 21:15:37 +01:00
list.hjson = {
install_info = {
url = "https://github.com/winston0410/tree-sitter-hjson",
files = { "src/parser.c" },
generate_requires_npm = true,
},
maintainers = { "@winston0410" },
}
2022-01-15 16:35:55 +02:00
list.hocon = {
install_info = {
url = "https://github.com/antosha417/tree-sitter-hocon",
files = { "src/parser.c" },
generate_requires_npm = true,
},
maintainers = { "@antosha417" },
}
2021-10-02 17:09:40 -04:00
list.llvm = {
install_info = {
url = "https://github.com/benwilliamgraham/tree-sitter-llvm",
2021-10-02 17:26:01 -04:00
branch = "main",
2021-10-02 17:09:40 -04:00
files = { "src/parser.c" },
},
maintainers = { "@benwilliamgraham" },
}
list.http = {
install_info = {
url = "https://github.com/NTBBloodbath/tree-sitter-http",
branch = "main",
files = { "src/parser.c" },
2021-11-04 23:12:21 +02:00
generate_requires_npm = true,
},
maintainers = { "@NTBBloodbath" },
}
2021-12-14 10:47:47 +00:00
2021-11-01 06:20:58 +07:00
list.prisma = {
install_info = {
url = "https://github.com/victorhqc/tree-sitter-prisma",
2021-11-01 06:20:58 +07:00
branch = "master",
files = { "src/parser.c" },
},
maintainers = { "@elianiva" },
}
2021-12-14 10:47:47 +00:00
list.make = {
install_info = {
url = "https://github.com/alemuller/tree-sitter-make",
branch = "main",
files = { "src/parser.c" },
},
maintainers = { "@lewis6991" },
}
list.rasi = {
install_info = {
url = "https://github.com/Fymyte/tree-sitter-rasi",
branch = "main",
files = { "src/parser.c" },
},
maintainers = { "@Fymyte" },
}
2021-12-14 13:45:56 +01:00
list.foam = {
install_info = {
url = "https://github.com/FoamScience/tree-sitter-foam",
branch = "master",
2022-01-07 16:49:33 +01:00
files = { "src/parser.c", "src/scanner.c" },
2021-12-14 13:45:56 +01:00
},
maintainers = { "@FoamScience" },
filetype = "foam",
-- Queries might change over time on the grammar's side
-- Otherwise everything runs fine
experimental = true,
}
2021-11-23 01:06:51 +01:00
list.hack = {
install_info = {
url = "https://github.com/slackhq/tree-sitter-hack",
branch = "main",
files = { "src/parser.c", "src/scanner.cc" },
},
}
2021-08-29 19:31:37 +02:00
list.norg = {
install_info = {
url = "https://github.com/nvim-neorg/tree-sitter-norg",
2021-08-29 19:31:37 +02:00
branch = "main",
files = { "src/parser.c", "src/scanner.cc" },
2021-09-09 22:11:07 +02:00
use_makefile = true,
cxx_standard = "c++14",
2021-08-29 19:31:37 +02:00
},
maintainers = { "@JoeyGrajciar", "@vhyrro", "@mrossinek" },
2021-08-29 19:31:37 +02:00
}
2022-01-28 19:13:39 -03:00
list.vala = {
install_info = {
url = "https://github.com/matbme/tree-sitter-vala",
branch = "main",
files = { "src/parser.c", "src/scanner.cc" },
2022-01-28 19:13:39 -03:00
},
maintainers = { "@matbme" },
}
list.lalrpop = {
install_info = {
url = "https://github.com/traxys/tree-sitter-lalrpop",
branch = "master",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@traxys" },
}
2022-03-10 19:14:49 +08:00
list.solidity = {
install_info = {
url = "https://github.com/YongJieYongJie/tree-sitter-solidity",
branch = "with-generated-c-code",
files = { "src/parser.c" },
},
maintainers = { "@YongJieYongJie" },
}
2022-03-14 10:01:14 -07:00
list.cooklang = {
install_info = {
url = "https://github.com/addcninblue/tree-sitter-cooklang",
branch = "master",
files = { "src/parser.c", "src/scanner.cc" },
},
maintainers = { "@addcninblue" },
}
local M = {
2021-07-04 16:12:17 -05:00
list = list,
filetype_to_parsername = filetype_to_parsername,
}
function M.ft_to_lang(ft)
local result = filetype_to_parsername[ft]
if result then
return result
else
ft = vim.split(ft, ".", true)[1]
return filetype_to_parsername[ft] or ft
end
end
function M.available_parsers()
2021-07-04 16:12:17 -05:00
if vim.fn.executable "tree-sitter" == 1 and vim.fn.executable "node" == 1 then
return vim.tbl_keys(M.list)
else
2021-07-04 16:12:17 -05:00
return vim.tbl_filter(function(p)
return not M.list[p].install_info.requires_generate_from_grammar
end, vim.tbl_keys(M.list))
end
end
function M.maintained_parsers()
2021-07-04 16:12:17 -05:00
local has_tree_sitter_cli = vim.fn.executable "tree-sitter" == 1 and vim.fn.executable "node" == 1
return vim.tbl_filter(function(lang)
return M.list[lang].maintainers
and not M.list[lang].experimental
2021-07-04 16:12:17 -05:00
and (has_tree_sitter_cli or not M.list[lang].install_info.requires_generate_from_grammar)
end, M.available_parsers())
end
function M.get_parser_configs()
return M.list
end
local parser_files
function M.reset_cache()
parser_files = setmetatable({}, {
__index = function(tbl, key)
2021-07-04 16:12:17 -05:00
rawset(tbl, key, api.nvim_get_runtime_file("parser/" .. key .. ".*", false))
return rawget(tbl, key)
2021-07-04 16:12:17 -05:00
end,
})
end
M.reset_cache()
function M.has_parser(lang)
lang = lang or M.get_buf_lang(api.nvim_get_current_buf())
2021-07-04 16:12:17 -05:00
if not lang or #lang == 0 then
return false
end
-- HACK: nvim internal API
2021-07-04 16:12:17 -05:00
if vim._ts_has_language(lang) then
return true
end
return #parser_files[lang] > 0
end
2020-04-19 17:54:27 +02:00
function M.get_parser(bufnr, lang)
bufnr = bufnr or api.nvim_get_current_buf()
lang = lang or M.get_buf_lang(bufnr)
if M.has_parser(lang) then
return ts.get_parser(bufnr, lang)
end
end
-- @deprecated This is only kept for legacy purposes.
-- All root nodes should be accounted for.
function M.get_tree_root(bufnr)
bufnr = bufnr or api.nvim_get_current_buf()
return M.get_parser(bufnr):parse()[1]:root()
end
2020-07-10 21:47:50 +02:00
-- get language of given buffer
-- @param optional buffer number or current buffer
-- @returns language string of buffer
function M.get_buf_lang(bufnr)
bufnr = bufnr or api.nvim_get_current_buf()
return M.ft_to_lang(api.nvim_buf_get_option(bufnr, "ft"))
end
return M