aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/update-readme.lua
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-04-14 16:25:28 +0200
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commitc17de5689045f75c6244462182ae3b4b62df02d9 (patch)
treeec7785ec523ad4704d09bb5dc5393e1f00046508 /scripts/update-readme.lua
parentfix: vim.tbl_flatten is deprecated (diff)
downloadnvim-treesitter-c17de5689045f75c6244462182ae3b4b62df02d9.tar
nvim-treesitter-c17de5689045f75c6244462182ae3b4b62df02d9.tar.gz
nvim-treesitter-c17de5689045f75c6244462182ae3b4b62df02d9.tar.bz2
nvim-treesitter-c17de5689045f75c6244462182ae3b4b62df02d9.tar.lz
nvim-treesitter-c17de5689045f75c6244462182ae3b4b62df02d9.tar.xz
nvim-treesitter-c17de5689045f75c6244462182ae3b4b62df02d9.tar.zst
nvim-treesitter-c17de5689045f75c6244462182ae3b4b62df02d9.zip
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.
Diffstat (limited to 'scripts/update-readme.lua')
-rwxr-xr-xscripts/update-readme.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/update-readme.lua b/scripts/update-readme.lua
index f8346bf4d..9f6f9a3de 100755
--- a/scripts/update-readme.lua
+++ b/scripts/update-readme.lua
@@ -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