Skip to content

Organize imports moving imports before file header #22731

@mjbvz

Description

@mjbvz

TypeScript Version: 2.8.0-dev20180320

Search Terms:

  • Organize imports
  • vscode

Repo Steps

  1. In the vscode source repo.
  2. Open webview.ts
  3. Run organize imports

Bug:

Imports split around file header comment:

import { addClass, addDisposableListener } from 'vs/base/browser/dom';
import { Emitter, Event } from 'vs/base/common/event';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { nativeSep } from 'vs/base/common/paths';
import { startsWith } from 'vs/base/common/strings';
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
import URI from 'vs/base/common/uri';
import { IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { editorBackground, editorForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
import { DARK, ITheme, IThemeService, LIGHT } from 'vs/platform/theme/common/themeService';
import { WebviewFindWidget } from './webviewFindWidget';
[Trace  - 13:44:19] Response received: organizeImports (5142). Request took 14 ms. Success: true 
Result: [
    {
        "fileName": "/Users/matb/projects/vscode/src/vs/workbench/parts/html/electron-browser/webview.ts",
        "textChanges": [
            {
                "start": {
                    "line": 1,
                    "offset": 1
                },
                "end": {
                    "line": 7,
                    "offset": 1
                },
                "newText": "import { addClass, addDisposableListener } from 'vs/base/browser/dom';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { IDisposable, dispose } from 'vs/base/common/lifecycle';\nimport { nativeSep } from 'vs/base/common/paths';\nimport { startsWith } from 'vs/base/common/strings';\n/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport URI from 'vs/base/common/uri';\nimport { IContextKey } from 'vs/platform/contextkey/common/contextkey';\nimport { IContextViewService } from 'vs/platform/contextview/browser/contextView';\nimport { IEnvironmentService } from 'vs/platform/environment/common/environment';\nimport { editorBackground, editorForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';\nimport { DARK, ITheme, IThemeService, LIGHT } from 'vs/platform/theme/common/themeService';\nimport { WebviewFindWidget } from './webviewFindWidget';\n"
            },
            {
                "start": {
                    "line": 7,
                    "offset": 1
                },
                "end": {
                    "line": 8,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 8,
                    "offset": 1
                },
                "end": {
                    "line": 9,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 9,
                    "offset": 1
                },
                "end": {
                    "line": 10,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 10,
                    "offset": 1
                },
                "end": {
                    "line": 11,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 11,
                    "offset": 1
                },
                "end": {
                    "line": 12,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 12,
                    "offset": 1
                },
                "end": {
                    "line": 13,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 13,
                    "offset": 1
                },
                "end": {
                    "line": 14,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 14,
                    "offset": 1
                },
                "end": {
                    "line": 15,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 15,
                    "offset": 1
                },
                "end": {
                    "line": 16,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 16,
                    "offset": 1
                },
                "end": {
                    "line": 17,
                    "offset": 1
                },
                "newText": ""
            },
            {
                "start": {
                    "line": 17,
                    "offset": 1
                },
                "end": {
                    "line": 18,
                    "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