mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 19:35:37 +00:00
fix(treesitter): dedupe runtime file list
This commit is contained in:
committed by
Steven Sojka
parent
9f5c8226bb
commit
2a794b8f5d
@@ -8,10 +8,23 @@ Query.__index = Query
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
local function dedupe_files(files)
|
||||||
|
local result = {}
|
||||||
|
local seen = {}
|
||||||
|
|
||||||
|
for _, path in ipairs(files) do
|
||||||
|
if not seen[path] then
|
||||||
|
table.insert(result, path)
|
||||||
|
seen[path] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
function M.get_query_files(lang, query_name, is_included)
|
function M.get_query_files(lang, query_name, is_included)
|
||||||
local query_path = string.format('queries/%s/%s.scm', lang, query_name)
|
local query_path = string.format('queries/%s/%s.scm', lang, query_name)
|
||||||
local lang_files = a.nvim_get_runtime_file(query_path, true)
|
local lang_files = dedupe_files(a.nvim_get_runtime_file(query_path, true))
|
||||||
|
|
||||||
if #lang_files == 0 then return {} end
|
if #lang_files == 0 then return {} end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user