How to left-justify lines of code to the left edge of the window in eclipse - eclipse

I have alot of code that has white space to the left of the lines of code in my eclipse project.
I would like to select pieces of this code and remove the extra white spacing so each line lines up with the left edge of the window.

You can select the code you wish, and press SHIFT+TAB until the code lines up to the edge of the screen.
You could also go to:
Window->Preferences->general->Editors->Text Editors
and when you're there, specify the tab width under:
Displayed Tab Width.
You can also customize Eclipses' formatter:
Go to:
Window->Preferences->Java->Code Style->Formatter
Select the formatter and press Edit. Edit it to your desire.
Then select the text you wish to format and press Ctrl+Shift+F

Related

How to remove vertical lines left by tab spaces in VSCode?

When I use tab space in VSCode it remains a vertical line for each tab as in picture below. How can I remove them?
The Editor > Guides: Indentation setting controls whether or not those lines are rendered. Just uncheck that box and you should stop seeing them.
It's the bottom box in this image
Update based on comments: I don't think the editor can selectively render some indent guides while hiding the rest, all 'TAB SPACES' before text count as indentation to it. If you're only doing this with comments for some visual reason, you can simply start the comment early and put the spaces later like so:
Before:
After:
VS Code has options to hide/show indent guides. Steps to configure are as below.
Open VS Code Settings [ Cmd + Shift + P / Ctrl + Shift + P ]
Search for 'settings' and select Preferences: Open Workspace Settings
Now in settings, search for 'editor>guides'
Uncheck Editor > Guides: Indentation to remove guides.
You can also choose to hide or show Editor › Guides: Highlight Active Indentation

Select lines in Eclipse by clicking in the margin

I'm using Eclipse CDT (Kepler) on Windows.
I'd like to select lines by clicking the mouse in the margins of the editor.
In many Windows editors (Visual Studio, Source Insight, Notepad++, Microsoft Word) if you move the mouse to the left margin of the editor, the mouse pointer (which usually points leftward) points rightward. If you click once, that selects the line; if you click and drag, it selects multiple lines.
Is there a way to configure Eclipse to behave the same way?
I find that in my left margin, the mouse pointer always points to the left. Clicking once has no effect. Click-dragging works only sometimes, which is infuriating.
There are 2 distinct left-margin areas in the Eclipse editors (at least some of the editors, including the Java editor), the overview ruler and the vertical ruler.
Click+drag line selecting has to be done in the vertical ruler area, not the overview ruler.
To select just one line, you can also triple-click anywhere on that line.
Update:
If you have Code Folding enabled, those indicators are shown in the vertical ruler when you hover the pointer over an area that can be folded. Looks like this:

How to show margin of block in Eclipse?

I use notepad++ or extension for Visual Studio and I have seen the line (margin) of the block like the below image.
Can Eclipse do this? Thanks!
You can turn on the "Show whitespace characters" option under General -> Editors -> Text Editors. I find that too distracting.
Eclipse has a different way to control the display of blocks of code.
See the circle with a dash right after the line number 65. You can left click on that circle to close the block.
You can hover your cursor over the circle with the plus sign to see the "hidden" code.
Left clicking on the circle will open the control block again.

Eclipse: Use background color instead of outline for matching bracket

Does anybody know how to set the background color of matching brackets to yellow instead of using a grey outline? I want to do this to be consistent with NetBeans IDE and EditPad Pro.
Go to the Window menu, Preferences option, the select the language you want to change it for in the left column (e.g. C/C++, Java, etc), then choose Editor, and select the top option of the middle frame, change to whatever color you want.
The answers listed ( Window > Preferences > Java > Editor ) are accurate for the question. But if your goal is to find ways to visually see everything inside of braces, here are a couple of more ways you can do this:
Move cursor to the opposite brace: Ctrl-Shift-P moves the cursor to the opposite brace
If you start somewhere in the middle of a section, this will toggle among three points, the beginning brace and the ending brace and where the cursor started. This works for parentheses also.
Highlight the contents of the braces: double click just to the right of the open, or left of the closing brace. The area is highlighted. At this point you can also copy to the clipboard.
I'm using Eclipse Version: 3.4.0 (Ganymede). I went to Window > Preferences > Java > Editor
I changed the 'Matching brackets highlight' to yellow, but it only changed the color of the outline, not the background. It's hard to see just that yellow outline on a white background. Looking at these options though, I don't see how it would be possible to get the highlight you're looking for.
Check the image where you need to change "Selection background color" and "Selection Foreground color" to highlight the background of the selected code.

How to customize icons near the scrollbar in the Eclipse Java editor?

The Eclipse java editor displays small colored rectangle icons just to the right of the scrollbar to indicate lines with //TODOs, deprecated statements, etc. One of the most useful shows the other occurrences of a currently selected variable, but the color of this one is practically the same as the background.
What are these icons called and how can I customize the colors?
Like a lot of things in Eclipse, it's easy, once you know what something is called ;-)
In the Preferences tree, that right strip is the "Overview Ruler". Here's some of my notes:
Display of Task and Bookmarks
Preferences / General / Editors / Text Editors / Annotations
Show in:
Vertical Ruler = left edge icons, in sight of current scroll position
Overview Ruler = right edge colored blocks, relative to overall file
Text as = markup the actual text