Vscode-ng-language-service: Feature request: Get references in template (getReferencesAtPosition)

Created on 19 Dec 2016  ·  16Comments  ·  Source: angular/vscode-ng-language-service

Hi,

as for now you can navigate to source by ctrl+click, or peek definition, but if you use find all usages template occurencies on methods or properties are not in result window.

This would be awesome, but i`m not sure that this is possible to do in VsCode, but it would be nice :). Especially while refactoring code, since right now this occurencies can be forgotten or must be string searched.

Thank you

feature ivy lib

Most helpful comment

We are going to launch Ivy version of the language service in version 11 (November 2020). Once it's achieve feature parity with the existing View Engine language service, we'll prioritize this feature! Switching to the Ivy backend enables us to implement features like this one, which was almost impossible previously.

All 16 comments

This would also enabling symbols in templates (i.e. using F2)

Someone is doing something with this?!

anything new?

We should be able to implement this by adding getReferencesAtPosition to the Language Service's TypeScript plugin. However, we will probably hold off on doing this until the language service is rewritten to use Angular's new Ivy compiler, which will make it easier to extract the class properties used in a template.

(note: perhaps we can use the Angular indexing API or similar for this)

@kukjevov @kyliau Can you update title and content of this issue
many people are creating duplicates as this is not visible in search

Suggestion: Find property references in template from typescript

It had different name Feature request: Find usages shows also occurencies in templates as you can see but it was changed by @kyliau

So you have to make agreement with him :).

4 years?) I wonder how WebStorm got this faster than VScode O_o

This would be a great feature. Is there any timeline or priority on this? I think this issue also relates to #252

We hear you! @ayazhafiz and I are thinking about ways to support this in Angular language service. @ayazhafiz already has a PR ready that partially* supports this feature.
We're currently looking into the best way to introduce get references without adding too much overhead, since much of this code will not be reused once we switch the backend to Ivy.

Re partial support:
References from template can be easily retrieved, whereas references from TS (for example a field in a class) is more difficult because we need to check the template. The former is what Ayaz's PR is for.

I would be very thankful for every process.

Any news on this? Seems the PR wasn't merged

Really excited about this feature, is there any news about it ?
Very painful to track down broken reference in the template while renaming the symbol in the typescript file.

We are going to launch Ivy version of the language service in version 11 (November 2020). Once it's achieve feature parity with the existing View Engine language service, we'll prioritize this feature! Switching to the Ivy backend enables us to implement features like this one, which was almost impossible previously.

This has been fixed by the new Ivy-native language service, released in v11.1.0.
It's an opt-in feature for now, please give it a try and let us know if you have any feedback.
For the best editor experience, please make sure your project has strictTemplates enabled in angularCompilerOptions.
In case you run into similar bug, please file a new issue. I'll close this for now.

Should we be seeing the correct # of references via CodeLens too? Because Ctrl-Click / Find all References does work, but codelens references and a click on it does not show template refs. I'm assuming that CodeLens pulls these refs from somewhere else, or am I missing a config flag somewhere?

Should we be seeing the correct # of references via CodeLens too?

Great question! It looks like there's additional configuration needed on our end for integrating with CodeLens. Could you open a new issue for this?

Edit: Re-opening #162

Was this page helpful?
0 / 5 - 0 ratings