-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Improve indent-style auto-detection heuristic on small files #9556
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hey there, I've been looking into this for a little bit, was wanting to try to help improve the heuristic. I had a couple ideas I wanted to bounce off of you all. The first thought I had was to just simply add a higher baseline to return Another thought could be preferring lower values over higher ones (something like this: Lastly, we could, of course, change the indent counting functionality, though I'm not sure this is a data problem. The only potential improvement I could think of would be some improvement towards counting indents that are the same and next to each other, or indents that are after a larger indent, but even that is a bit iffy, considering this is almost certainly desirable in larger files. I bring up all this to ask, is this a good direction for a PR, or were you thinking of something else? (trying to make my first PR in Helix, and this looked like a good problem! Love the project by the way, it feels very interesting to look through Helix source in Helix haha) |
I think this would benefit from a clear example of a bug. To summarize a few points:
The rules as far as I deduced from testing:
I think this is a very good solution when not using formatting, like when editing another persons' file. |
As @pascalkuthe mentions (#9082 (comment)), the indent-style auto-detection (
helix_core::indent::auto_detect_indent_style
) can be finicky for small files:The text was updated successfully, but these errors were encountered: