-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
Extract into simple component refactoring #2496
Conversation
Hi, can you update the questions if their status has changed? I will answer later. |
Done. It also would be nice to normalize generated |
The current code is a bit difficult to review. It would be great if it can be abstracted into multiple functions according to the intention. I will be happy to help realize it. |
@zardoy |
@hkochniss For vscode specifically you can check Vue Extract Component As you noticed I currently don't work on this, this pr requires some debugging & issues resolving. Probably going to spend some time later |
I will look into this and #2524 in |
I think the functionality is working fine now, let's merge it. |
We can try setting addMissingImports command for
Let's ditch the options api for this functionality, the current workload is already a bit unmaintainable. |
Options API is also supported by f012a57, I found that we already have the code to modify the |
omg thank you so much, now this code action would save a lot of time in big legacy code bases that use options api! |
ref #2495
I'm attaching gif so you can easier to understand what is happening there:
GIF
code
Please let me know wether you are interested in the idea itself (and probably having some help here ;)
Updated questions:
virtualFile
mapping for specific interpolation range (eg v-bind directive). When I figure it out I will removetemplateFormatScript
usage in favor oftemplateAst
so there is a better detection wether identifier should be written toemits
. Sorry, for me its really hard to understand what is happening in template's codegen 😆In other words I currently map over generatedRanges and filter only identifiers and while it works in most cases I think it can give unpredictable results.
edit.changes
cant be used along withdocumentChanges
, is this intentional? So how to update current file and create a new one with code action then? On the other hand I think we should ask a name for component before, so it means moving to command with arguments likeedits
andaddImportPosition
. Or we can ask for component name after its creation and do file rename then for now.todo:
Also if you're happy with idea, settings should be added to allow configure creating new components (e.g. force composition or options API to use)