Skip to content

Commit

Permalink
Add newer fallback method for tree-sitter scopes (#2006)
Browse files Browse the repository at this point in the history
  • Loading branch information
pynappo authored Aug 1, 2024
1 parent d818fd0 commit ae644fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/cmp/config/compare.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ compare.scopes = setmetatable({

-- Cursor scope.
local cursor_scope = nil
for _, scope in ipairs(locals.get_scopes(buf)) do
-- Prioritize the older get_scopes method from nvim-treesitter `master` over get from `main`
local scopes = locals.get_scopes and locals.get_scopes(buf) or select(3, locals.get(buf))
for _, scope in ipairs(scopes) do
if scope:start() <= cursor_row and cursor_row <= scope:end_() then
if not cursor_scope then
cursor_scope = scope
Expand Down

0 comments on commit ae644fe

Please sign in to comment.