Skip to content

Commit

Permalink
fix(treesitter): deprecated call. Fixes #408
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Mar 24, 2023
1 parent f8b1a72 commit 1ded575
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/noice/text/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function M.has_lang(lang)
lang = vim.treesitter.language.get_lang(lang) or lang
return pcall(vim.treesitter.language.add, lang)
end
---@diagnostic disable-next-line: deprecated
return vim.treesitter.language.require_language(lang, nil, true)
end

Expand Down Expand Up @@ -56,7 +57,9 @@ function M.highlight(buf, ns, range, lang)
return
end

local highlighter_query = vim.treesitter.query.get_query(tree:lang(), "highlights")
local highlighter_query = vim.treesitter.query.get and vim.treesitter.query.get(tree:lang(), "highlights")
---@diagnostic disable-next-line: deprecated
or vim.treesitter.query.get_query(tree:lang(), "highlights")

-- Some injected languages may not have highlight queries.
if not highlighter_query then
Expand Down

0 comments on commit 1ded575

Please sign in to comment.