Skip to content

Organize Import creates whitespace that needs to be deleted manually #40736

Closed
@jsgoupil

Description

@jsgoupil

TS Template added by @mjbvz

TypeScript Version: 4.1.0-dev.20200918

Search Terms

  • organize imports

  • VSCode Version: 1.49.1 (user setup)
  • OS Version: Windows_NT x64 10.0.19041

I am not 100% sure what is the exact scenario how to reproduce this, but it happens 90% of the time. When I press ALT+SHIFT+O (Organize Imports), I get plenty of spacing in my imports.
The rules for organizing these imports seem to be all over the place, which one ends up on their own line? etc.
I always have to clean up manually.

These imports:

import {
    ChangeDetectionStrategy,
    Component,
    ContentChild,
    EventEmitter,
    Input,
    Output,
    TemplateRef,
    AfterViewInit,
    ChangeDetectorRef,
    HostBinding,
    ElementRef,
    ViewChild
} from '@angular/core';
import { Resource, ClickableResource } from '@models/resource';
import { newGuid } from '@utility/string';
import { DragulaService } from 'ng2-dragula';

Become:

import {
    AfterViewInit, ChangeDetectionStrategy,







    ChangeDetectorRef, Component,
    ContentChild,







    ElementRef, EventEmitter,





    HostBinding, Input,
    Output,
    TemplateRef,




    ViewChild
} from '@angular/core';
import { ClickableResource, Resource } from '@models/resource';
import { newGuid } from '@utility/string';
import { DragulaService } from 'ng2-dragula';

Video of what is happeining.
spacing-incorrect.zip

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterDomain: Organize ImportsIssues with the organize imports featureEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do thisRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions