Skip to content

fix: add indentation for Angular control flow blocks#80

Merged
notpeter merged 2 commits intonathansbradshaw:mainfrom
pmig:fix/control-flow-indentation
Feb 25, 2026
Merged

fix: add indentation for Angular control flow blocks#80
notpeter merged 2 commits intonathansbradshaw:mainfrom
pmig:fix/control-flow-indentation

Conversation

@pmig
Copy link
Contributor

@pmig pmig commented Feb 25, 2026

This actually a series a fixes to make that extension work again. You can try out the extension locally over at https://github.com/pmig/zed-angular. Although most of the code was written by claude, I (@pmig) manually reviewed and tested it.

Summary

  • Adds tree-sitter indent rules for Angular 17+ control flow blocks (@if, @for, @switch, @defer)
  • The tree-sitter-angular grammar places {/} inside statement_block and switch_body nodes
  • Adds statement_block and switch_body as indent/outdent targets in indents.scm

Closes #74

Add indentation rules for Angular 17+ control flow syntax (@if, @else,
@for, @empty, @switch, @case, @default, @defer, @Placeholder, @Loading,
@error).

The tree-sitter-angular grammar places { and } inside statement_block
and switch_body nodes, so targeting these two node types covers all
control flow constructs.

Closes nathansbradshaw#74

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 25, 2026 13:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Tree-sitter indentation rules intended to support Angular 17+ template control flow blocks (@if, @for, @switch, @defer) by recognizing their brace-delimited bodies for indentation.

Changes:

  • Add indentation query entries for statement_block nodes.
  • Add indentation query entries for switch_body nodes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@notpeter notpeter left a comment

Choose a reason for hiding this comment

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

Tested and worked for me.

@notpeter notpeter merged commit 4f84a78 into nathansbradshaw:main Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@for @if indentation

3 participants