Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
feat(vscode): add a snippet for inserting a module docstring template (
Browse files Browse the repository at this point in the history
…#11312)

We already have a vscode snippet for adding copyright headers, this PR adds a similar one to generate a default module docstring with many of the common sections stubbed out.

By default it takes the filename, converts underscores to spaces and capitalizes each word to create the title, as this seems a sensible default. But otherwise all text is a static default example following the documentation style page to make it easier to remember the various recommended secitons.

To test do `ctrl+shift+p` to open the command pallette, type insert snippet, enter, and type module and it should show up.

See also #3186
  • Loading branch information
alexjbest committed Jan 9, 2022
1 parent fadbd95 commit 49ba33e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .vscode/module-docstring.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"Module docstring for mathlib": {
"scope": "lean",
"prefix": "module docstring",
"body": [
"/-!",
"# ${TM_FILENAME_BASE/([^_]*)(_?)/${1:/capitalize}${2:+ }/g}",
"",
"## Main definitions",
"",
"* `foo_bar`",
"",
"## Main statements",
"",
"* `foo_bar_unique`",
"",
"## Notation",
"",
"",
"",
"## Implementation details",
"",
"",
"",
"## References",
"",
"* [F. Bar, *Quuxes*][bibkey]",
"",
"## Tags",
"",
"Foobars, barfoos",
"-/",
"",
]},
}

0 comments on commit 49ba33e

Please sign in to comment.