Closed mattn closed 2 years ago
Yes, of course, in my little roadmap it looks like this:
For now, refactoring seems complex task, so we need to think about nice architecture of this tasks (interfaces, persistance, etc).
it will be a great job if javacomplete2 supports refactoring. maybe you can have a look on vim-jde, which supports refactoring but buggy.
@artur-shaik hi here is a plugin i have used for java to auto insert get and set. https://github.com/vim-scripts/java_getset.vim i think you can have a look ,maybe you will create some function,such as rewirte toString equals hashcode and so on.
thanks, will keep it on mind.
The simple refactor function i have add into my vimrc,do you want to add these to the JC2 plugin?
@artur-shaik Hi,now I have some free time,and I want to works on the new feature,but what is the next step of the dev on this plugin. which feature do user need about refactor?
I think you can investigate on any of this, share your thoughts, or ask anything you need.
@artur-shaik by the way, debugging support is on the plans? :sparkles::yum::sparkles:
@adelarsq have not think about it yet. As usual need more investigation :relaxed:
With time I want merge this two projects: https://github.com/vim-scripts/yavdb and https://github.com/vmarquez/jvdb Some day I will do that. One thing that would be usefull is run the actual Java class. Nowadays I use https://github.com/thinca/vim-quickrun for this.
now I am using https://github.com/wsdjeg/JavaUnit.vim for java test
Yeap. Also I use JavaUnit.vim for Java and vim-test for others languages.
Setters, getters generation demo:
Key mappings:
nmap <silent> <buffer> <leader>jA <Plug>(JavaComplete-Generate-Accessors)
nmap <silent> <buffer> <leader>js <Plug>(JavaComplete-Generate-AccessorSetter)
nmap <silent> <buffer> <leader>jg <Plug>(JavaComplete-Generate-AccessorGetter)
nmap <silent> <buffer> <leader>ja <Plug>(JavaComplete-Generate-AccessorSetterGetter)
Any suggesstions?
I use https://github.com/wsdjeg/java_getset.vim/blob/master/ftplugin/java_getset.vim and it support se the template of set and get use g:javagetset_getterTemplate
and I think some people like
public void setName(String name){
this.name = name;
}
and some people like
public void setName(String name)
{
this.name = name;
}
and I like Accessors buffer.it is much better than use input()
@wsdjeg yeah, to use templates would be nice. And I think static
and final
should be considered.
I don't know if you have access to the full AST to do this, but the ability to extract a method would be lovely as seen here and the ability to intelligently rename a class or variable would be awesome (I rename class foo to class bar and all references in my project change from foo to bar)
But yeah, what you have now is amazing! Thank you so much!
@DonnieWest, yeah, I believe this is possible and is big challenge, too. Will try to move to this step by step implementing other easier to implement features. And may be separate issues for this?
Found this today. It might aid in the extraction or renaming classes/variables.
https://github.com/javaparser/javasymbolsolver
If you still want me to, I can open up separate issues for the refactor ideas here.
Seems can be helpful, thanks. I'm still consider to try antlr
project for parsing, so maybe in future we will discard javaparser
project for flexibility. But this is just thoughts, will see.
What about issues for ideas. It can be helpful I think, in any case we can link it here.
Consider switch to jc.nvim
I'm thinking most of motivation for using IDEs for java is
Currently 1 and 2 is done (but 2 support just to add import not remove and format). How about to add refactor method?