diff options
author | Steven Sojka <steelsojka@gmail.com> | 2021-01-17 12:51:28 -0600 |
---|---|---|
committer | Steven Sojka <Steven.Sojka@tdameritrade.com> | 2021-03-23 12:58:27 -0500 |
commit | 2a794b8f5d801a49724ff04213c38131e930ab99 (patch) | |
tree | 643c727f4f7d3e2e4e3bcd76a67532fb68625f3b /runtime/lua/vim/treesitter/query.lua | |
parent | 9f5c8226bba43b6c9ae253e6b94b41d9d140a626 (diff) | |
download | rneovim-2a794b8f5d801a49724ff04213c38131e930ab99.tar.gz rneovim-2a794b8f5d801a49724ff04213c38131e930ab99.tar.bz2 rneovim-2a794b8f5d801a49724ff04213c38131e930ab99.zip |
fix(treesitter): dedupe runtime file list
Diffstat (limited to 'runtime/lua/vim/treesitter/query.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/query.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua index 8b94348994..1b29618997 100644 --- a/runtime/lua/vim/treesitter/query.lua +++ b/runtime/lua/vim/treesitter/query.lua @@ -8,10 +8,23 @@ Query.__index = Query 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) 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 |