On nvim-treesitter main, some of the methods used in cmp's compare.scopes now error instead of returning an empty table when no tree-sitter parser exists (specifically, locals.get_*). This implements a basic fix.
Leaving it as a draft because:
Not sure if this difference in behavior is final.
Not sure on the best way to track whether a buffer has tree-sitter parsing.
Maybe track the buffers in compare.scopes instead of vim.b?
Would it be better to not track buffers and just pcall the affected locals.get_* methods?
Not sure about modifying autocmd helpers to include the lua callback table.
Edit: This PR has also turned into an overhaul of compare.scopes:
Improves performance a bit by only looping over definitions once per update()
Clears previous results on each update, leading to more expected sorting (previously, nothing ever got removed or modified once it was put into the scopes_map).
edit2: I can also revert the renaming of the variables if you'd like, I just did it out of my preference when I was changing the function around
On nvim-treesitter
main
, some of the methods used in cmp'scompare.scopes
now error instead of returning an empty table when no tree-sitter parser exists (specifically,locals.get_*
). This implements a basic fix.Leaving it as a draft because:compare.scopes
instead ofvim.b
?pcall
the affectedlocals.get_*
methods?Edit: This PR has also turned into an overhaul of
compare.scopes
:definitions
once perupdate()
update
, leading to more expected sorting (previously, nothing ever got removed or modified once it was put into thescopes_map
).edit2: I can also revert the renaming of the variables if you'd like, I just did it out of my preference when I was changing the function around