Select multiple fields when generating getters/setters, constructors, etc..
I have been trying this plugin to replace JavaComplete2, but I have found a strange limitation on the method generation actions.When I try to generate a constructor, for examples, I can only select of the Class fields at a time. The same goes for generating getters and setters. Would it be possible to implement a way to select multiple field just like JavaComplete2 does? In a related matter, would be possible to separate setter and getter generation options? Sometimes I just need to create one or the other, not both.
The problem is we don't have multiple selection method with vim.
Well you can reuse coc-list code for that I guess.
Are there any plans to add such a functionallity to coc.nvim so that this can be implemented?
Well you can reuse coc-list code for that I guess.
Yes, it's just a bit complicated.
As this is kinda of a showstopper for me, would you accept a PR which implements this functionality by doing multiple rounds of asking to select a field?
E.g. (~ shows user input):
Select fields:
1. name
2. age
3. height
4. cancel
~ 1
Select field:
1. age
2. height
3. cancel
~ 2
Select field:
1. age
2. cancel
~ [no input only enter]
You would have selected field 1,2
When selecting cancel the whole process would abort.
It is a bit primitive, but given what is currently available it is a basic solution which would work.
In the PR I provided the naive simple approach. It works but it is nothing fancy.
Well you can reuse coc-list code for that I guess.
Yes, it's just a bit complicated.
Well, maybe you could start with something simple - just create a buffer where each line would be the field name. User would delete lines he doesn't want and save the buffer. After it's saved you generate getters and setters and remove it.
Should be fixed on recent version of coc-java, try upgrade coc.nvim to latest release and coc-java to version 1.14.0.
Multiple selection is support on recent coc.nvim.
Curious… what's the keybinding to tick the boxes in the pop-up menu to select the fields for generating the constructor?