Skip to content

Fix elseif / else indentation and support incomplete structures#42

Merged
MrSubidubi merged 2 commits intozed-extensions:mainfrom
Fringale:Fringale-indent-patterns
Mar 20, 2026
Merged

Fix elseif / else indentation and support incomplete structures#42
MrSubidubi merged 2 commits intozed-extensions:mainfrom
Fringale:Fringale-indent-patterns

Conversation

@Fringale
Copy link
Contributor

@Fringale Fringale commented Mar 1, 2026

Closes #36: elseif / else statements are now correctly outdented, with the following line now also indented as expected.

This PR leverages the indent_pattern configuration available to language extensions, similar to other extensions (Ruby, Python, Julia, Elixir) that work around tree-sitter indentation limitations.

Additionally, it provides fallback indentation for control structures and function definitions when the syntax tree is temporarily incomplete (e.g. an if statement without its closing end), which is especially useful when not using code snippets. These cases cannot yet be handled by tree-sitter alone. See the Julia extension for related rationale.

@cla-bot cla-bot bot added the cla-signed label Mar 1, 2026
@Fringale Fringale mentioned this pull request Mar 1, 2026
Copy link
Contributor

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you for looking into this!

@MrSubidubi MrSubidubi merged commit 4f71041 into zed-extensions:main Mar 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lua indentation is broken

2 participants