Skip to content

Feat request: extract code (not only function) to file (resolving needed imports) #331

@danielo515

Description

@danielo515

Hello.
First, thanks for this plugin, seems to be what I need, albeit I am not yet sure.
For some weird reason, there is no tool when you want to extract a bunch of code to a new file. I'm not talking about a single function, but a group of functions, variables, etc.

I am trying to use Block refactor, but it is always failing everything I tried with typescript. I first tried to refactor a constant, asks me for the file name, then something I don't know what it is, and then fails.
I just tried within a function body, and that seems to be understood as a block, and, to my surprise, rather than extracting the entire function, only the function body is extracted. Am I misunderstood the usage of the plugin? I want to be able to

  • Extract a bunch of functions to a new file, and in the process update all imports
  • Extract a bunch of variables and things to a new file, and in the process update all imports

Not sure if it is worth explaining the errors I'm getting if I didn't understood the purpose of the plugin properly.
Regaards

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions