on master help sign in
Add documentation for new indent computation
commita5acfdbf104db82310b71da988ef8a5df43ffd49 authorDaniel Ebert <daniel.ebert@protonmail.com> dateTue 19 Sep 2023, 16:14 (3 years ago) parent938a710
2 files changed+10
book/src/configuration.md+1 book/src/guides/indent.md+9
book/src/configuration.md+1
@@ -65,6 +65,7 @@ Its settings will be merged with the configuration directory `config.toml` and t
6565| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` |
6666| `default-line-ending` | The line ending to use for new documents. Can be `native`, `lf`, `crlf`, `ff`, `cr` or `nel`. `native` uses the platform's native line ending (`crlf` on Windows, otherwise `lf`). | `native` |
6767| `insert-final-newline` | Whether to automatically insert a trailing line-ending on write if missing | `true` |
68+| `indent-heuristic` | How the indentation for a newly inserted line is computed: `simple` just copies the indentation level from the previous line, `tree-sitter` computes the indentation based on the syntax tree and `hybrid` combines both approaches | `hybrid`
6869
6970### `[editor.statusline]` Section
7071
book/src/guides/indent.md+9
@@ -12,6 +12,15 @@ Note that it matters where these added indents begin. For example,
1212multiple indent level increases that start on the same line only increase
1313the total indent level by 1. See [Capture types](#capture-types).
1414
15+By default, Helix uses the `hybrid` indentation heuristic. This means that
16+indent queries are not used to compute the expected absolute indentation of a
17+line but rather the expected difference in indentation between the new and an
18+already existing line. This difference is then added to the actual indentation
19+of the already existing line. Since this makes errors in the indent queries
20+harder to find, it is recommended to disable it when testing via
21+`:set indent-heuristic tree-sitter`. The rest of this guide assumes that
22+the `tree-sitter` heuristic is used.
23+
1524## Indent queries
1625
1726When Helix is inserting a new line through `o`, `O`, or `<ret>`, to determine