Linux / 开发 · 1月 16, 2023 0

shortcut to remove unused imports in visual studio code


Is there some plug-in of Visual Studio Code that could help us to tidy and organize the imports and references quickly and effectively?Or other functions like automatically removing those unused imports and declarations from the app.module?

import { AutoCompleteModule,InputSwitchModule } from 'primeng/primeng';
import { ListboxModule } from 'primeng/primeng';

Could been converted to similarily .

import { AutoCompleteModule,
         ListboxModule  } from 'primeng/primeng';

Visual Studio Code has evolved ( Since VSCode v.1.24 and TypeScript v.2.9) and provides this functionality in-built as the command "Organize imports".

option+Shift+O for Mac
Alt + Shift + O for Windows/Linux
%d 博主赞过: