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>
This commit is contained in:
Riley BruinsandLewis Russell authored and Christian Clason committed 2024-07-17 12:13:53 +02:00
1 parent c7b0334cea
commit 05dcda8f9b
1 file changed
+2 -1
+2 -1
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