artur-shaik / vim-javacomplete2

DEPRECATED in favor of jc.nvim
Vim License
974 stars 83 forks source link

Refactor #18

Closed mattn closed 2 years ago

mattn commented 9 years ago

I'm thinking most of motivation for using IDEs for java is

  1. input completion
  2. import correction
  3. refactoring

Currently 1 and 2 is done (but 2 support just to add import not remove and format). How about to add refactor method?

artur-shaik commented 9 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).

richox commented 9 years ago

it will be a great job if javacomplete2 supports refactoring. maybe you can have a look on vim-jde, which supports refactoring but buggy.

wsdjeg commented 9 years ago

@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.

artur-shaik commented 9 years ago

thanks, will keep it on mind.

wsdjeg commented 8 years ago

The simple refactor function i have add into my vimrc,do you want to add these to the JC2 plugin?

wsdjeg commented 8 years ago

@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?

artur-shaik commented 8 years ago

I think you can investigate on any of this, share your thoughts, or ask anything you need.

adelarsq commented 8 years ago

@artur-shaik by the way, debugging support is on the plans? :sparkles::yum::sparkles:

artur-shaik commented 8 years ago

@adelarsq have not think about it yet. As usual need more investigation :relaxed:

adelarsq commented 8 years ago

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.

wsdjeg commented 8 years ago

now I am using https://github.com/wsdjeg/JavaUnit.vim for java test

adelarsq commented 8 years ago

Yeap. Also I use JavaUnit.vim for Java and vim-test for others languages.

artur-shaik commented 8 years ago

Setters, getters generation demo: output

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?

wsdjeg commented 8 years ago

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;
}
wsdjeg commented 8 years ago

and I like Accessors buffer.it is much better than use input()

artur-shaik commented 8 years ago

@wsdjeg yeah, to use templates would be nice. And I think static and final should be considered.

DonnieWest commented 8 years ago

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!

artur-shaik commented 8 years ago

@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?

DonnieWest commented 7 years ago

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.

artur-shaik commented 7 years ago

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.

artur-shaik commented 2 years ago

Consider switch to jc.nvim