Skip to content

Commit 2a8847d

Browse files
committed
Add config for goals accomplished and no goals
1 parent d6d4804 commit 2a8847d

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

lsp/leanls.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,16 @@ return {
217217
},
218218
on_init = function(_, response)
219219
local version = response.serverInfo.version
220+
local markers = CONFIG.goal_markers
220221
---Lean 4.19 introduces silent diagnostics, which we use to differentiate
221-
---between "No goals." and "Goals accomplished. For older versions, we
222+
---between "No goals." and "Goals accomplished". For older versions, we
222223
---always say the latter (which is consistent with `lean.nvim`'s historic
223224
---behavior, albeit not with VSCode's).
224225
---
225226
---Technically this being a global is wrong, and will mean we start
226227
---showing the wrong message if someone opens an older Lean buffer in the
227228
---same session as a newer one...
228-
vim.g.lean_no_goals_message = vim.version.ge(version, '0.3.0') and 'No goals.'
229-
or 'Goals accomplished 🎉'
229+
vim.g.lean_no_goals_message = vim.version.ge(version, '0.3.0') and markers.no_goals
230+
or markers.goals_accomplished
230231
end,
231232
}

lua/lean/config.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
---@class lean.goal_markers.Config
4343
---@field unsolved? string a character which will be placed on buffer lines where there is an unsolved goal
4444
---@field accomplished? string a character which will be placed in the sign column of successful proofs
45+
---@field goals_accomplished? string a string to display in the infoview when the proof is successful
46+
---@field no_goals? string a string to display in the infoview when there are no active goals
4547

4648
---@class lean.infoview.Config
4749
---@field mappings? { [string]: ElementEvent }
@@ -95,6 +97,8 @@ local DEFAULTS = {
9597
goal_markers = {
9698
unsolved = '',
9799
accomplished = '🎉',
100+
goals_accomplished = 'Goals accomplished 🎉',
101+
no_goals = 'No goals.',
98102
},
99103

100104
---@type Log

lua/lean/infoview/components.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ function components.goal_at(params, sess, use_widgets)
8888
end
8989

9090
local title
91+
local markers = config().goal_markers
9192
if lsp.goals_accomplished_at(params) then
92-
title = 'Goals accomplished 🎉'
93+
title = markers.goals_accomplished
9394
elseif goal and #goal == 0 then -- between goals / Lean <4.19 with no markers
94-
title = vim.g.lean_no_goals_message or 'No goals.'
95+
title = vim.g.lean_no_goals_message or markers.no_goals
9596
else
9697
return children, err
9798
end

0 commit comments

Comments
 (0)