Skip to content

Organize imports always returns an edit, even when imports are already sorted #22912

Closed
@mjbvz

Description

@mjbvz

TypeScript Version: 2.9.0-dev.20180327

Search Terms:

  • Organize imports
  • TSServer

Code
For the js:

import { x } from 'x';

console.log(x)

Run organize imports command

Expected behavior:
An edit is only returned if the imports need to be organized

Actual behavior:
An edit is always returned, even if the imports are already sorted

[Trace  - 11:03:39 AM] Response received: organizeImports (69). Request took 3 ms. Success: true 
Result: [
    {
        "fileName": "/Users/matb/projects/zoo/src/sloth.js",
        "textChanges": [
            {
                "start": {
                    "line": 1,
                    "offset": 1
                },
                "end": {
                    "line": 2,
                    "offset": 1
                },
                "newText": "import { x } from 'x';\n"
            }
        ]
    }
]

Metadata

Metadata

Labels

CommittedThe team has roadmapped this issueDomain: Organize ImportsIssues with the organize imports featureFixedA PR has been merged for this issueSuggestionAn idea for TypeScriptVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions