I just can't find the option anywhere. Is there some way in eclipse to warn about stuff like this? if(a==b)continue; instead of if(a==b){continue;}
Or can maybe the format function fix this?
Window-->Preferences--> Java > Editor > Save Actions-->Additional actions-->Configure-->Code Style--> Use blocks in if/while... here you can configure the style you want.
CheckStyle is a nice tool which can also be used as a plugin for eclipse. You can specify different kinds of coding styles you want to enforce on you / your team, by configuring rules in this tool. This could help you create your custom check.
Related
due to reasons I am working with undocumented java library code that I cannot alter in any way or write into. Im using eclipse 2020-06 and I would like to leaves some notes for myself to make things easier. Is there a way to do that? or maybe an eclipse extension?
You can use bookmarks. They work somewhat similarly to breakpoints, without pausing execution when you're debugging.
You can add them via the context menu.
If I recall, you're a bit limited by the amount of information you can add. It's basically just a single text box.
See the help section on bookmarks
Maybe there's some plugins which extend the functionality (e.g. this one for adding keyboard shortcuts)
I'm looking forward to create a Domain Specific Language editor in java.
I'm just starting up so i'm here to get some ideas where to start.
What i want is to create an interface like for my editor may be like eclipse (IDE) and i want it to work like eclipse but for my language as eclipse do for java.
auto completion, spell checking, highlighting text auto end braces etc.
I've Goggled about the topic and i got this:
XTEXT
"Building your own domain-specific languages has never been so easy.
Just put your grammar in place and you not only get the working parser
and linker but also first class Eclipse support."
As it says first class Eclipse support, i don't want eclipse support but i want a complete new interface for this. can i perform what i want using XTEXT or i should use something else?
Please guide me, do tell me if i'm wrong at some point here.
Thanks alot.
Is it possible to edit the content assistance of Eclipse? Sort of add rules or functions for it? I'm aware that Eclipse is open-sourced, but I was there an "easier way" or an interface?
For example, I'm working in Java 1.4.2, so I don't believe I have the magical "autoboxing"(am I correct in thinking that autoboxing would solve this issue?) . So when I'm working with getting parameters from a request, they all return strings when I may need a Long or an Int. I'm always interested in making things more automated (as any computer scientist usually would), so I was wondering if it was possible to have content assist suggest to use the common java parse functions (Integer.parseInt, Long.parseLong, etc) for the passed in parameters.
If you want to actually augment Content Assist in a highly detailed, customized way, you'd have to write a plugin. Eclipse is very well architected such that there are endless extension points via which plugins can extend base functionality, including Content Assist. But, writing one is not a trivial matter (though a skill that could serve you well, if you have the time to learn it).
Another option is to write your own Java editor template, which can emit any pre-defined snippet of code you want (including inserting parameter values), and will be included in Content Assist. Open Eclipse's Preferences and navigate to Java > Editor > Templates. You can use the ? help button on that Preferences page to learn more about them.
When I try to put final in method parameter eclipse doesn't help. Any idea how to get this to work?
This probably will be as close as you can get to it. It would be a lot of work to do this for every keyword, but since there is only so many of them it's possible. You could probably take it a step further and just write a template for your methods.
Preferences > Java > Editor > Templates
New > Name (alias)
Pattern: "final "
I don't think this is possible.
The closest thing to this is to set a "save action" which will automatically add final modifiers to method parameters when you save the file.
Preferences > Java > Editor > Save Actions
Assuming that you are complaining about the Eclipse Java editor's completion behavior, I don't think there's anything you can do about it.
If it really worries you, create a bug report on the relevant Eclipse component. Better still, create and submit a patch that fixes the problem.
EDIT
I had a trawl through the Eclipse JDT open bugs/issues, and there are various issues related to final in various contexts, though not specifically this one (as far as I can see). It is also worth noting that there are a LOT of open JDT issues ... so an issue with a viable patch is much more likely to receive attention.
Java makes a copy of the parameters, the final parameter in this case doesn't do anything, it doesn't help you access it through an inner/anonymous class. Is there a reason you want it?
Is there something equivalent to OmniCppComplete for java in vim ?
I know of eclim but I think it is overkill for such a simple feature.
See http://www.vim.org/scripts/script.php?script_id=1785
Also found VJDE - http://www.vim.org/scripts/script.php?script_id=1213 - Need to evaluate which one is better/more up-to-date
Seems you have some options for code-completion above.
I would recommend also grabbing a copy of TagList, which provides a sidebar displaying the structure of your current file.
The ctags which TagList uses can also be used for fast navigation in Vim. Ctrl+] over the text "curiousMethod()" should take you to the definition of that method.