Add Angular 21.2 template syntax: instanceof operator and arrow functions#41
Merged
Merged
Conversation
Co-authored-by: princemaple <1329716+princemaple@users.noreply.github.com> Agent-Logs-Url: https://github.com/princemaple/ngx-html-syntax/sessions/66972ff1-40e0-490d-a244-cf94cc57ad77
Copilot
AI
changed the title
[WIP] Add new syntax support in Angular 21.2
Add Angular 21.2 template syntax: Mar 24, 2026
instanceof operator and arrow functions
deathaxe
reviewed
Mar 24, 2026
deathaxe
reviewed
Mar 24, 2026
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
Contributor
Author
Done in c248aa4. Two changes:
|
deathaxe
reviewed
Mar 24, 2026
Co-authored-by: deathaxe <16542113+deathaxe@users.noreply.github.com>
Owner
|
Hi @deathaxe thanks for the early review. Really appreciate it. Do you have more to add? I will merge with your approval. |
deathaxe
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Angular 21.2 introduced two new template expression features: the
instanceofbinary operator and arrow function support. This PR adds syntax highlighting for both.Changes
instanceofoperator — added tong-operatorsalongsidetypeof/void, scoped askeyword.operator.type.ngx=>— scoped askeyword.declaration.function.arrow.ngx; arrow function parameters are scoped asvariable.parameter.ngxfor 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
🔒 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.