Version: fresh 0.4.0 (built from master @ 1b5d7f8c8)
The 0.4.0 headline feature "Configurable indentation rules per language via [languages.<id>.indent], including VS Code-style regex rules" (CHANGELOG 0.4.0; documented in docs/configuration/index.md → "Customize Auto-Indentation") does not work. A custom language's indent block is parsed enough that the language is recognized (its name shows in the status bar), but none of the five indent patterns take effect. Auto-indentation falls back to Fresh's built-in heuristics regardless of what the user configures.
Steps to reproduce
- Create a project dir, e.g.
/tmp/indent-test/, with .fresh/config.json:
{
"languages": {
"incend": { "extensions": ["t1"], "tab_size": 4, "use_tabs": false,
"indent": { "increase_indent_pattern": "OPEN\\s*$" } },
"decr": { "extensions": ["t3"], "tab_size": 4, "use_tabs": false,
"indent": { "increase_indent_pattern": "OPEN\\s*$", "decrease_indent_pattern": "^\\s*CLOSE\\b" } },
"indnext": { "extensions": ["t4"], "tab_size": 4, "use_tabs": false,
"indent": { "indent_next_line_pattern": "^\\s*HDR\\b" } },
"dednext": { "extensions": ["t5"], "tab_size": 4, "use_tabs": false,
"indent": { "increase_indent_pattern": "COLON\\s*$", "dedent_next_line_pattern": "^\\s*RET\\b" } }
}
}
(OPEN/CLOSE/HDR are deliberately non-bracket, non-colon tokens so they do not overlap Fresh's built-in heuristics — this isolates whether the custom rule fires.)
- From that dir:
fresh --no-restore test.t1 (status bar confirms filetype incend, so the language entry loaded).
- Type
foo OPEN, press Enter, type child.
Expected behavior
Per the docs, increase_indent_pattern matches the reference line, so the new line is one level deeper:
This mirrors VS Code's indentationRules.increaseIndentPattern (language-configuration.json), which Fresh's docs explicitly model.
Actual behavior
The new line is not indented — it inherits the reference line's indent only:
│ 1 │ foo OPEN
│ 2 │ child ← still column 0, increase_indent_pattern ignored
The same negative result holds for every pattern (each tested in its own single-rule custom language, --no-restore, literal keystrokes, whitespace verified with capture-pane | cat -A):
| Pattern |
Config (token) |
Input → Enter |
Expected |
Actual |
increase_indent_pattern (end-anchored) |
OPEN\s*$ |
foo OPEN → Enter |
next line +1 level |
no change |
increase_indent_pattern (start-anchored) |
^\s*OPEN\b |
OPEN → Enter |
next line +1 level |
no change |
decrease_indent_pattern |
^\s*CLOSE\b |
type CLOSE on an indented line |
line dedents 1 level |
stays indented |
indent_next_line_pattern |
^\s*HDR\b |
HDR → Enter |
next line only +1 level |
no change |
dedent_next_line_pattern |
^\s*RET\b |
RET (on indented line) → Enter |
following line −1 level |
stays indented |
Meanwhile, Fresh's built-in heuristics still fire for the same custom languages — a line ending in : indents the next line, and {/} indent/dedent — even when a custom indent block is present (so the custom block does not replace the built-in behavior either; it is simply not consulted). This is why the documented examples appear to work: increase_indent_pattern: "[\{\[\(]\s*$" and ":\s*$" coincide with built-in bracket/colon indentation, masking the defect. Use a token the built-in doesn't recognize (like OPEN) and nothing happens.
Confirmed at both config layers — project .fresh/config.json and user ~/.config/fresh/config.json — with the same result. self_close_pattern could not be observed because it only cancels increase_indent_pattern, which itself never fires.
Workaround
None for custom/unrecognized languages. For languages whose desired rules happen to coincide with Fresh's built-in bracket/colon indentation, the built-in behavior applies anyway (but is not configurable).
Search performed (no existing issue): increase_indent_pattern, indent rules languages, indentation rule custom language, auto-indent pattern ignored.
Version: fresh 0.4.0 (built from
master@1b5d7f8c8)The 0.4.0 headline feature "Configurable indentation rules per language via
[languages.<id>.indent], including VS Code-style regex rules" (CHANGELOG 0.4.0; documented indocs/configuration/index.md→ "Customize Auto-Indentation") does not work. A custom language'sindentblock is parsed enough that the language is recognized (its name shows in the status bar), but none of the fiveindentpatterns take effect. Auto-indentation falls back to Fresh's built-in heuristics regardless of what the user configures.Steps to reproduce
/tmp/indent-test/, with.fresh/config.json:{ "languages": { "incend": { "extensions": ["t1"], "tab_size": 4, "use_tabs": false, "indent": { "increase_indent_pattern": "OPEN\\s*$" } }, "decr": { "extensions": ["t3"], "tab_size": 4, "use_tabs": false, "indent": { "increase_indent_pattern": "OPEN\\s*$", "decrease_indent_pattern": "^\\s*CLOSE\\b" } }, "indnext": { "extensions": ["t4"], "tab_size": 4, "use_tabs": false, "indent": { "indent_next_line_pattern": "^\\s*HDR\\b" } }, "dednext": { "extensions": ["t5"], "tab_size": 4, "use_tabs": false, "indent": { "increase_indent_pattern": "COLON\\s*$", "dedent_next_line_pattern": "^\\s*RET\\b" } } } }OPEN/CLOSE/HDRare deliberately non-bracket, non-colon tokens so they do not overlap Fresh's built-in heuristics — this isolates whether the custom rule fires.)fresh --no-restore test.t1(status bar confirms filetypeincend, so the language entry loaded).foo OPEN, press Enter, typechild.Expected behavior
Per the docs,
increase_indent_patternmatches the reference line, so the new line is one level deeper:This mirrors VS Code's
indentationRules.increaseIndentPattern(language-configuration.json), which Fresh's docs explicitly model.Actual behavior
The new line is not indented — it inherits the reference line's indent only:
The same negative result holds for every pattern (each tested in its own single-rule custom language,
--no-restore, literal keystrokes, whitespace verified withcapture-pane | cat -A):increase_indent_pattern(end-anchored)OPEN\s*$foo OPEN→ Enterincrease_indent_pattern(start-anchored)^\s*OPEN\bOPEN→ Enterdecrease_indent_pattern^\s*CLOSE\bCLOSEon an indented lineindent_next_line_pattern^\s*HDR\bHDR→ Enterdedent_next_line_pattern^\s*RET\bRET(on indented line) → EnterMeanwhile, Fresh's built-in heuristics still fire for the same custom languages — a line ending in
:indents the next line, and{/}indent/dedent — even when a customindentblock is present (so the custom block does not replace the built-in behavior either; it is simply not consulted). This is why the documented examples appear to work:increase_indent_pattern: "[\{\[\(]\s*$"and":\s*$"coincide with built-in bracket/colon indentation, masking the defect. Use a token the built-in doesn't recognize (likeOPEN) and nothing happens.Confirmed at both config layers — project
.fresh/config.jsonand user~/.config/fresh/config.json— with the same result.self_close_patterncould not be observed because it only cancelsincrease_indent_pattern, which itself never fires.Workaround
None for custom/unrecognized languages. For languages whose desired rules happen to coincide with Fresh's built-in bracket/colon indentation, the built-in behavior applies anyway (but is not configurable).
Search performed (no existing issue):
increase_indent_pattern,indent rules languages,indentation rule custom language,auto-indent pattern ignored.