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

auto_detect_indent_style detects the wrong indentation #10716

Closed
NomisIV opened this issue May 8, 2024 · 2 comments
Closed

auto_detect_indent_style detects the wrong indentation #10716

NomisIV opened this issue May 8, 2024 · 2 comments

Comments

@NomisIV
Copy link
Contributor

NomisIV commented May 8, 2024

I'm using PureScript for work, and we use 2 spaces for indentation in every PureScript module. However, in some modules - especially the test modules - helix wrongfully decides that 4 spaces would be a better fit given the current formatting.

Here is a minimal code example that illustrates the result:

image

Note how the first describe is "in between" two indentation levels in the 4 space indentation.

This would not be as much of an issue if I could save the file without redetecting the indentation style (maybe this has something to do with auto-format?). More annoyingly is that 2-space indentation is declared as the default for PureScript in languages.toml. It would be very nice if it was possible to disable the auto-detection of indentation style on a language basis.

@NomisIV
Copy link
Contributor Author

NomisIV commented May 8, 2024

I have tried inverting the priority between auto_detect_indent_style and the languages.toml-file (so that languages.toml has the top priority), on my fork of helix here: https://github.com/NomisIV/helix. This solves my issue, but likely creates others. Any suggestions on a better fix? I'd be happy to help implement this

@the-mikedavis
Copy link
Member

See #9556, I will close in favor of that

The indentation heuristic should probably have minimum limits on it so we don't guess wrong for small files where there isn't enough information to figure out the actual indent scheme

@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
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

No branches or pull requests

2 participants