Skip to content

Commit

Permalink
fix: compatibility with Neovim v0.8 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
WieeRd authored Apr 12, 2023
1 parent ff1e8d1 commit c4307e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/nvim-yati/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ function M.get_parser(bufnr)
return vim.treesitter.get_parser(bufnr, lang)
end

-- `get_lang` is only available in Neovim v0.9 and above
if vim.treesitter.language.get_lang == nil then
M.get_parser = require("nvim-treesitter.parser").get_parser
end

---@return string
function M.get_buf_line(bufnr, lnum)
return vim.api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1] or ""
Expand Down

0 comments on commit c4307e6

Please sign in to comment.