Skip to content

Add Angular 21.2 template syntax: instanceof operator and arrow functions#41

Merged
princemaple merged 4 commits into
mainfrom
copilot/support-new-syntax-addition
Mar 26, 2026
Merged

Add Angular 21.2 template syntax: instanceof operator and arrow functions#41
princemaple merged 4 commits into
mainfrom
copilot/support-new-syntax-addition

Conversation

Copilot AI commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Angular 21.2 introduced two new template expression features: the instanceof binary operator and arrow function support. This PR adds syntax highlighting for both.

Changes

  • instanceof operator — added to ng-operators alongside typeof/void, scoped as keyword.operator.type.ngx
  • Arrow function => — scoped as keyword.declaration.function.arrow.ngx; arrow function parameters are scoped as variable.parameter.ngx for both single-param (item => ...) and grouped-params ((x) => ..., (x, y) => ...) forms using a look-ahead for single-param and a branch mechanism for grouped-params (with fallback to regular group handling if not followed by =>)

Examples

{{ obj instanceof SomeClass }}

{{ items.filter(item => item.active) }}

{{ (x) => x * 2 }}

Tests added for all three cases in tests/syntax_test_scopes.component.html.

Original prompt

support new syntax addition in angular 21.2


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Add new syntax support in Angular 21.2 Add Angular 21.2 template syntax: instanceof operator and arrow functions Mar 24, 2026
Copilot AI requested a review from princemaple March 24, 2026 14:13
Comment thread tests/syntax_test_scopes.component.html Outdated
Comment thread NgxHTML.sublime-syntax
@princemaple

Copy link
Copy Markdown
Owner

@copilot address reviews

….function.arrow.ngx

Co-authored-by: princemaple <1329716+princemaple@users.noreply.github.com>
Agent-Logs-Url: https://github.com/princemaple/ngx-html-syntax/sessions/ead32532-920a-4084-bebd-bd2e6e516772

Copilot AI commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address reviews

Done in c248aa4. Two changes:

  • => is now scoped as keyword.declaration.function.arrow.ngx
  • Arrow function parameters are now scoped as variable.parameter.ngx for both single-param (item => ...) and grouped-params ((x) => ..., (x, y) => ...) forms — using a look-ahead for single-param and a branch mechanism for grouped-params (with fallback to regular group handling if not followed by =>)

Comment thread NgxHTML.sublime-syntax Outdated
Co-authored-by: deathaxe <16542113+deathaxe@users.noreply.github.com>
@princemaple princemaple marked this pull request as ready for review March 24, 2026 19:43
@princemaple

Copy link
Copy Markdown
Owner

Hi @deathaxe thanks for the early review. Really appreciate it. Do you have more to add? I will merge with your approval.

@princemaple princemaple merged commit 0d0f3cc into main Mar 26, 2026
2 checks passed
@princemaple princemaple deleted the copilot/support-new-syntax-addition branch March 26, 2026 22:54
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.

3 participants