Skip to content

getEditsForFileRename converts imports to relative paths #25132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mjbvz opened this issue Jun 21, 2018 · 3 comments
Closed

getEditsForFileRename converts imports to relative paths #25132

mjbvz opened this issue Jun 21, 2018 · 3 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Jun 21, 2018

From microsoft/vscode#52630

TypeScript Version: 3.0.0-dev.20180619

Search Terms:

  • getEditsForFileRename
  • imports

Code
For a TS project:

tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es2016",
        "jsx": "preserve",
        "baseUrl": ".",
    },
    "exclude": [
        "node_modules",
        "**/node_modules/*"
    ]
}

sub/a.ts

export const a = 1;

sub/index.ts:

import { a } from 'sub/a';
console.log(a);
  1. In VS Code, rename sub/index.ts to sub/index2.ts
  2. Select option to update imports

Expected behavior:
No edits returned from getEditsForFileRename in this case

Actual behavior:
Edits returned from getEditsForFileRename convert sub/index.tsto use relative paths:

import { a } from './a';
console.log(a);

Related Issues:

@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Jun 21, 2018
@mhegazy mhegazy assigned ghost Jun 21, 2018
@mhegazy mhegazy added this to the TypeScript 3.0 milestone Jun 21, 2018
@mhegazy mhegazy added the Bug A bug in TypeScript label Jun 21, 2018
@ghost ghost added the Fixed A PR has been merged for this issue label Jun 22, 2018
@ghost ghost closed this as completed in #25159 Jun 22, 2018
@arackaf
Copy link

arackaf commented Aug 1, 2018

@mjbvz - I see this case is marked as closed / fixed, but the behavior persists in VS Code version 1.25.1, which Code tells me is up to date - I'm running TS 2.9.2.

Did this fix just not make it into the July releases of Code?

@mjbvz
Copy link
Contributor Author

mjbvz commented Aug 1, 2018

It’s fixed in vscode insiders (which uses Ts 3)

@arackaf
Copy link

arackaf commented Aug 1, 2018

Ah gotcha - look forward to that - thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

3 participants