mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-07 14:00:00 -04:00
feat!: track parser revision in Lua
Problem: Tracking parser revision in lockfile and allowing override through the parsers module complicates the code. In addition, only revision changes are handled robustly, not changes to other installation info. Solution: Track parser revision in the parsers module directly. Reload parser table on every install or update call. Support modifying parser table in a `User TSUpdate` autocommand.
This commit is contained in:
parent
054080bf59
commit
c17de56890
21 changed files with 1007 additions and 995 deletions
|
|
@ -2,12 +2,13 @@
|
|||
vim.opt.runtimepath:append('.')
|
||||
local util = require('nvim-treesitter.util')
|
||||
local parsers = require('nvim-treesitter.parsers')
|
||||
local tiers = require('nvim-treesitter.config').tiers
|
||||
---@class Parser
|
||||
---@field name string
|
||||
---@field parser ParserInfo
|
||||
|
||||
local sorted_parsers = {}
|
||||
for k, v in pairs(parsers.configs) do
|
||||
for k, v in pairs(parsers) do
|
||||
table.insert(sorted_parsers, { name = k, parser = v })
|
||||
end
|
||||
table.sort(sorted_parsers, function(a, b)
|
||||
|
|
@ -45,7 +46,7 @@ for _, v in ipairs(sorted_parsers) do
|
|||
end
|
||||
|
||||
-- tier
|
||||
generated_text = generated_text .. (p.tier and parsers.tiers[p.tier] or '') .. ' | '
|
||||
generated_text = generated_text .. (p.tier and tiers[p.tier] or '') .. ' | '
|
||||
|
||||
-- queries
|
||||
generated_text = generated_text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue