Auto-Import icon indicating copy to clipboard operation
Auto-Import copied to clipboard

Place imports after licence/comment headers

Open DenysVuika opened this issue 8 years ago • 6 comments

For the moment top comments (license headers) are not respected during auto-import. For example:

sample.ts

/*!
 * @license
 * Copyright 2016 Company.
*/

export class MyClass {}

During auto-import the line will be added to the top of the file:

sample.ts

import { Observable } from 'rxjs/Rx';
/*!
 * @license
 * Copyright 2016 Company.
*/

export class MyClass {}

Expected behaviour: it should put imports after top comment block (ideally to be configurable via some settings flag)

DenysVuika avatar Oct 26 '16 08:10 DenysVuika

Working on this as we speak :)

cheers!

soates avatar Oct 26 '16 08:10 soates

New imports should be placed at the bottom of the imports. And according to the Angular Style Guide, imports should be divided into 2 sections, leaving one empty line between third party imports and application imports.

MichalLytek avatar Oct 26 '16 20:10 MichalLytek

Yeah, I agree - I am going to build some configuration into this.

soates avatar Oct 27 '16 07:10 soates

+1

Please add them under both the "/*" and "//" types of comment, if they are before any existing import/declaration.

electrotype avatar Dec 17 '16 17:12 electrotype

@soates Is there anything we can do to help you with this feature? If you already have something for this, maybe push it in a new branch so someone else can continue to work on it.

SamVerschueren avatar Feb 16 '17 15:02 SamVerschueren

Perhaps this extension might help https://marketplace.visualstudio.com/items?itemName=peterjuras.sort-imports

leocaseiro avatar May 16 '17 07:05 leocaseiro