Skip to content

Organize imports removes file header comment #22723

@mjbvz

Description

@mjbvz

TypeScript Version: 2.8.0-dev20180320

Search Terms:

  • Organize imports

Code
For the js:

/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as fs from 'fs'

function foo() {
    this.x = 1;
}

Run organize imports.

Expected behavior:

Only import is removed

Actual behavior:

Import plus the header comment are removed, leaving:

function foo() {
    this.x = 1;
}

Trace:

[Trace  - 10:41:32 AM] Response received: organizeImports (34). Request took 3 ms. Success: true 
Result: [
    {
        "fileName": "/Users/matb/projects/san/index.js",
        "textChanges": [
            {
                "start": {
                    "line": 1,
                    "offset": 1
                },
                "end": {
                    "line": 7,
                    "offset": 1
                },
                "newText": ""
            }
        ]
    }
]

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: LS: Organize ImportsIssues with the organize imports featureFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions