fix(treesitter): recognize aliased parsers in omnifunc, query linter

**Problem:** A query file for something like `html_tags` will not be
given html node completion

**Solution:** Check for parser aliases before offering completions

Co-authored-by: Lewis Russell <me@lewisr.dev>
(cherry picked from commit 05dcda8f9b)
This commit is contained in:
Riley Bruins 2024-07-14 08:10:19 -07:00 committed by Christian Clason
parent e13f03af85
commit eb53aba5af

View File

@ -40,7 +40,8 @@ end
local function guess_query_lang(buf)
local filename = api.nvim_buf_get_name(buf)
if filename ~= '' then
return vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
local resolved_filename = vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
return resolved_filename and vim.treesitter.language.get_lang(resolved_filename) or nil
end
end