ialexivy / vscode-angular2-files

vscode extension generating angular files with angular cli
MIT License
61 stars 36 forks source link

app.module.ts modified incorrectly when "generate component" is called #50

Closed Sch8i closed 4 years ago

Sch8i commented 4 years ago

When I call "generate component" about a right-click on a folder, the file app.module.ts will modify incorrectly.

I have made a test in different versions. I have installed version 1.4.0 and newer. As I installed version 1.6.1 I recognized, that the app.module.ts will modify incorrectly. In version 1.6.2 you can find the same behavior.

Mr-MooMoo commented 4 years ago

Same issue with me. After seleting "Generate Component" my broken app.module.ts looks like this (see RouterMoudule Entry):

(....) ], imports: [ BrowserModule, HttpClientModule, FormsModule, RouterModule.forRoot([\npath ], providers: [ RestockListService, SearchService ], bootstrap: [ AppComponent ] (...)

akeskinen commented 4 years ago

I've had same issue for a while. It breaks app.module by adding import to invalid place. If app.module is not open, it is not undoable, but if you keep file open in VS code, you undo changes.

This is annoying problem, which should be fixed if this project is still alive.

martingraham commented 4 years ago

It mangles my app.module providers section when I have an object-like entry such as { provide: HTTP_INTERCEPTORS, etc}, in it

That gets replaced with just provide: which kicks off errors