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

Indenting not working correctly in vectors starting with fn-like symbols #1622

Closed
bpringe opened this issue Mar 24, 2022 · 2 comments
Closed
Labels
bug Something isn't working formatting

Comments

@bpringe
Copy link
Member

bpringe commented Mar 24, 2022

If I have the below code and press enter with my cursor where noted with | in the first example, it then ends up where noted in the second.

Starting:

(let [context {:a 1
               :b [{:c 2}]}|])

When I press enter:

(let [context {:a 1
               :b [{:c 2}]}
       |])

What I expect after pressing enter:

(let [context {:a 1
               :b [{:c 2}]}
      |])
@bpringe bpringe added bug Something isn't working formatting labels Mar 24, 2022
@PEZ
Copy link
Collaborator

PEZ commented Mar 27, 2022

Oh, wow, this is weird:

(let [context|])

enter

(let [context
       |])

But:

(let [contexs|])

enter

(let [contexs
      |])

@PEZ
Copy link
Collaborator

PEZ commented Mar 27, 2022

So, I think I know what is going on now. context has default indents [[:inner 0]]

If we test that theory with some more default indentations:

;; `[[:inner 0]]`
[fn|]

;; `[[:block 0]]`
[do|]

;; `[[:block 1]]`
[let|]

enter in all the forms

;; `[[:inner 0]]`
[fn
  |]

;; `[[:block 0]]`
[do
  |]

;; `[[:block 1]]`
[let
 |]

So, the bug then is that our indenter doesn't check for the type of list it indents. Amazing.

@PEZ PEZ changed the title Indenting not working correctly in this situation Indenting not working correctly in vectors Mar 27, 2022
PEZ added a commit that referenced this issue Mar 27, 2022
PEZ added a commit that referenced this issue Mar 27, 2022
PEZ added a commit that referenced this issue Mar 29, 2022
@PEZ PEZ changed the title Indenting not working correctly in vectors Indenting not working correctly in vectors starting with fn-like symbols Mar 29, 2022
PEZ added a commit that referenced this issue Mar 29, 2022
PEZ added a commit that referenced this issue Mar 29, 2022
@bpringe bpringe closed this as completed in e5f5d02 Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatting
Projects
None yet
Development

No branches or pull requests

2 participants