Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lua/treesitter-context/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,11 @@ local function get_parent_langtrees(bufnr, range)
return {}
end

--- @diagnostic disable-next-line:redundant-parameter added in 0.11
root_tree:parse(range, function(...) end)
local function try_parse(tree, r, cb)
local ok = pcall(function() tree:parse({ r }, cb) end)
if not ok then tree:parse(r, cb) end
end
try_parse(root_tree, range, function(...) end)
Comment on lines +238 to +242

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So pcall() is just to fix some test environment error? Feels wrong to use it :/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! I didn't mean to set this PR as ready to review just yet. Let me play around with this more and I will message you when it's ready for review.

local ret = { root_tree }

while true do
Expand Down
Loading