Skip to content

Commit

Permalink
Fix scopes comparator
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsh7th committed Apr 20, 2022
1 parent 07132dc commit f9f6d8d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/cmp/config/compare.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ 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)[1]
local text = vim.treesitter.query.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 f9f6d8d

Please sign in to comment.