Skip to content

Commit

Permalink
feat: manual (#453)
Browse files Browse the repository at this point in the history
This PR adds an extensive manual for the Lean 4 VS Code extension and
central parts of the Lean 4 language server. It also covers general VS
Code features that Lean users who have not used VS Code before may find
to be helpful when working with Lean.

There are still some obvious improvements to the manual view that would
be nice to have, but I hope that this is at least a good start.


![ToC](https://github.com/leanprover/vscode-lean4/assets/10852073/de2cca46-dc6f-4217-b610-4a85fec0bced)
  • Loading branch information
mhuisi authored May 23, 2024
1 parent 7211eca commit 451c7d4
Show file tree
Hide file tree
Showing 54 changed files with 838 additions and 51 deletions.
87 changes: 77 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added vscode-lean4/media/abbreviation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/breadcrumbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/call-hierarchy-outgoing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/call-hierarchy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/code-action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/code-folding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/command-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/command-palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/completion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/diagnostics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/document-outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/file-explorer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/file-progress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/find-references.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/go-to-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/go-to-symbol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 1 addition & 28 deletions vscode-lean4/media/guide-vscode.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
## Using Lean 4 in VS Code

**Working with multiple files**
When working on a Lean 4 file `A.lean` that imports another Lean 4 file `B.lean`, you will notice that changes to `B.lean` do not automatically appear in `A.lean`.
To make them appear, select the tab for `A.lean`, click on the ∀-symbol in the top right and select 'Server: Restart File' (Ctrl+Shift+X).
This manual interaction helps to prevent accidental and potentially expensive rebuilds of the project.

![Restart File](restart-file.png)

**Inputting Unicode Symbols**
You can input Unicode symbols in Lean 4 files by typing a backslash (`\`) character followed by the name of the Unicode symbol.
For example, `\all` becomes `` and `\Nat` becomes ``.

If you encounter a Unicode symbol in Lean 4 code and want to learn how to type it, you can hover over the symbol with your mouse and it will display the name of the Unicode symbol.

![Unicode Hover](unicode-hover.png)

A full list of all Unicode symbol names can be found by clicking on the ∀-symbol in the top right and selecting 'Documentation…' > 'Docview: Show All Abbreviations'.

**Navigating Lean 4 Code**
Right-clicking on any identifer will bring up the following context menu:

![Context Menu](context-menu.png)

The two most important entries in this list are 'Go to Definition' and 'Find All References'.
'Go to Definition' will take you to the file that defines the identifier, whereas 'Find All References' will display all locations where the identifier is used.

If you know the name of an identifier but are not sure where to find it, you can open the symbol search by hitting 'Ctrl+P' and typing in `#` followed by the name of the identifier. The search will bring up all identifiers containing the given name and clicking on any of the results will take you to the file where it is defined.

![Symbol Search](symbol-search.png)
The [Lean 4 VS Code extension manual](command:lean4.setup.showExtensionManual) covers all kinds of essential tools when working with Lean 4 in VS Code. Even if you are already familiar with other programming languages and VS Code in general, you may find the first five subsections of the 'Interacting with Lean files' section in the manual to be very helpful.
Binary file added vscode-lean4/media/hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/identifier-context-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/infoview-go-to-definition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/infoview-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode-lean4/media/infoview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 451c7d4

Please sign in to comment.