Improve indent-style auto-detection heuristic on small files
As @pascalkuthe mentions (https://github.com/helix-editor/helix/issues/9082#issuecomment-1855774117), the indent-style auto-detection (helix_core::indent::auto_detect_indent_style) can be finicky for small files:
Indent style detection for very short files ... doens't work well. ... I think the exact ratios need to be adjusted in our detection heuristic (potentially we need to add some absolute requirements in addition to values, ...).
Can we just disable this for me? Is there a flag for this? Thanks
Is this the cause of Helix inserting 8 spaces instead of 4 whenever I try to add to a function body in files like https://github.com/NixOS/nix/blob/6c10cc0edabdbbdbf11ce0b388f88325c9958792/src/libexpr/primops/context.cc and https://github.com/NixOS/nix/blob/6c10cc0edabdbbdbf11ce0b388f88325c9958792/src/libexpr/primops/fromTOML.cc? Or should I file a separate issue?
(Do I have any recourse for being able to sanely edit these files in the meantime? 😄)
Is this the cause of Helix inserting 8 spaces instead of 4 whenever I try to add to a function body in files like https://github.com/NixOS/nix/blob/6c10cc0edabdbbdbf11ce0b388f88325c9958792/src/libexpr/primops/context.cc and https://github.com/NixOS/nix/blob/6c10cc0edabdbbdbf11ce0b388f88325c9958792/src/libexpr/primops/fromTOML.cc? Or should I file a separate issue?
(Do I have any recourse for being able to sanely edit these files in the meantime? 😄)
that's entirely unrelated to this issue. This issue is abou6t detecting what to insert when pressing tab. The files you linked that detection correctly detects four spaces (they don't fit this issue since this issue is only about files a couple line long).
What you are seeing is that your indentation style doesn't the way our queries are setup (our queries always add an indent after namespace ... {. This is duplicate of #6235 which was fixed in the current release cycle by #8307. You can either wait for the new release or use the current master branch (which will be mostly identical to the next release).
Marking as off topic since this is entirely unrelated