This question is more about how deep inside ng generate command works.
I am using Visual Studio Code to develop an Angular project.
I am generating components and services using the terminal section of the IDE itself.
So, I created a service using the ng g s command while specifying the path, like below:
$ ng g s services/logger/logger
As expected, the aforementioned command created the service and spec files like this:
1. src/app/services/logger/logger.service.ts
2. src/app/services/logger/logger.service.spec.ts
Everything was fine.
Then I thought of renaming the service folder name by uppercasing the first letter. So I made the folder like this:
1. src/app/services/Logger/logger.service.ts
2. src/app/services/Logger/logger.service.spec.ts
Now whenever I am trying to import this service by using “Quick Fix” or IDE suggestions, VSCode always mention the import statement as
import { LoggerService } from '../logger/logger.service';
It grabbed my attention when the IDE cried out about the wrong path saying everything is almost same but the casing of one letter. If I manually change the text to ‘../Logger/logger.service’ it works.
My question is why? Why would the IDE suggest the original path that I mentioned in the command line?
I tried to find traces of the service name or path info in the source code. But I couldn’t find. Does VSCode notes down the original result of the ng command? Or is it saved somewhere in the local .angular folder?
I tried to close the IDE and reopen to see if it still suggests the old path. Yes, it does.
I thought it would be interesting to know the internal works.
Any idea?