angular / vscode-ng-language-service

Angular extension for Visual Studio Code
MIT License
773 stars 116 forks source link

Rename Symbol for @Input template references #2013

Closed riivanov closed 6 months ago

riivanov commented 6 months ago

Is your feature request related to a problem? Please describe.

When trying to rename an @Input I would expect F2 to also rename in the template.

This issue has been brought up many times, but is always closed due to inactivity. I don't see why, because it would solve a real problem. #252 #29. There is also a stackoverflow thread about this same problem.

I encountered this problem when trying to add strictTemplates to our codebase. I have over 500 errors to handle. We are currently trying to introduce a style guide to the project, and would like all boolean variables to be preceded by is or should to signify the type. This in turn would require modifying all of the template references.

This might be possible for 1 .component.ts file, but when you are trying to apply a style guide to an entire project, it quickly becomes obvious that this is something which would benefit from automation. Why spend company time and therefore money, when we could automate?

🚀 feature request

Description

I would expect F2 to rename my @Input in the templates which reference it, as well as the .ts files. It already does this for .spec.ts files, so logically the .component.html files would be a next step.

Feature Type

Rename Symbol F2 for @Input template references.

Describe the solution you'd like

I would expect to have all references to the class property variable, html or ts be updated, not just some.

Describe alternatives you've considered

Currently I only see manually changing each template reference as the only option, which in my case as evident by the image below would become quite cumbersome.

I did look at extension in the marketplace which might do this, but to no avail.

Anything else relevant?

image

atscott commented 6 months ago

The root cause here is that VSCode has no reliable way to ensure a rename provider is used for a language. Rather than renaming sometimes working in TS files depending on what file you opened first in your workspace, we decided to disable rename support completely from TS files. You can find more information here: https://github.com/microsoft/vscode/issues/115354

Note that you can rename the inputs or any other property from the external template file.

Closing as not possible due to VSCode limitations.

angular-automatic-lock-bot[bot] commented 5 months ago

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.