Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code does not find references of Angular variables in templates

I'm working on an Angular 6 app, and using VSCode 1.31.1 on Windows 7 with Angular Language Service 0.1.11.

When I right-click a method name and select "Find all references", references from templates do not show up.

This makes refactoring harder : when renaming a field/method, one can easily miss calls to this field/method from either html files or inlined templates.

Is there a setting or an extension that can help ?

like image 269
CirClipS Avatar asked Mar 08 '19 10:03

CirClipS


People also ask

How do I enable find all references in Visual Studio code?

The Find All References command is available on the context (right-click) menu of the element you want to find references to. Or, if you are a keyboard user, press Shift + F12.

How do I import an angular project into Visual Studio code?

Now open Visual Studio Code. Go to "File" > "Open Folder" and select "First-Angular-Project" from the "Desktop". Now in the "TERMINAL" run ng new Angular-Project-Demo. Whenever it prompts with something like "Would you like to add Angular routing? (y/N)" press "y" and hit "ENTER".


1 Answers

There is an issue for that, which is now implemented.

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.

like image 187
BuZZ-dEE Avatar answered Oct 12 '22 17:10

BuZZ-dEE