tomwhite007/rename-angular-component

Naming Convention Problem

Closed this issue ยท 11 comments

Describe the bug
Cannot rename Componet. Always getting Error: "The component class file must use the same file naming convention as 'controlarea.component.ts' for this process to run."
But component class file IS already using the same file naming convention.

It doesn't matter what the new name should be. Always getting the same error mesage.

All files are already following the angular style guide:
https://angular.io/guide/styleguide#style-02-01

controlarea.component.ts
controlarea.component.html
controlarea.component.css
and selector: app-controlarea
and class name: ControlareaComponent

Screenshots or Demo Repo
image

Thanks for your detailed issue comments. I'm going to try to recreate your scenario but I may need to request a few more details.

I'll comment again shortly.

Regards

Tom

Hello @hablix

I've recreated a component with the same name as yours in a test app/repo here: https://github.com/tomwhite007/test-issue29 - and renaming works fine on my component. This proves that there must be a difference in your configuration that we haven't noted yet. It'd be great if you could clone the repo and see if you can rename it too.

Here's some questions to try to get to the bottom of your issue. If you're willing, I'd be happy to receive any answers you have time to give. Don't feel you have to answer all of them unless you can.

  1. Have you successfully renamed other components within the same application or, have you tried in another app? I need to understand if your problem occurs on one component, one app or on your machine with every app.
  2. What's your OS and version?
  3. Are you using Windows WSL?
  4. Could you try enabling error logging for the Rename Angular Component extension? Set: "renameAngularComponent.debugLog": true and restart VS Code. This will create a log file called rename-angular-component-debug-log.txt (when you rename a component) in the root of your app. Then you can attach the file to this issue.
  5. If number 4 fails to turn up enough info, I may need to request you create a copy of your repo to share with me - with almost all files removed except for the TSconfig and package.json files and the ControlareaComponent file remaining. The app doesn't need to build; it just has to allow the extension to run and fail, for me to find the problem.

Hello @hablix
Have you managed to try renaming other components successfully?
I cannot recreate your problem without you providing further information to the questions in the comment above
I would very much like to help if you can reply.

same here

Hi @hablix and @MohRaouf

The current info provided by @hablix is very helpful but not enough for me to debug against. If either or both of you can provide info to questions 4 or 5 above, that could help a lot.

At the moment my suspicions relate to file access / rights on your machines. If it is something like that, I believe my current PR, Feat/use vscode workspace fs #31 could fix your issue. You could watch this PR and when its merged and released, try again.

If you are able to answer 4 or 5 in the meantime, that would help me confirm (or pivot) before release.

Regards

Tom

Hi.
A quick update.
I'm closing Feat/use vscode workspace fs #31 for performance reasons, so that won't help this issue.
If either of you can answer 4 or 5 above, I can progress this issue.
Hope to hear from you soon.

Hello !
I have the same issue and have done 4.
rename-angular-component-debug-log.txt

Hi @elmehdielhamdi

That was really helpful. Thank you. Your log file highlighted a gap that I need more details from.

I've released a new version to add extra logging around the files it looks for after you enter the new name. Would you mind updating to v2.1.2 and running the same process again? Then if you send me the log file again, I'm hopeful I'll find the issue is related to Windows paths.

Thanks again

Hi @tomwhite007 !

I'm glad that it helped ๐Ÿ˜€. I installed the update and did the same process, here is the new log file:
rename-angular-component-debug-log.txt

Hi @elmehdielhamdi , @MohRaouf , @hablix

Thanks to all of you for your comments, help and feedback.

I believe I now have a solution. PR #37 will close this issue today and the new version 2.1.3 will be deployed. If you still have the same problem after you recieve the update in VSCode, please comment on this issue thread, and I'll reopen it.

Regards

Tom White