I know the built in Codeformatter in Eclipse but there is one problem with it.
I work in a team of 20 developers and all confirmed to a codeformatting I do not like. E.g. the wrap lines after 80 characters or opening braces on the same line, etc.
So what I want is a formatter which formats the code in 2 ways: When I work on a class, I want the formatter to make me happy and when I push it to SVN it should format it so other wont be bothered.
I hope you already have settings done in your machine. If so, then you can always export the preference via File -> EXPORT -> General/Preferences and ask your colleagues to import it.
If not, then try with this...
https://code.google.com/p/google-styleguide/source/browse/trunk/eclipse-java-google-style.xml
Moreover it is not really a good idea to format while checking it into SVN as it might bother the fellow developers who might not feel comfortable when lots of formatting changes for a minor one line bug fix.
Related
I have a code base that many developers work on. Some people blindly use auto format in their IDE and mess up the formatting of sql statements or other things. It appears that some IDE's like eclipse do have the ability to use //#Formatter:off (which I have put around many things I do want to not get formatted), but by default these are ignored. Thus, is there a way to either enable the setting so that will be used by default, or is there a way to disable any shortcut key linked to auto format using some sort of maven plugin? Basically I am looking for a way to enforce this for anyone who is working on the codebase since everyone can change their own formatter settings.
I found https://code.revelc.net/formatter-maven-plugin/format-mojo.html, but I dont think it can do either of those things.
Thanks in advance!
Is there any way to get another editor, like VSCode, to format code ( JavaScript in my case, if it matters ) like the WebStorm IDE formats code by default? I'm not familiar with that IDE, but I'm hoping that it uses a config of some sort that can maybe be exported and imported in another editor. I tried looking for one, but couldn't find anything.
The core problem, if it matters, is that all of our team members use WS to write code and they use the built in formatter, so if I use another one it creates inconsistencies and long commits when editing already written files. As you are probably guessing by now, I would like to use another editor, because I find IDE's bloated and slow.
I don't know if there is a way to import Webstorm formatting rules into VS Code, but I think there is another solution:
I remember in one of the projects i worked on, we used a linter which also auto-formatted code. The advantage is that Webstorm and VSCode can pick pick the linter rules automatically, and then you have same formatting on both.
The downside is that you would need to agree with the team on what does rule will be and then configure them on the linter.
A lot of my co-workers enjoy leaving behind commented out code, how to make Eclipse Formatter to not destroy formatting of that code(now it makes a big blob or block of it).
P.S. I know I can somehow configure the formatter to just ignore that code, I done it once, but I cant remember how.
In the Eclipse Formatter Settings (Preferences/Java/Code Style/Formatter) in the tab Comments UNCHECK the checkbox "Enable Block Comment Formatting" and "Enable Line Comment Formatting" These should be disabled anyway.
One option in 3.6 would be to tell Eclipse not to format these blocks, using /* #formatter:off */
Another option that I use a lot when working in other people's code is to select the lines I'm working on before invoking the formatter - that way I only format the areas I've actually changed, and leave the rest untouched (to get more readable diffs etc.).
For Eclipse 3.7.1, there's a new configuration page (Off/On Tags) in the code format profiles. Make sure you've enabled them. You can also specify the exact comment off and comment on tags.
Just something that will save changes automatically, while i'm editing say in gedit, or notepad plus plus, or even windows text editor, etc.
I can't seem to find exactly what I'm looking for and svn, bzr, and Git are too complicated. One should be able to start a new project, start writing code, and that's it!
So... I'm going to create a whole new version control system that will be more amazing and simple than all the rest! Unless something already exists? Whether it be online, or a local install, whatevs.
EDIT: Ok, the above paragraph was a bit absurd now that I read it much later. I use Git now, and Git is awesome.
Many text editors will create a backup copy of the prior version when you do a save.
Of course, this is pitiful compared to an actual version control system. You should know that many VCS integrate with editors so commits are very simple quick commands.
The minor time it takes to create a repository is insignificant compared to the time it will save you during the project.
Frankly, this sounds like an argument from ignorance.
I found this nice little Gedit plugin: http://nerdblog.pl/2009/06/01/save-and-commit-to-git-plugin-for-gedit-2-26ave/
im just wondering as I couldn't find an answer on google (well, maybe Ive been trying the wrong keywords here >.< )...
A thing I've always dreamt about was a stack/pile cut feature which remembers the - uhm, lets say - 10 last things I've cut out or copied for pasting... Is there such a feature and if so, what is it called?
furthermore - is there a possibility to include your own suggestions for autocompletion? I'm not asking for much, just e.g. a while(true) suggestion instead of or extending the default ones...
Probably this should be migrated to superuser, but Im quite uncertain as this is somehow more programming related...
Thanks ever so much :-)
OK, the first part of the question I could answer myself:
there are templates (Prefs -> Java (or whatever) -> Editor -> Templates) where you can add your custom tags :-) quite fancy this one! (always wanted to type "forever" and get a for(;;) loop)...
so, I did some digging and found that some people refer to that kind of feature as a paste stack...
for windows users clipX will do the trick for general use (as well as in an IDE). for the use in eclipse only the best I could come up with is ViPlugIn which enables a Vim-styled cut, copy & paste feature which gives you some registers where you can store your "pastries" :-)
unfortunately this doesn't come for free (it's 20USD) - will work (AFAIK) without a license but you will be prompted a "missing license" each time you start up eclipse...
The first feature you've meantioned is often called "Multiple Clipboards." I've found two plugins that do the job, but didn't like either. (IIRC neither could interact both ways with the system clipboard.)