Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: indent on enter after starting a focus block #328

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

thorimur
Copy link
Contributor

@thorimur thorimur commented Sep 21, 2023

This PR adds the following to language-configuration.json to cause indentation after starting a focus block (·):

    "onEnterRules" : [
        {
            // Indent focus blocks
            "beforeText" : "^\\s*(·|\\.)\\s.*$",
            "action" : { "indent" : "indent" }
        }
    ]

Now, hitting enter after intro x yields

constructor
· intro x
  | <-- cursor ends up here

See Zulip.


Note: there are some cases where this will produce the incorrect indentation, e.g.

  · have : Foo := by
    | <-- cursor will be here

  · have : Foo := by
      | <-- cursor should be here

but handling EOL tokens like by is done in #329 .

* remove corresponding comment from json
@mhuisi mhuisi merged commit 20b5310 into leanprover:master Mar 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants