Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ivy native LS: Find references of $event returns a result with a text span of the entire event handler in the template. #40157

Closed
atscott opened this issue Dec 16, 2020 · 1 comment
Assignees
Labels
area: language-service Issues related to Angular's VS Code language service P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone

Comments

@atscott
Copy link
Contributor

atscott commented Dec 16, 2020

Given the template
<div (click)="doSomething($event)"></div>

If you request references for the $event, the results include both $event and (click)="doSomething($event)".

This happens because in the TCB, $event is passed to the subscribe/addEventListener function as an argument. So when we ask typescript to give us the references, we get the result from the usage in the subscribe body as well as the one passed in as an argument.

@atscott atscott created this issue from a note in Ivy Language Service (Issues In Progress) Dec 16, 2020
@atscott atscott moved this from Issues In Progress to Polish in Ivy Language Service Dec 16, 2020
@atscott atscott added area: language-service Issues related to Angular's VS Code language service P4 A relatively minor issue that is not relevant to core functions labels Dec 16, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 16, 2020
@atscott atscott added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed P4 A relatively minor issue that is not relevant to core functions labels Dec 16, 2020
@atscott atscott self-assigned this Dec 16, 2020
atscott added a commit to atscott/angular that referenced this issue Dec 16, 2020
…esults

Given the template
`<div (click)="doSomething($event)"></div>`

If you request references for the `$event`, the results include both `$event` and `(click)="doSomething($event)"`.

This happens because in the TCB, `$event` is passed to the `subscribe`/`addEventListener`
function as an argument. So when we ask typescript to give us the references, we
get the result from the usage in the subscribe body as well as the one passed in as an argument.

This commit adds an identifier to the `$event` parameter in the TCB so
that the result returned from `getReferencesAtPosition` can be
identified and filtered out.

fixes angular#40157
atscott added a commit to atscott/angular that referenced this issue Dec 16, 2020
…esults

Given the template
`<div (click)="doSomething($event)"></div>`

If you request references for the `$event`, the results include both `$event` and `(click)="doSomething($event)"`.

This happens because in the TCB, `$event` is passed to the `subscribe`/`addEventListener`
function as an argument. So when we ask typescript to give us the references, we
get the result from the usage in the subscribe body as well as the one passed in as an argument.

This commit adds an identifier to the `$event` parameter in the TCB so
that the result returned from `getReferencesAtPosition` can be
identified and filtered out.

fixes angular#40157
atscott added a commit to atscott/angular that referenced this issue Dec 16, 2020
…esults

Given the template
`<div (click)="doSomething($event)"></div>`

If you request references for the `$event`, the results include both `$event` and `(click)="doSomething($event)"`.

This happens because in the TCB, `$event` is passed to the `subscribe`/`addEventListener`
function as an argument. So when we ask typescript to give us the references, we
get the result from the usage in the subscribe body as well as the one passed in as an argument.

This commit adds an identifier to the `$event` parameter in the TCB so
that the result returned from `getReferencesAtPosition` can be
identified and filtered out.

fixes angular#40157
@atscott atscott moved this from Polish to PRs In Review in Ivy Language Service Dec 16, 2020
Ivy Language Service automation moved this from PRs In Review to Done Jan 5, 2021
@angular-automatic-lock-bot
Copy link

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 Feb 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: language-service Issues related to Angular's VS Code language service P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant