Skip to content

Commit 27bfc20

Browse files
committed
Pass along more errors from infoview components.
We fall back to plain goals when interactive requests fail, but let's pass along the error at least if it occurs (and prefer it if errors occur with both).
1 parent cffe407 commit 27bfc20

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lua/lean/infoview/components.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,13 +572,13 @@ end
572572
---@return Element[]? goal
573573
---@return LspError? error
574574
function components.goal_at(params, sess, use_widgets)
575-
local goal, err
575+
local goal, interactive_err, err
576576
if use_widgets ~= false then
577577
if sess == nil then
578578
sess = rpc.open(params)
579579
end
580580

581-
goal = sess:getInteractiveGoals(params)
581+
goal, interactive_err = sess:getInteractiveGoals(params)
582582
goal = goal and components.interactive_goals(goal, sess)
583583
end
584584

@@ -588,7 +588,7 @@ function components.goal_at(params, sess, use_widgets)
588588
goal = goal and components.plain_goal(goal)
589589
end
590590

591-
return goal, err
591+
return goal, interactive_err or err
592592
end
593593

594594
---@param params lsp.TextDocumentPositionParams
@@ -597,13 +597,13 @@ end
597597
---@return Element[]?
598598
---@return LspError?
599599
function components.term_goal_at(params, sess, use_widgets)
600-
local term_goal, err
600+
local term_goal, interactive_err, err
601601
if use_widgets ~= false then
602602
if sess == nil then
603603
sess = rpc.open(params)
604604
end
605605

606-
term_goal = sess:getInteractiveTermGoal(params)
606+
term_goal, interactive_err = sess:getInteractiveTermGoal(params)
607607
term_goal = term_goal and components.interactive_term_goal(term_goal, sess)
608608
end
609609

@@ -613,7 +613,7 @@ function components.term_goal_at(params, sess, use_widgets)
613613
term_goal = term_goal and components.term_goal(term_goal)
614614
end
615615

616-
return term_goal, err
616+
return term_goal, interactive_err or err
617617
end
618618

619619
---@param params lsp.TextDocumentPositionParams

0 commit comments

Comments
 (0)