How do I reindent all my codes in Eclipse? - eclipse

In most of the IDEs, I had a Reindent All command. How do I do that in Eclipse 1.2?
Edit: The commands work with Java codes but is there a way I can get it to work with Clojure?

Ctrl+Shift+F
will format all your code according to active formatting rules, this includes any indentation rules you defined (tabs/spaces, amount of those, etc...)
You can change those rules at:
Window > Preferences
Java > Code Style > Formatter

Is CRTL+SHIFT+F working in eclipse 1.2 ?
In 3.5 is working fine.
You can also select all the code you want to indent, and then hit CTRL + I

Eclipse is up to version 3.5 now. You might want to upgrade.
To format your code however you like, including indentation and a dozen other minute details that you might care about, you can set Formatter options (under Preferences / Java / Code Style / Formatter). You can also tell Eclipse to run the Formatter on every save, along with other rules.

TAB and SHIFT+TAB should also work for selected lines of code/text - provided your tab character is configured to be equal to your indent space count.

Related

Eclipse indents new line with tabs instead of spaces

I've followed all the suggestions here.
When I press return, I get a new line that is indented with tabs instead of spaces.
If I backspace to clear the tabs, and then press TAB a series of times, it correctly indents with spaces.
I'm pretty sure I have all my settings set up correctly. I created a new Code Style > Formatter policy for every language in the project, and specified to always use spaces. It seems as though these settings are partially active (ex: when I press tab), but inactive when I use return. I tried restarting Eclipse. I'll try restarting the computer now...
I'm using Mac OS X 10.9.2 and a Liferay Developer Studio (1.6.3.v201312111844) version of Eclipse (not sure which Eclipse build its based on though).
Can anyone think of another setting/solution to ensure that newlines are created with spaces instead of tabs? I recently saw http://editorconfig.org/, and I'm wondering if there's some interference.
Thanks for any suggestions
If the file has existing lines that are using tabs, then Enter will respect that and try to create new lines in a similar way (see this comment by topchef for a solution). Also, it could be something in Liferay Studio's proprietary settings is overriding Eclipse standard preferences (as suggested by user John).
Keep in mind that each type of editor in Eclipse can have its own preferences and perhaps that's what you're running into here. You can try to find them all by opening Preferences and searching for "indent" in the search field. That will show all the preferences pages where indentation can be configured.
Also note that the Formatter settings don't have any affect on as-you-type formatting; that's for when you select a file or group of files or part of a file and choose Source > Format from the menu.

Spellchecking doesn't work in eclipse with Texlipse

I have installed eclipse Kepler with Texlipse. However, the spellchecking doesn't seem to work. It doesn't mark any words.
I have already:
enabled spellchecking both in the general and the texlipse preferences
downloaded the dictionaries from http://sourceforge.net/projects/texlipse/files/dictionaries/ and set their directory as the directory for both main and user dictionaries in the Texlipse-preferences
copied the wordlists from the eclipse installation and changed the extension to ".dic" and ".dict"
restarted eclipse several times
I am also unable to find an option to start a spellcheck for the whole document, like there usually is.
I had similar problems with the TeXlipse spellchecker. To fix it I followed the instructions from https://stackoverflow.com/a/5736974/2920749
Additionally, I set the language code to en in the project settings as described here: https://stackoverflow.com/a/7064110/2920749.
However, spellchecking still did not work for me under Ubuntu 12.04.
I had to switch to a monospaced font to get it working.
Also make sure that the dictionaries are uncompressed.
Check that all dictionary files are readable and that you have write access to the user-defined dictionary.
The one thing that did the trick for me was, after having done the same as you did, to go to
Project > Properties > Latex Project Properties
and set the language setting (last entry on the right) to `en' (or whatever language you need).
The interesting thing is that in my case everything worked fine until one day, and suddenly, the project stopped doing the spelling, until I set this value, which turned it on again. I am quite sure that I did not remove this property in the last few days unless there is a secrete short-cut that I mistakenly pressed. So, very weird.
I had a similar problem. I was using Inconsolata font (that I find awesome) and spell check didn't underline wrong words. I then changed font to Dejavu Sans Mono and the underline appeared.
For me changing the font worked, but I found another solution changing the markup type in Window > Preferences > General > Editors > Text Editors > Annotations > Spelling errors
There, you can check the Text as checkbox, select a different option (e.g. highlighted) and click apply to see the changes.
For some reason, in my case, some options are not displaying and some others yes.

Eclipse Code Formatting

I have switched my development environment from Adobe DreamWeaver to Eclipse, and I had one question regarding the Eclipse environment. Whenever I copy and paste sections of code from one area of a script to another, often times the indenting isn't consistent with the surrounding code.
Is there a way I can indent/outdent large sections of code instead of having to manually correct them on a line-by-line basis?
Thank you for your time.
To indent or outdent a section of code, you can select the entire section and then press tab or shift-tab.
I do Java development in Eclipse and to format code I select it and press Ctrl + Shift + F. It is also available from Menu -> Source -> Format.
Note that I am working with Eclipse 3.5.1, but I dont think this key combination will change for other versions.

Turning on Word Wrap for the Eclipse XQuery Plugin

How Can I Turn on Word Wrap for the Eclipse XQuery Plugin?
It does not seem to be in the window preferences section.
We Are currently working also on the code formatter. Therefore wrapping is not currently supported in the XQDT editor. I also don't see a workaround for it either. But I took a note about this. Follow us on twitter #XQDT too see when we come up with something new. The formatter will also com but not in the very near future.
It is in the Window Preferences section even without the plugin. Try going to
Window > Preferences > Java > Code Style > Formatter
create a new eclipse profile then set the maximum line width to whatever you want under the 'line wrapping' tab. apply the feature and click 'Ok'.

Indentation guide for the eclipse editor

Is there a setting or plugin for eclipse that can show indentation guides in the editor? Something like the Codekana plugin for visual studio (not so fancy is also OK). Important that it works with PyDev.
EditBox since v0.0.20 is fixed for support Pydev. Thanks for reporting this. Some default preferences for Python included now, but you are welcomed to share yours here.
This can be achieved this is EditBox.
With some customization through it's preferences you can get to some nice code blocks highlighting of python code (or any other where blocks are signified with whitespace).
It is highly customizable and can achieve the vertical rules codekana style, and various other layouts.
The problem is it doesn't work on PyDev editor from what I see (at least for now). I've opened a feature request for it.
If it's any good, you can still view it's layout when opening a python file with right click "Open With/Text editor". From version 0.20, EditBox fully supports PyDev.
I also tried AnyEdit which has some whitespace highlighting amongst other features, but was not too happy with the results. For example, I had to press they're "show whitespace" button after each change to show the background, and it's not very visually pleasing (it uses eclipse's annotations to highlight whitespace).
IndentGuide is a plugin that does this for Eclipse. I am not sure whether it works for PyDev though.
The closest approximation would be to combine:
showing the whitespace characters (which shows tabs and spaces, but not just tabs)
code folding (available with PyDev)