Skip to content

Commit a0756ce

Browse files
committed
Add config for goals accomplished and no goals
1 parent 850c431 commit a0756ce

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

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

lua/lean/lsp.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,17 @@ function lsp.enable(opts)
213213
},
214214
on_init = function(_, response)
215215
local version = response.serverInfo.version
216+
local markers = config().goal_markers
216217
---Lean 4.19 introduces silent diagnostics, which we use to differentiate
217-
---between "No goals." and "Goals accomplished. For older versions, we
218+
---between "No goals." and "Goals accomplished." For older versions, we
218219
---always say the latter (which is consistent with `lean.nvim`'s historic
219220
---behavior, albeit not with VSCode's).
220221
---
221222
---Technically this being a global is wrong, and will mean we start
222223
---showing the wrong message if someone opens an older Lean buffer in the
223224
---same session as a newer one...
224-
vim.g.lean_no_goals_message = vim.version.ge(version, '0.3.0') and 'No goals.'
225-
or 'Goals accomplished 🎉'
225+
vim.g.lean_no_goals_message = vim.version.ge(version, '0.3.0') and markers.no_goals
226+
or markers.goals_accomplished
226227
end,
227228
})
228229
require('lspconfig').leanls.setup(opts)

0 commit comments

Comments
 (0)