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

feat(language-service): support multiple symbol definitions #34782

Closed
wants to merge 3 commits into from

Conversation

ayazhafiz
Copy link
Member

In Angular, symbol can have multiple definitions (e.g. a two-way
binding). This commit adds support for for multiple definitions for a
queried location in a template.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@ayazhafiz ayazhafiz added feature Issue that requests a new feature area: language-service Issues related to Angular's VS Code language service labels Jan 15, 2020
@ayazhafiz ayazhafiz requested a review from kyliau January 15, 2020 04:55
@ayazhafiz ayazhafiz requested a review from a team as a code owner January 15, 2020 04:55
@ngbot ngbot bot modified the milestone: needsTriage Jan 15, 2020
@ayazhafiz
Copy link
Member Author

Note that in some cases, there a symbol can have multiple of the same definition -- for example, in the attribute value of a two way binding. [(ngModel)]="prop" really expands to [ngModel]="prop" (ngModel)="prop=$event", so when the definition for prop is requested, it is twice-referencing the prop member of the template's component. I did not include pruning duplicate entries in this commit because the LSP engines I tested this on (Vim via CoC and VSCode) handled these cases gracefully, combining the two definitions, but we can add code to prune them if desired..

packages/language-service/src/definitions.ts Outdated Show resolved Hide resolved
packages/language-service/src/definitions.ts Outdated Show resolved Hide resolved
packages/language-service/src/definitions.ts Outdated Show resolved Hide resolved
packages/language-service/src/expressions.ts Show resolved Hide resolved
packages/language-service/src/locate_symbol.ts Outdated Show resolved Hide resolved
packages/language-service/src/locate_symbol.ts Outdated Show resolved Hide resolved
packages/language-service/test/definitions_spec.ts Outdated Show resolved Hide resolved
packages/language-service/test/definitions_spec.ts Outdated Show resolved Hide resolved
packages/language-service/test/definitions_spec.ts Outdated Show resolved Hide resolved
@kyliau kyliau added the target: patch This PR is targeted for the next patch release label Jan 15, 2020
@ayazhafiz ayazhafiz requested a review from kyliau January 16, 2020 03:35
@ayazhafiz ayazhafiz requested a review from kyliau January 18, 2020 06:28
packages/language-service/src/definitions.ts Outdated Show resolved Hide resolved
packages/language-service/src/locate_symbol.ts Outdated Show resolved Hide resolved
packages/language-service/src/locate_symbol.ts Outdated Show resolved Hide resolved
packages/language-service/test/definitions_spec.ts Outdated Show resolved Hide resolved
@ayazhafiz ayazhafiz requested a review from kyliau January 22, 2020 07:13
@kyliau kyliau added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jan 22, 2020
Ayaz Hafiz and others added 3 commits January 22, 2020 19:19
In Angular, symbol can have multiple definitions (e.g. a two-way
binding). This commit adds support for for multiple definitions for a
queried location in a template.
@ayazhafiz ayazhafiz added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 23, 2020
AndrewKushnir pushed a commit that referenced this pull request Jan 23, 2020
In Angular, symbol can have multiple definitions (e.g. a two-way
binding). This commit adds support for for multiple definitions for a
queried location in a template.

PR Close #34782
sonukapoor pushed a commit to sonukapoor/angular that referenced this pull request Feb 13, 2020
…34782)

In Angular, symbol can have multiple definitions (e.g. a two-way
binding). This commit adds support for for multiple definitions for a
queried location in a template.

PR Close angular#34782
@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 23, 2020
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: language-service Issues related to Angular's VS Code language service cla: yes feature Issue that requests a new feature target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants