Visitar URL original
feat(language-service): TS references from template items by ayazhafiz · Pull Request #37437 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20220321073105/https://github.com/angular/angular/pull/37437
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): TS references from template items #37437

Closed
wants to merge 3 commits into from

Conversation

ayazhafiz
Copy link
Member

@ayazhafiz ayazhafiz commented Jun 4, 2020

Keen and I were talking about what it would take to support getting
references at a position in the current language service, since it's
unclear when more investment in the Ivy LS will be available. Getting TS
references from a template is trivial -- we simply need to get the
definition of a symbol, which is already handled by the language
service, and ask the TS language service to give us the references for
that definition.

This doesn't handle references in templates, but that could be done in a
subsequent pass.

Part of angular/vscode-ng-language-service#29

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Feature

Does this PR introduce a breaking change?

  • Yes
  • No

@pullapprove pullapprove bot requested review from devversion and kyliau Jun 4, 2020
@ayazhafiz ayazhafiz removed the request for review from devversion Jun 4, 2020
@pullapprove pullapprove bot requested a review from devversion Jun 4, 2020
Copy link
Contributor

@kyliau kyliau left a comment

Did you mean to not expose this for now?

We'll need to make getReferencesAtPosition part of the plugin for it to be externally available.

const proxy: tss.LanguageService = Object.assign(
// First clone the original TS language service
{}, tsLS,
// Then override the methods supported by Angular language service
{
getCompletionsAtPosition,
getQuickInfoAtPosition,
getSemanticDiagnostics,
getDefinitionAtPosition,
getDefinitionAndBoundSpan,
});
return proxy;

packages/language-service/src/typescript_host.ts Outdated Show resolved Hide resolved
packages/language-service/test/references_spec.ts Outdated Show resolved Hide resolved
packages/language-service/test/references_spec.ts Outdated Show resolved Hide resolved
Copy link
Member

@devversion devversion left a comment

LGTM for bazel build change! (as always 😄 )

@ayazhafiz
Copy link
Member Author

@ayazhafiz ayazhafiz commented Jun 5, 2020

Did you mean to not expose this for now?

We'll need to make getReferencesAtPosition part of the plugin for it to be externally available.

I think it's okay to expose it in this package, it doesn't need to be known by the VSCode extension until it's in a more useful state IMO.

@ayazhafiz ayazhafiz requested a review from kyliau Jun 5, 2020
ayazhafiz added 2 commits Jun 7, 2020
Keen and I were talking about what it would take to support getting
references at a position in the current language service, since it's
unclear when more investment in the Ivy LS will be available. Getting TS
references from a template is trivial -- we simply need to get the
definition of a symbol, which is already handled by the language
service, and ask the TS language service to give us the references for
that definition.

This doesn't handle references in templates, but that could be done in a
subsequent pass.

Part of angular/vscode-ng-language-service#29
kyliau
kyliau approved these changes Jun 8, 2020
});
});

// TODO: override parsing-cases#TemplateReference for inline templates.
Copy link
Contributor

@kyliau kyliau Jun 8, 2020

Choose a reason for hiding this comment

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

This'd be nice, TemplateReference already has an external template though..

Copy link
Member Author

@ayazhafiz ayazhafiz Jun 8, 2020

Choose a reason for hiding this comment

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

yeah but we can just overwrite and replace templateUrl

packages/language-service/test/references_spec.ts Outdated Show resolved Hide resolved
packages/language-service/test/references_spec.ts Outdated Show resolved Hide resolved
@ngbot ngbot bot added this to the needsTriage milestone Jun 8, 2020
@ngbot ngbot bot added this to the needsTriage milestone Jun 8, 2020
@ngbot ngbot bot added this to the needsTriage milestone Jun 8, 2020
kyliau
kyliau approved these changes Jun 8, 2020
atscott added a commit that referenced this issue Jun 9, 2020
Keen and I were talking about what it would take to support getting
references at a position in the current language service, since it's
unclear when more investment in the Ivy LS will be available. Getting TS
references from a template is trivial -- we simply need to get the
definition of a symbol, which is already handled by the language
service, and ask the TS language service to give us the references for
that definition.

This doesn't handle references in templates, but that could be done in a
subsequent pass.

Part of angular/vscode-ng-language-service#29

PR Close #37437
ngwattcos added a commit to ngwattcos/angular that referenced this issue Jun 25, 2020
)

Keen and I were talking about what it would take to support getting
references at a position in the current language service, since it's
unclear when more investment in the Ivy LS will be available. Getting TS
references from a template is trivial -- we simply need to get the
definition of a symbol, which is already handled by the language
service, and ask the TS language service to give us the references for
that definition.

This doesn't handle references in templates, but that could be done in a
subsequent pass.

Part of angular/vscode-ng-language-service#29

PR Close angular#37437
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Jul 10, 2020

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 Jul 10, 2020
profanis added a commit to profanis/angular that referenced this issue Sep 5, 2020
)

Keen and I were talking about what it would take to support getting
references at a position in the current language service, since it's
unclear when more investment in the Ivy LS will be available. Getting TS
references from a template is trivial -- we simply need to get the
definition of a symbol, which is already handled by the language
service, and ask the TS language service to give us the references for
that definition.

This doesn't handle references in templates, but that could be done in a
subsequent pass.

Part of angular/vscode-ng-language-service#29

PR Close angular#37437
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants