Skip to content

Commit 0e92b4d

Browse files
committed
Add config for goals accomplished and no goals
1 parent 35b0aae commit 0e92b4d

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 }
@@ -94,6 +96,8 @@ local DEFAULTS = {
9496
goal_markers = {
9597
unsolved = '',
9698
accomplished = '🎉',
99+
goals_accomplished = 'Goals accomplished 🎉',
100+
no_goals = 'No goals.',
97101
},
98102

99103
---@type Log

lua/lean/infoview/components.lua

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

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

lua/lean/lsp.lua

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

0 commit comments

Comments
 (0)