Skip to content

Commit 6f6de40

Browse files
committed
Add config for goals accomplished and no goals
1 parent 8cd6a70 commit 6f6de40

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

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
@@ -87,10 +87,11 @@ function components.goal_at(params, sess, use_widgets)
8787
end
8888

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

lua/lean/lsp.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,17 @@ function lsp.enable(opts)
330330
},
331331
on_init = function(_, response)
332332
local version = response.serverInfo.version
333+
local markers = config().goal_markers
333334
---Lean 4.19 introduces silent diagnostics, which we use to differentiate
334-
---between "No goals." and "Goals accomplished. For older versions, we
335+
---between "No goals." and "Goals accomplished." For older versions, we
335336
---always say the latter (which is consistent with `lean.nvim`'s historic
336337
---behavior, albeit not with VSCode's).
337338
---
338339
---Technically this being a global is wrong, and will mean we start
339340
---showing the wrong message if someone opens an older Lean buffer in the
340341
---same session as a newer one...
341-
vim.g.lean_no_goals_message = vim.version.ge(version, '0.3.0') and 'No goals.'
342-
or 'Goals accomplished 🎉'
342+
vim.g.lean_no_goals_message = vim.version.ge(version, '0.3.0') and markers.no_goals
343+
or markers.goals_accomplished
343344
end,
344345
})
345346
require('lspconfig').leanls.setup(opts)

0 commit comments

Comments
 (0)