Skip to content

Add internal-only debugging attributes - #58982

Closed
crisbeto wants to merge 4 commits into
angular:mainfrom
crisbeto:debug-attr
Closed

crisbeto wants to merge 4 commits into
angular:mainfrom
crisbeto:debug-attr

Conversation

@crisbeto

Copy link
Copy Markdown
Member

Adds some logic to include the original template location on each DOM node. Currently there's no way to enable this, apart from making a local change to the compiler. The main usage is aimed at internal tools, but we may consider exposing this in dev mode in the future.

Fixes #42530.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels Nov 30, 2024
@angular-robot angular-robot Bot added area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels Nov 30, 2024
@ngbot ngbot Bot modified the milestone: Backlog Nov 30, 2024
@angular-robot angular-robot Bot added area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime and removed area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels Nov 30, 2024
@ngbot ngbot Bot modified the milestone: Backlog Nov 30, 2024
@crisbeto
crisbeto marked this pull request as ready for review November 30, 2024 10:12
@angular-robot angular-robot Bot added area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime and removed area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels Nov 30, 2024
@ngbot ngbot Bot modified the milestone: Backlog Nov 30, 2024
@crisbeto
crisbeto requested review from JoostK and alxhub December 2, 2024 07:51

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this work for you? I've had some trouble in g3 with export let variables.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It worked fine during a presubmit, but I haven't tried TGPing it. I'll make the constant private and add a function to read it, just to be safe.

Tweaks the `getProjectRelativePath` function so it's not as dependent on the TypeScript AST.
Captures the template path in the component's metadata so it can be used later on.
Adds the implementation of the `ɵɵattachSourceLocations` instruction that will add the `data-ng-source-location` attribute to nodes to indicate where they were defined.
Adds the logic that will generate the `ɵɵattachSourceLocations` instruction.

Fixes angular#42530.
@angular-robot angular-robot Bot removed the area: compiler Issues related to `ngc`, Angular's template compiler label Dec 5, 2024
@angular-robot angular-robot Bot added area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Dec 5, 2024
@ngbot ngbot Bot modified the milestone: Backlog Dec 5, 2024
@crisbeto
crisbeto removed the request for review from JoostK December 5, 2024 18:11
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 5, 2024
@alxhub

alxhub commented Dec 6, 2024

Copy link
Copy Markdown
Member

This PR was merged into the repository by commit 4559e12.

The changes were merged into the following branches: main

@alxhub alxhub closed this in 00d5b0d Dec 6, 2024
alxhub pushed a commit that referenced this pull request Dec 6, 2024
Captures the template path in the component's metadata so it can be used later on.

PR Close #58982
alxhub pushed a commit that referenced this pull request Dec 6, 2024
)

Adds the implementation of the `ɵɵattachSourceLocations` instruction that will add the `data-ng-source-location` attribute to nodes to indicate where they were defined.

PR Close #58982
alxhub pushed a commit that referenced this pull request Dec 6, 2024
Adds the logic that will generate the `ɵɵattachSourceLocations` instruction.

Fixes #42530.

PR Close #58982
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jan 6, 2025
PrajaktaB27 pushed a commit to PrajaktaB27/angular that referenced this pull request Feb 7, 2025
…8982)

Tweaks the `getProjectRelativePath` function so it's not as dependent on the TypeScript AST.

PR Close angular#58982
PrajaktaB27 pushed a commit to PrajaktaB27/angular that referenced this pull request Feb 7, 2025
Captures the template path in the component's metadata so it can be used later on.

PR Close angular#58982
PrajaktaB27 pushed a commit to PrajaktaB27/angular that referenced this pull request Feb 7, 2025
…ular#58982)

Adds the implementation of the `ɵɵattachSourceLocations` instruction that will add the `data-ng-source-location` attribute to nodes to indicate where they were defined.

PR Close angular#58982
PrajaktaB27 pushed a commit to PrajaktaB27/angular that referenced this pull request Feb 7, 2025
Adds the logic that will generate the `ɵɵattachSourceLocations` instruction.

Fixes angular#42530.

PR Close angular#58982
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Debugging tool for mapping DOM nodes to template source

3 participants