ThePrimeagen / ThePrimeagen/refactoring.nvim
Feat request: extract code (not only function) to file (resolving needed imports)
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 3.6k
- Forks
- 106
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Block refactor entry point and the TypeScript-related behavior described in the issue. The requested result is extracting multiple functions, variables, or other code into a new file while resolving and updating imports; the existing extraction failures and import-handling scope need to be established before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100