-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Rename of import should be a local rename #14039
Comments
The current behavior is exactly what I expect and want. To rename all instances of something in a given file, |
What editor are you using? What does |
I think it would be better to leave the current way as it is, and use this trick to do the alias rename only
Unfortunately there is related bug: #10894 |
@andy-ms Ah, sorry; I was actually thinking of this as an editor feature/tool, rather than a language one (kind of surprises me that the language itself controls this). I use VS Code. |
I think the behavior should depend on the context, but I am not sure it is possible. Say, given import { readFileSync } from "fs";
readFileSync("a.txt"); If the cursor is in the A similar issue exists with object shorthand notation (renaming a symbol that's used in shorthand also renames its object key, instead of separating the key/value). |
It makes a lot of sense for the language to control this; correct refactorings require deep knowledge of the semantics of the language being edited.
It is a useful approximation when you don't have better tools for the job, i.e. semantically-aware refactorings. I think this change is needed, at least in the case where a refactor would end up editing a file under |
TypeScript Version: nightly (2.2.0-dev.20170213)
Code
Rename
readFileSync
toread
.Expected behavior:
Actual behavior:
And
@types/node/index.d.ts
is modified too!The text was updated successfully, but these errors were encountered: