-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 a symbol of a named export: Do not create export alias #29026
Comments
While we didn't explicitly mention However, I can understand wanting a rename mode that works the old way, too - so i'll make this as a suggestion. |
The new behavior would be handy occasionally, but I would prefer the old one most of the time. |
Honestly, this new
In order to get all symbols in the module to be also named Before, I could just grab any reference of All in all, I also would really appreciate to have the old behavior back |
This also effects renaming a property (destructuring). Then after a rename I suddenly have tons of these aliased properties in my code base that I don't need. Not a good default behavior. A default behavior is always a compromise, but should be more sensible then not. And this isn't the case here. |
It would be great if we can have both renaming behaviors at the same time, rather than disabling some behavior once for all. |
9 times out of 10 I would prefer it to work like the old way. For example, using destructuring (not imports):
When I I usually do not get naming right the first time around. Often I'll just go w/ I'm 😢this behavior was changed without providing an option to maintain the old behavior. |
By the way: Same thing with imports - it even takes longer here. Module a:
Module b:
If I change it in the places Before: F2. 😉 I really shy at renaming things since this change. Has this issue already somehow been discussed by VS Code team? |
i would not hate new renaming as much if it was smart enough so that after renaming it wasn't like:
but rather like
|
I'll second this: a global option for the old behaviour feels necessary. This new I'm sorry but for me the "improved" version is actually felt like a bug that is now preventing me from using renaming all together: I don't want my codebase to be littered with aliases. Just let us rename stuff please. Even a rollback of the feature altogether would be better, with an option to opt-in for alias renaming when things are properly figured out. |
I tried to refactor a prop from a parent React Component with a child SFC, and got the following (crazy) behaviour: Before rename // Parent Component
<ChildComponent
hasError={this.state.disabled}
/>
// Child Component
interface ChildProps {
hasError: boolean;
}
ChildComponent: React.SFC<ChildProps> =({
hasError,
}) => (<div>{hasError}</div>); After rename // Parent Component
<ChildComponent
disabled={this.state.disabled}
/>
// Child Component
interface ChildProps {
disabled: boolean;
}
ChildComponent: React.SFC<ChildProps> =({
hasError: disabled,
}) => (<div>{hasError}</div>); It correctly renamed the interface, then aliased the props for actual usage in the ChildComponent(!) This cannot be the desired behaviour... |
As workaround, until this issue will be fixed, I let VSCode Rename Symbol the alias in the export from: export { test11 as test1 } to: export { test11 as test11 } and then delete the alias: export { test11 } |
This behaviour is terrible. |
It's 2020 now, any further progress? |
Isn't there a fix yet? |
Apparently for someone, somewhere, this is how it is supposed to work! |
Crazy :))) |
Hey, i was wondering about the same thing. I thought rename refactoring was super-cool until i realized that when you use object destructuring it uses aliases instead of renaming. Is there any workaround or fix coming soon? |
Yeah, its completely stupid. |
Does the setting |
When I rename a symbol which is a named export in a module, then there is just an alias created in the module
export
(VS Code 1.30). What I would expect is that the symbol is renamed in the module export AND all in all modules that are importing it (that is the bevavior of 1.29.1). Or an option by which I can specify the old behavior. This feature is soo useful to rename a bunch of modules.Release notes of 1.30 only include some rename changes for destructuring , but I did not have any destructuring in code.
Old (1.29.1):
New (1.30):
Does this issue occur when all extensions are disabled?: Yes, running clean versions of 1.30, 1.29.1
PS: Typescript 3.2.2 in both tests.// EDIT:
Actually, after all VS Code 1.29.1 did use Typescript 3.1.4 in the first test, not 3.2.2. Switching to TS 3.2.2 with the old 1.29.1 version, the same behavior (just aliasing the export instead of renaming in the whole workspace) reoccurs.
I am not sure, if there are interdependencies between VS Code and TS and therefore leave the issue open or not?
The text was updated successfully, but these errors were encountered: