Skip to content

Commit

Permalink
fix: Use vim.treesitter.get_node_text() to avoid deprecation warning (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yutkat committed Apr 24, 2023
1 parent f55a3e7 commit e28fb7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/cmp/config/compare.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ compare.scopes = setmetatable({
for _, definition in pairs(definitions) do
if s <= definition.node:start() and definition.node:end_() <= e then
if scope:id() == locals.containing_scope(definition.node, buf):id() then
local text = vim.treesitter.query.get_node_text(definition.node, buf) or ''
local get_node_text = vim.treesitter.get_node_text or vim.treesitter.query.get_node_text
local text = get_node_text(definition.node, buf) or ''
if not self.scopes_map[text] then
self.scopes_map[text] = depth
end
Expand Down

0 comments on commit e28fb7a

Please # to comment.