Skip to content

Commit

Permalink
docs: create language-configuration.md
Browse files Browse the repository at this point in the history
* remove corresponding comment from json
  • Loading branch information
thorimur committed Sep 30, 2023
1 parent 89370b4 commit de810d7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
26 changes: 26 additions & 0 deletions docs/language-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This document serves as documentation for [`language-configuration.json`](/vscode-lean4/language-configuration.json).

See [the official VS code documentation](https://code.visualstudio.com/api/language-extensions/language-configuration-guide) for an overview of how `language-configuration.json` files work in general.

Section titles here are top-level fields in the JSON file, and link to their corresponding section in the official documentation.

## [`onEnterRules`](https://code.visualstudio.com/api/language-extensions/language-configuration-guide#on-enter-rules)

This field specifies a list of rules which determine how lines should be indented when the user presses <kbd>Enter</kbd>. When the text in a line before the cursor is matched by the regex specified in a rule's `beforeText`, that rule's `action` is applied on <kbd>Enter</kbd>.

### Focus blocks

```json
{
"beforeText" : "^\\s*(·|\\.)\\s.*$",
"action" : { "indent" : "indent" }
}
```

This rule ensures that hitting enter after starting a focus block during a tactic sequence produces a line within that focus block. I.e.,

```
constructor
· intro x| <-- hit enter here
| <-- cursor ends up here
```
1 change: 0 additions & 1 deletion vscode-lean4/language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
"wordPattern" : "([^`~@$%^&*()\\-=+\\[{\\]}⟨⟩⦃⦄⟦⟧⟮⟯‹›<>\\\\|;:\",./\\s]+)",
"onEnterRules" : [
{
// Indent focus blocks
"beforeText" : "^\\s*(·|\\.)\\s.*$",
"action" : { "indent" : "indent" }
}
Expand Down

0 comments on commit de810d7

Please sign in to comment.