aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2021-03-07 17:05:16 +0100
committerKiyan <yazdani.kiyan@protonmail.com>2021-03-16 18:52:43 +0100
commit532a369b3267c144b294abcdf13b999e36e27e12 (patch)
tree9f7fbab95689a0814320f8397e4c1682626c65db /lua
parentMake parsers that require "TSGenerateFromGrammar" (diff)
downloadnvim-treesitter-532a369b3267c144b294abcdf13b999e36e27e12.tar
nvim-treesitter-532a369b3267c144b294abcdf13b999e36e27e12.tar.gz
nvim-treesitter-532a369b3267c144b294abcdf13b999e36e27e12.tar.bz2
nvim-treesitter-532a369b3267c144b294abcdf13b999e36e27e12.tar.lz
nvim-treesitter-532a369b3267c144b294abcdf13b999e36e27e12.tar.xz
nvim-treesitter-532a369b3267c144b294abcdf13b999e36e27e12.tar.zst
nvim-treesitter-532a369b3267c144b294abcdf13b999e36e27e12.zip
Mark parsers with NPM dependency
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/install.lua13
-rw-r--r--lua/nvim-treesitter/parsers.lua36
2 files changed, 37 insertions, 12 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index ff43bca98..09eeb1d86 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -174,6 +174,19 @@ local function run_install(cache_folder, install_folder, lang, repo, with_sync,
vim.list_extend(command_list, shell.select_download_commands(repo, project_name, cache_folder, revision))
end
if generate_from_grammar then
+ if repo.generate_requires_npm then
+ vim.list_extend(command_list, {
+ {
+ cmd = 'npm',
+ info = 'Installing NPM dependencies of '..lang..' parser',
+ err = 'Error during `npm install` (required for parser generation of '..lang..' with npm dependencies)',
+ opts = {
+ args = {'install'},
+ cwd = compile_location
+ }
+ }
+ })
+ end
vim.list_extend(command_list, {
{
cmd = 'tree-sitter',
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index fb159804a..051678619 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -58,7 +58,8 @@ list.clojure = {
list.cpp = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-cpp",
- files = { "src/parser.c", "src/scanner.cc" }
+ files = { "src/parser.c", "src/scanner.cc" },
+ generate_requires_npm = true,
},
used_by = { "cuda" },
maintainers = {"@theHamsta"},
@@ -148,14 +149,16 @@ list.java = {
maintainers = {"@p00f"},
}
-list.kotlin = {
- install_info = {
- url = "https://github.com/QthCN/tree-sitter-kotlin",
- files = { "src/parser.c" },
- requires_generate_from_grammar = true,
- },
- maintainers = {"@tormodatt"},
-}
+---Parser generation from source does not terminate in reasonable time
+--list.kotlin = {
+ --install_info = {
+ --url = "https://github.com/QthCN/tree-sitter-kotlin",
+ --files = { "src/parser.c" },
+ --requires_generate_from_grammar = true,
+ --generate_requires_npm = true,
+ --},
+ --maintainers = {"@tormodatt"},
+--}
list.html = {
install_info = {
@@ -249,7 +252,8 @@ list.typescript = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-typescript",
files = { "src/parser.c", "src/scanner.c" },
- location = "tree-sitter-typescript/typescript"
+ location = "tree-sitter-typescript/typescript",
+ generate_requires_npm = true,
},
maintainers = {"@steelsojka"},
}
@@ -258,7 +262,8 @@ list.tsx = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-typescript",
files = { "src/parser.c", "src/scanner.c" },
- location = "tree-sitter-tsx/tsx"
+ location = "tree-sitter-tsx/tsx",
+ generate_requires_npm = true,
},
used_by = { "typescript.tsx" },
filetype = 'typescriptreact'
@@ -302,6 +307,7 @@ list.toml = {
url = "https://github.com/ikatyang/tree-sitter-toml",
files = { "src/parser.c", "src/scanner.c" },
requires_generate_from_grammar = true,
+ generate_requires_npm = true,
},
maintainers = {"@tk-shirasaka"},
}
@@ -332,6 +338,7 @@ list.jsonc = {
url = "https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git",
files = { "src/parser.c" },
requires_generate_from_grammar = true,
+ generate_requires_npm = true,
},
readme_name = "JSON with comments",
maintainers = {"@WhyNotHugo"},
@@ -404,14 +411,18 @@ list.ql = {
maintainers = {'@pwntester'},
}
+---Parser generation from source takes a looong time!
list.verilog = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-verilog",
files = { "src/parser.c" },
+ requires_generate_from_grammar = true,
+ generate_requires_npm = true,
},
used_by = { "systemverilog" },
maintainers = { "@zegervdv" },
}
+
-- Parsers for injections
list.regex = {
install_info = {
@@ -491,8 +502,9 @@ list.devicetree = {
list.svelte = {
install_info = {
url = "https://github.com/Himujjal/tree-sitter-svelte",
- files = { "src/parser.c", "src/scanner.cc" },
+ files = { "src/parser.c", "src/scanner.c" },
branch = "master",
+ requires_generate_from_grammar = true,
},
maintainers = { "@elianiva" },
}