Skip to content
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

How should we handle directory renames with 'getEditsForFileRename'? #24260

Closed
mjbvz opened this issue May 18, 2018 · 6 comments
Closed

How should we handle directory renames with 'getEditsForFileRename'? #24260

mjbvz opened this issue May 18, 2018 · 6 comments
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@mjbvz
Copy link
Contributor

mjbvz commented May 18, 2018

For a project:

jsconfig.json
index.ts
sub/
    a.ts
    b.ts

Where index.ts:

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

If the user renames the directory sub -> sub2, how should we handle updating the paths using the getEditsForFileRename api? Is this something we want to support in V1?

I'm concerned that renaming directories may require a call to getEditsForFileRename for each file, which will be chatty

@mjbvz mjbvz assigned ghost May 18, 2018
@ghost
Copy link

ghost commented May 18, 2018

The code doesn't support this currently, so this is something we'll have to add. I think we're wrapping up ts2.9 today so no time to add it to that.

@ghost ghost added Suggestion An idea for TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol labels May 18, 2018
@mjbvz
Copy link
Contributor Author

mjbvz commented May 18, 2018

Ok, should the API be updated so that we can support this in the future? Or do you think the existing API will work?

@ghost
Copy link

ghost commented May 18, 2018

I think we can just use the current function and detect that the path passed in is a directory.

@mjbvz
Copy link
Contributor Author

mjbvz commented May 18, 2018

Good with me. Just one question: what would the file be in that case? Just any file ts in the current project?

@ghost
Copy link

ghost commented May 18, 2018

Right. The 'file' argument doesn't even show up in the LanguageService method.

@mhegazy mhegazy added this to the TypeScript 2.9.2 milestone May 19, 2018
@mhegazy
Copy link
Contributor

mhegazy commented May 19, 2018

@andy-ms let's try to get this in the next servicing release 2.9.2

@ghost ghost added the Fixed A PR has been merged for this issue label May 21, 2018
@ghost ghost closed this as completed in #24305 Jun 1, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants