question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rename a symbol of a named export: Do not create export alias

See original GitHub issue
  • VSCode Version: 1.30
  • OS Version: Win 10

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):

vscode_1 29 1

New (1.30):

vscode_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?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:28
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

18reactions
mattiascaricatocommented, Jan 5, 2021

unckeck the following preferences in settings to make it work:

typescript.preferences.useAliasesForRenames

image

18reactions
anna-buchercommented, Jan 24, 2019

I’ll second this: a global option for the old behaviour feels necessary. This new alias does not work at all with the way some people work and imposing this new “feature” on people for something as common as symbol rename is not nice.

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

export - JavaScript - MDN Web Docs
This re-exports all named exports from mod as the named exports of the current module, but the default export of mod is not...
Read more >
Stop VS Code from adding 'as' or alias in destructured ...
By default, VS Code attempts to make renames safe. This means preserving the existing interfaces of types. In cases like the following ...
Read more >
Export Clauses - Scala 3 - EPFL
An export clause defines aliases for selected members of an object. Example: ... They are created by the compiler, but are not considered...
Read more >
Export Clauses
Export Clauses · A simple selector x creates aliases for all eligible members of path that are named x . · its owner...
Read more >
Module Exports vs. Export Default: Why Not Both?
But it wasn't exported twice. In the ES6 module world, this rigs it up so you can both do import A from './a'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found