Skip to content

Commit e217e5e

Browse files
committed
Standardize some whitespace around comments/lua docstrings.
Even though --- Foo --- @param bar --- @returns baz (with the space) looks nicer, vimcats cannot deal with it it seems, and requres `---@param` with no space. Sigh, wonderful, but ok.
1 parent c4ebe66 commit e217e5e

27 files changed

+266
-239
lines changed

doc/lean.txt

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ lean.use_suggested_mappings({bufnr?}) *lean.use_suggested_mappings*
3131

3232

3333
lean.current_search_paths() *lean.current_search_paths*
34-
Return the current Lean search path.
34+
Return the current Lean search path.
3535

36-
Includes both the Lean core libraries as well as project-specific
37-
directories.
36+
Includes both the Lean core libraries as well as project-specific
37+
directories.
3838

3939

4040
==============================================================================
@@ -68,30 +68,30 @@ InfoviewViewOptions *InfoviewViewOptions*
6868

6969

7070
Pin *Pin*
71-
An individual pin.
71+
An individual pin.
7272

7373
Fields: ~
7474
{id} (string) @a label to identify the pin
7575

7676

7777
Info *Info*
78-
An individual info.
78+
An individual info.
7979

8080
Fields: ~
8181
{pin} (Pin)
8282
{pins} (Pin[])
8383

8484

8585
Infoview *Infoview*
86-
A "view" on an info (i.e. window).
86+
A "view" on an info (i.e. window).
8787

8888
Fields: ~
8989
{info} (Info)
9090
{window} (integer)
9191

9292

9393
infoview.enable_debug() *infoview.enable_debug*
94-
Enables printing of extra debugging information in the infoview.
94+
Enables printing of extra debugging information in the infoview.
9595

9696

9797
InfoviewNewArgs *InfoviewNewArgs*
@@ -110,98 +110,98 @@ FilterSelection *FilterSelection*
110110

111111

112112
infoview.close_all() *infoview.close_all*
113-
Close all open infoviews (across all tabs).
113+
Close all open infoviews (across all tabs).
114114

115115

116116
infoview.__update_pin_by_uri({uri}) *infoview.__update_pin_by_uri*
117-
Update pins corresponding to the given URI.
117+
Update pins corresponding to the given URI.
118118

119119
Parameters: ~
120120
{uri} (string)
121121

122122

123123
infoview.__update_pin_positions() *infoview.__update_pin_positions*
124-
on_lines callback to update pins position according to the given textDocument/didChange parameters.
124+
on_lines callback to update pins position according to the given textDocument/didChange parameters.
125125

126126

127127
infoview.enable() *infoview.enable*
128-
Enable and open the infoview across all Lean buffers.
128+
Enable and open the infoview across all Lean buffers.
129129

130130

131131
infoview.set_autoopen() *infoview.set_autoopen*
132-
Set whether a new infoview is automatically opened when entering Lean buffers.
132+
Set whether a new infoview is automatically opened when entering Lean buffers.
133133

134134

135135
infoview.set_autopause() *infoview.set_autopause*
136-
Set whether a new pin is automatically paused.
136+
Set whether a new pin is automatically paused.
137137

138138

139139
infoview.get_current_infoview() *infoview.get_current_infoview*
140-
Get the infoview corresponding to the current window.
140+
Get the infoview corresponding to the current window.
141141

142142
Returns: ~
143143
(Infoview)
144144

145145

146146
infoview.open() *infoview.open*
147-
Open the current infoview (or ensure it is already open).
147+
Open the current infoview (or ensure it is already open).
148148

149149

150150
infoview.close() *infoview.close*
151-
Close the current infoview (or ensure it is already closed).
151+
Close the current infoview (or ensure it is already closed).
152152

153153

154154
infoview.toggle() *infoview.toggle*
155-
Toggle whether the current infoview is opened or closed.
155+
Toggle whether the current infoview is opened or closed.
156156

157157

158158
infoview.pin_toggle_pause() *infoview.pin_toggle_pause*
159-
Toggle whether the current pin receives updates.
159+
Toggle whether the current pin receives updates.
160160

161161

162162
infoview.add_pin() *infoview.add_pin*
163-
Add a pin to the current cursor location.
163+
Add a pin to the current cursor location.
164164

165165

166166
infoview.set_diff_pin() *infoview.set_diff_pin*
167-
Set the location for a diff pin to the current cursor location.
167+
Set the location for a diff pin to the current cursor location.
168168

169169

170170
infoview.clear_pins() *infoview.clear_pins*
171-
Clear any pins in the current infoview.
171+
Clear any pins in the current infoview.
172172

173173

174174
infoview.clear_diff_pin() *infoview.clear_diff_pin*
175-
Clear a diff pin in the current infoview.
175+
Clear a diff pin in the current infoview.
176176

177177

178178
infoview.toggle_auto_diff_pin() *infoview.toggle_auto_diff_pin*
179-
Toggle whether "auto-diff" mode is active for the current infoview.
179+
Toggle whether "auto-diff" mode is active for the current infoview.
180180

181181

182182
infoview.enable_widgets() *infoview.enable_widgets*
183-
Enable widgets in the current infoview.
183+
Enable widgets in the current infoview.
184184

185185

186186
infoview.disable_widgets() *infoview.disable_widgets*
187-
Disable widgets in the current infoview.
187+
Disable widgets in the current infoview.
188188

189189

190190
infoview.go_to() *infoview.go_to*
191-
Move the cursor to the infoview window.
191+
Move the cursor to the infoview window.
192192

193193

194194
infoview.reposition() *infoview.reposition*
195-
Move the current infoview to the appropriate spot based on the
196-
current screen dimensions.
197-
Does nothing if there are more than 2 open windows.
195+
Move the current infoview to the appropriate spot based on the
196+
current screen dimensions.
197+
Does nothing if there are more than 2 open windows.
198198

199199

200200
infoview.select_view_options() *infoview.select_view_options*
201-
Interactively set some view options for the infoview.
201+
Interactively set some view options for the infoview.
202202

203-
Does not persist the selected options; if you wish to permanently affect
204-
which hypotheses are shown, set them in your lean.nvim configuration.
203+
Does not persist the selected options; if you wish to permanently affect
204+
which hypotheses are shown, set them in your lean.nvim configuration.
205205

206206

207207
==============================================================================
@@ -210,14 +210,21 @@ infoview.select_view_options() *infoview.select_view_options*
210210
Support for abbreviations (unicode character replacement).
211211

212212
abbreviations.load() *abbreviations.load*
213-
Load the Lean abbreviations as a Lua table.
213+
Load the Lean abbreviations as a Lua table.
214214

215215

216216
abbreviations.reverse_lookup() *abbreviations.reverse_lookup*
217+
Retrieve the table of abbreviations that would produce the given symbol.
218+
219+
Allows for trailing junk. E.g. `λean` will produce information about `λ`.
220+
221+
The result is a table keyed by the length of the prefix match, and
222+
whose value is sorted such that shorter abbreviation suggestions are
223+
first.
217224

218225

219226
abbreviations.show_reverse_lookup() *abbreviations.show_reverse_lookup*
220-
Show a preview window with the reverse-lookup of the current character.
227+
Show a preview window with the reverse-lookup of the current character.
221228

222229

223230
abbreviations.convert() *abbreviations.convert*
@@ -266,6 +273,10 @@ satellite.nvim integration *lean.satellite*
266273

267274
See https://github.com/lewis6991/satellite.nvim/blob/main/HANDLERS.md
268275

276+
*Lean.SatelliteConfig*
277+
Lean.SatelliteConfig : Satellite.Handlers.BaseConfig
278+
279+
269280
==============================================================================
270281
LSP *lean.lsp*
271282

@@ -275,7 +286,7 @@ lsp.enable() *lsp.enable*
275286

276287

277288
lsp.client_for({bufnr}) *lsp.client_for*
278-
Find the vim.lsp.Client attached to the given buffer.
289+
Find the vim.lsp.Client attached to the given buffer.
279290

280291
Parameters: ~
281292
{bufnr} (number)
@@ -285,6 +296,7 @@ lsp.client_for({bufnr}) *lsp.client_for*
285296

286297

287298
lsp.plain_goal({params}, {bufnr}) *lsp.plain_goal*
299+
Fetch goal state information from the server (async).
288300

289301
Parameters: ~
290302
{params} (lsp.TextDocumentPositionParams)
@@ -296,6 +308,7 @@ lsp.plain_goal({params}, {bufnr}) *lsp.plain_goal*
296308

297309

298310
lsp.plain_term_goal({params}, {bufnr}) *lsp.plain_term_goal*
311+
Fetch term goal state information from the server (async).
299312

300313
Parameters: ~
301314
{params} (lsp.TextDocumentPositionParams)
@@ -306,6 +319,13 @@ lsp.plain_term_goal({params}, {bufnr}) *lsp.plain_term_goal*
306319
(any) plain_term_goal
307320

308321

322+
LeanFileProgressParams *LeanFileProgressParams*
323+
324+
Fields: ~
325+
{textDocument} (lsp.VersionedTextDocumentIdentifier)
326+
{processing} (LeanFileProgressProcessingInfo[])
327+
328+
309329
*lsp.handlers.file_progress_handler*
310330
lsp.handlers.file_progress_handler({params})
311331

@@ -337,7 +357,7 @@ stderr.show({message}) *stderr.show*
337357

338358

339359
stderr.enable() *stderr.enable*
340-
Enable teeing stderr output somewhere (to a second visible buffer by default).
360+
Enable teeing stderr output somewhere (to a second visible buffer by default).
341361

342362

343363
==============================================================================
@@ -350,7 +370,7 @@ Client-side sorrying *lean.sorry*
350370
behavior.
351371

352372
sorry.fill() *sorry.fill*
353-
Fill the current cursor position with `sorry`s to discharge all goals.
373+
Fill the current cursor position with `sorry`s to discharge all goals.
354374

355375

356376
vim:tw=78:ts=8:noet:ft=help:norl:

doc/tags

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Info lean.txt /*Info*
33
Infoview lean.txt /*Infoview*
44
InfoviewNewArgs lean.txt /*InfoviewNewArgs*
55
InfoviewViewOptions lean.txt /*InfoviewViewOptions*
6+
Lean.SatelliteConfig lean.txt /*Lean.SatelliteConfig*
7+
LeanFileProgressParams lean.txt /*LeanFileProgressParams*
68
LoogleResult lean.txt /*LoogleResult*
79
Pin lean.txt /*Pin*
810
abbreviations.convert lean.txt /*abbreviations.convert*

lua/lean/_util.lua

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
-- Stuff that should live in some standard library.
1+
---@brief [[
2+
--- Stuff that should live in some standard library.
3+
---@brief ]]
4+
25
local Job = require 'plenary.job'
36
local a = require 'plenary.async'
47
-- local control = require'plenary.async.control'
58

69
local M = {}
710

8-
--- Return an array-like table with a value repeated the given number of times.
11+
---Return an array-like table with a value repeated the given number of times.
912
function M.tbl_repeat(value, times)
1013
local result = {}
1114
for _ = 1, times do
@@ -14,7 +17,7 @@ function M.tbl_repeat(value, times)
1417
return result
1518
end
1619

17-
--- Fetch the diagnostics for all Lean LSP clients from the current buffer.
20+
---Fetch the diagnostics for all Lean LSP clients from the current buffer.
1821
---@param opts? table
1922
---@param bufnr? number buffer handle or 0 for current, defaults to current
2023
---@return vim.Diagnostic[] diagnostics the relevant Lean diagnostics
@@ -56,11 +59,11 @@ function M.create_buf(params)
5659
return bufnr
5760
end
5861

59-
--- Run a subprocess, blocking on exit, and returning its stdout.
62+
---Run a subprocess, blocking on exit, and returning its stdout.
6063
---
61-
--- Unlike `system()`, we don't mix stdout and stderr, and unlike
62-
--- `vim.uv.spawn`, we wait for process exit and collect the output.
63-
--- @return table: the lines of stdout of the exited process
64+
---Unlike `system()`, we don't mix stdout and stderr, and unlike
65+
---`vim.uv.spawn`, we wait for process exit and collect the output.
66+
---@return table: the lines of stdout of the exited process
6467
function M.subprocess_check_output(opts, timeout)
6568
timeout = timeout or 10000
6669

@@ -97,16 +100,16 @@ local function max_common_indent(str)
97100
return common_indent
98101
end
99102

100-
--- Dedent a multi-line string.
103+
---Dedent a multi-line string.
101104
---
102-
--- REPLACEME: plenary.nvim has a version of this but it has odd behavior.
105+
---REPLACEME: plenary.nvim has a version of this but it has odd behavior.
103106
function M.dedent(str)
104107
str = str:gsub('^ +', ''):gsub('\n *$', '\n') -- trim leading/trailing space
105108
local prefix = max_common_indent(str)
106109
return str:gsub('\n' .. prefix, '\n')
107110
end
108111

109-
--- Build a single-line string out a multiline one, replacing \n with spaces.
112+
---Build a single-line string out a multiline one, replacing \n with spaces.
110113
function M.s(str)
111114
return M.dedent(str):gsub('\n', ' ')
112115
end
@@ -122,7 +125,7 @@ function M.client_a_request(client, request, params)
122125
end, 1)()
123126
end
124127

125-
-- simple alternative to vim.lsp.util._make_floating_popup_size
128+
---Simple alternative to vim.lsp.util._make_floating_popup_size
126129
function M.make_floating_popup_size(contents)
127130
return unpack(vim.iter(contents):fold({ 0, 0 }, function(acc, line)
128131
local width, height = unpack(acc)
@@ -137,7 +140,7 @@ end
137140
---@field textDocument { uri: string }
138141
---@field position { line: uinteger, character: uinteger }
139142

140-
--- Check that the given position parameters are valid given the buffer they correspond to.
143+
---Check that the given position parameters are valid given the buffer they correspond to.
141144
---@param params UIParams @parameters to verify
142145
---@return boolean
143146
function M.position_params_valid(params)
@@ -188,7 +191,7 @@ local function buf_get_line_ending(bufnr)
188191
end
189192

190193
---@private
191-
--- Returns full text of buffer {bufnr} as a string.
194+
---Returns full text of buffer {bufnr} as a string.
192195
---
193196
---@param bufnr (number) Buffer handle, or 0 for current.
194197
---@return string # Buffer text as string.

0 commit comments

Comments
 (0)