ialexivy / vscode-angular2-files

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

Adding New component breaks imports in NgModule of app.module.ts #44

Closed Feargalicious closed 4 years ago

Feargalicious commented 5 years ago

When adding a new component, the import section of NgModule gets deleted and a \n seems to be added.

imports: [ RouterModule.forRoot([ { path: '', component: HomeComponent, pathMatch: 'full' }, { path: 'home', component: HomeComponent }, { path: 'admin', component: AdminComponent }, { path: 'queue', component: QueueComponent }, ]), BrowserModule, BrowserAnimationsModule, HttpClientModule, MaterialModule, FormsModule, ReactiveFormsModule, ]

Turns into

imports: [ RouterModule.forRoot([\npath ]

app.module.ts-before.txt app.module.ts-after.txt

joffff commented 5 years ago

+1

This still happens in 1.6.2. The correct component is being imported and added to the declarations in NgModule but the RouterModule breaks, with my version looking like:

imports: [
    RouterModule.forRoot([\n\t\t\tpath
],
ialexivy commented 4 years ago

Fixed