Skip to content

Organize imports yields no-op edits #50486

@pushkine

Description

@pushkine

Bug Report

🕗 Version & Regression Information

VSCode stable & insiders
ts stable & nightly

💻 Reproduction

Create a typescript file:

import 'a';
import 'b';
import 'c';
import 'd';

//

Run command Organize Imports

🙁 Actual behavior

VSCode insiders (1.71.0); built-in typescript (4.8.2); verbose

  • Request Organize Imports

    {
      seq: 54,
      type: "request",
      command: "organizeImports",
      arguments: {
        scope: { type: "file", args: { file: "c:/dev/bug/index.ts" } },
        skipDestructiveCodeActions: false
      }
    }
  • Response Organize Imports

    {
      seq: 0,
      type: "response",
      command: "organizeImports",
      request_seq: 54,
      success: true,
      body: [
        {
          fileName: "e:/dev/bug/index.ts",
          textChanges: [
            {
              start: { line: 1, offset: 1 },
              end: { line: 2, offset: 1 },
              newText: "import 'a';\nimport 'b';\nimport 'c';\nimport 'd';\n",
            },
            { start: { line: 2, offset: 1 }, end: { line: 3, offset: 1 }, newText: "" },
            { start: { line: 3, offset: 1 }, end: { line: 4, offset: 1 }, newText: "" },
            { start: { line: 4, offset: 1 }, end: { line: 5, offset: 1 }, newText: "" },
          ],
        },
      ],
    }
  • File update

    {
      seq: 55,
      type: "request",
      command: "updateOpen",
      arguments: {
        changedFiles: [
          {
            fileName: "e:/dev/bug/index.ts",
            textChanges: [
              {
                newText: "import 'b';\nimport 'c';\nimport 'd';\n",
                start: { line: 2, offset: 1 },
                end: { line: 2, offset: 1 },
              },
              { newText: "", start: { line: 2, offset: 1 }, end: { line: 3, offset: 1 } },
              { newText: "", start: { line: 3, offset: 1 }, end: { line: 4, offset: 1 } },
              { newText: "", start: { line: 4, offset: 1 }, end: { line: 5, offset: 1 } },
            ],
          },
        ],
        closedFiles: [],
        openFiles: [],
      },
    }

🙂 Expected behavior

  • Response Organize Imports
    {
      seq: 0,
      type: "response",
      command: "organizeImports",
      request_seq: 54,
      success: true,
      body: []
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions