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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add and enable the "Convert named imports to namespace imports" refactor action? #46034

Closed
mceachen opened this issue Sep 23, 2021 · 4 comments

Comments

@mceachen
Copy link

Bug Report

馃晽 Version & Regression Information

When trying to patch up a codebase to deal with unbound named imports, I found that the "Convert named imports to namespace imports" refactor action was missing in vscode.

  • This is not a crash
  • This is a new refactor action, afaik, so I don't know if/when it changed between versions
  • This is the behavior in every version I tried. I couldn't find any references to why this refactor would be disabled.
  • I tried this with TS 4.3, 4.4, and 4.5.0-dev.20210923 on stable and insider releases of vscode on Ubuntu 20.04.3

With 4.3:
image

With typescript@next:
image

馃捇 Code

Tested with https://github.com/mceachen/ts44-event-typeerror

馃檨 Actual behavior

The refactor action doesn't exist.

馃檪 Expected behavior

I want this: #46027 (comment)

@mceachen mceachen changed the title How to enable "Convert named imports to namespace imports"? How to add and enable the "Convert named imports to namespace imports" refactor action? Sep 23, 2021
@andrewbranch
Copy link
Member

This consistently works for me on macOS. @orta @elibarzilay or @sandersn would any of you be able to attempt a repro on Linux?

@mceachen
Copy link
Author

mceachen commented Sep 24, 2021

@andrewbranch thanks for the update. I tried on my macOS box, with vscode 1.60.2 (Universal) and got this (using the little test repo linked above, just to minimize moving parts):

Screen Shot 2021-09-23 at 6 12 32 PM

@mceachen
Copy link
Author

Ah: I didn't remember I'd used vscode on that box before, and there were extensions hiding in ~/.vscode. I deleted the prior configs, and behold, the refactoring shows up!

But... it turns out that this refactoring doesn't help solve #46027 at all: it just switches between

import { addListener } from "process";

and

import * as process from "process";

both of which fail with the same error due to invoking the unbound method.

Should I open yet another issue to solve that?

@andrewbranch
Copy link
Member

馃槥 Yes please, thank you @mceachen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants