-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Indenter and formatter fails while typing out body of deftype method #1957
Comments
Copying comment from #1956 as well: The cause here is that Calva only formats the enclosing form, so |
I think that the tools to solve this involve:
So then when we format the current position we could check if we're on the top level of a |
I'll try to resolve it, thanks @PEZ! |
I can still reproduce this here: https://github.com/BetterThanTomorrow/calva/blob/dev/test-data/indenter-cases.clj#L37 |
@SillyCoon, there are two indentation mechanisms in play for this. The one tested in your PR, which we can call the indenter, and also the formatter. I don't understand why your test does not expose the problem with the indenter, but for the formatter it is clearer, and due to the depth issue I mentioned above. |
Ok, got it, let me take a look at formatter |
This issue is fixed. We must have missed to include a closing commit. |
That said, I am experiencing weird indentation issues quite often lately. Which could be regressions from the fixing of this issue. I'll try figure out a repro. It happens to me in my work project and code I can't share as is. |
Hi @PEZ! Plz tag me in the new issue when it'll be ready. I will try to fix it. |
Thanks, @SillyCoon! It's interesting, the repro for at least one of the strange things I've seen is super simple: |
I expect the bodies of methods within deftype to be indented by 2 spaces and when I format the entire deftype form, they do indent properly. But while typing, the body is indenting all the way over to the second term.
Typing
enter
results inIt sort of flashes for a moment in the right spot, then scoots over. Hitting
tab
does not put it in the right spot. But I did find out something interesting while experimenting. If I hitenter
and create a blank lineand then hit
backspace
, it goes to the correct spot.Which is great! But if I hit
tab
again it will go over to the wrong spot. And as state above, if I format the entire deftype form, the bodies are indented correctly.Originally posted by @wevre in #1956 (comment)
The text was updated successfully, but these errors were encountered: