Skip to content

Incorrect getEditsForFileRename with npm linked module #25059

Closed
@mjbvz

Description

@mjbvz

From microsoft/vscode#52022

TypeScript Version: 3.0.0-dev.20180616

Search Terms:

Code

  1. git clone https://github.com/mjbvz/ts-update-paths-npm-link-bug
  2. npm install
  3. Open project in VS Code
  4. Open file d.ts
  5. Rename d.ts to a.ts

Expected behavior:
No edits returned from getEditsForFileRename

Actual behavior:
getEditsForFileRename changes the import for import { abc } from "sub"; to import { abc } from "./sub/src/types"

[Trace  - 2:34:49 PM] Response received: getEditsForFileRename (52). Request took 8 ms. Success: true 
Result: [
    {
        "fileName": "/Users/matb/projects/san/a.js",
        "textChanges": [
            {
                "start": {
                    "line": 3,
                    "offset": 22
                },
                "end": {
                    "line": 3,
                    "offset": 25
                },
                "newText": "./sub/src/types"
            }
        ]
    }
]

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions