Skip to content

Offer 'convert import to namespace' even when selection extends to next lineΒ #45687

Closed
@mjbvz

Description

@mjbvz

Bug Report

πŸ”Ž Search Terms

  • refactor / refactoring
  • code action
  • imports

πŸ•— Version & Regression Information

4.5.0-dev.20210901

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

For the TS:

import { join } from "path";
import * as fs from "fs";

fs.readFileSync(join('a', 'b'));
  1. Place cursor on the start of the first line, hold shift, then press down arrow
  2. The selection should look like this:

Screen Shot 2021-09-01 at 3 39 15 PM

Notice how the cursor in on line 2 but there's no actual selection on that line

  1. Now try running refactorings

πŸ™ Actual behavior

No refactoring returned

πŸ™‚ Expected behavior

A refactoring for convert import to namespace should be returned since we only have the import statement selected

Here's the request we make to TS Server:

Arguments: {
    "file": "/Users/matb/projects/san/bar.ts",
    "startLine": 1,
    "startOffset": 1,
    "endLine": 2,
    "endOffset": 1,
    "triggerReason": "invoked"
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions