feat(install)!: add explicit path field to parser info (#6476)

Problem: Using `url` for both remote repo and local path complicates the
code.

Solution: Add `path` field that overrides `url` and bypasses
git-specific manipulations, i.e., the contents of the `path` are used
as-is (no git repo needed).

This means `:TSUpdate` will skip such parsers; use `:TSInstall!` instead
after making local changes.

---------

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
This commit is contained in:
Christian Clason 2024-04-21 00:14:12 +02:00
parent 4c3e77db67
commit 82ca00ed97
3 changed files with 55 additions and 77 deletions

View file

@ -1,18 +1,19 @@
---@class InstallInfo
---@field path? string
---@field url string
---@field branch string|nil
---@field revision string|nil Used to override lockfile revision
---@field branch? string
---@field revision? string
---@field files string[]
---@field generate_requires_npm boolean|nil
---@field requires_generate_from_grammar boolean|nil
---@field location string|nil
---@field generate_requires_npm? boolean
---@field generate? boolean
---@field location? string
---@class ParserInfo
---@field install_info InstallInfo?
---@field maintainers string[]?
---@field requires string[]?
---@field install_info? InstallInfo
---@field maintainers? string[]
---@field requires? string[]
---@field tier integer
---@field readme_note string|nil?
---@field readme_note? string
local M = {}
@ -1413,7 +1414,7 @@ M.configs = {
install_info = {
url = 'https://github.com/latex-lsp/tree-sitter-latex',
files = { 'src/parser.c', 'src/scanner.c' },
requires_generate_from_grammar = true,
generate = true,
},
maintainers = { '@theHamsta', '@clason' },
tier = 2,
@ -1591,7 +1592,7 @@ M.configs = {
install_info = {
url = 'https://github.com/artagnon/tree-sitter-mlir',
files = { 'src/parser.c' },
requires_generate_from_grammar = true,
generate = true,
},
maintainers = { '@artagnon' },
tier = 4,
@ -1731,7 +1732,7 @@ M.configs = {
install_info = {
url = 'https://github.com/atom-ocaml/tree-sitter-ocamllex',
files = { 'src/parser.c', 'src/scanner.c' },
requires_generate_from_grammar = true,
generate = true,
},
maintainers = { '@undu' },
tier = 3,
@ -2246,7 +2247,7 @@ M.configs = {
install_info = {
url = 'https://github.com/rockorager/tree-sitter-scfg',
files = { 'src/parser.c' },
requires_generate_from_grammar = true,
generate = true,
},
maintainers = { '@WhyNotHugo' },
tier = 3,
@ -2489,7 +2490,7 @@ M.configs = {
install_info = {
url = 'https://github.com/alex-pinkus/tree-sitter-swift',
files = { 'src/parser.c', 'src/scanner.c' },
requires_generate_from_grammar = true,
generate = true,
},
maintainers = { '@alex-pinkus' },
tier = 3,
@ -2544,7 +2545,7 @@ M.configs = {
install_info = {
url = 'https://github.com/euclidianAce/tree-sitter-teal',
files = { 'src/parser.c', 'src/scanner.c' },
requires_generate_from_grammar = true,
generate = true,
},
maintainers = { '@euclidianAce' },
tier = 3,
@ -2753,7 +2754,7 @@ M.configs = {
install_info = {
url = 'https://github.com/kylegoetz/tree-sitter-unison',
files = { 'src/parser.c', 'src/scanner.c' },
requires_generate_from_grammar = true,
generate = true,
},
maintainers = { '@tapegram' },
tier = 4,