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

Format modifications on save not working correctly #1620

Open
deadeyejoe opened this issue Mar 24, 2022 · 1 comment
Open

Format modifications on save not working correctly #1620

deadeyejoe opened this issue Mar 24, 2022 · 1 comment

Comments

@deadeyejoe
Copy link
Contributor

I have format on save enabled, and it's configured to only format modifications (I'm working on a codebase with some non-standard indentation). When I edit the middle of a list of indented arguments, the indentation is removed when I save. A good example of this is require statements:

Peek 2022-03-24 16-21

You can see the modified line indicator at the left hand side. When I save the indentation is removed, and hitting tab indents the forms correctly.

I'm guessing that the format on save is only formatting what it's given, while the format on tab is able to consider the enclosing form and that's why it indents correctly. Is there anything that can be done about it?

@PEZ
Copy link
Collaborator

PEZ commented Mar 24, 2022

I had no idea that this setting existed! Thanks for the heads-up.

You are guessing correctly about format on tab (a.k.a. Format current form). And I am guessing that you are guessing correctly about format-on-save-but-only-modifications. But I also assume we should get some info about the location of those changes, and from that we should be able to use the underlying implementation of Format current form to that location. I am also guessing that the setting also should handle that the file can be modified in several places.... So linking these because a bit related:

@PEZ PEZ added the formatting label Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants