How to show margin of block in Eclipse? - 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.

Related

How can you enable the selection margin in Visual Studio Code (VSCode)

Is there a way to enable the selection margin in Visual Studio Code (VSCode)? By "selection margin" I mean the margin to the left of the text that allows you to select entire lines by clicking and dragging with the mouse.
I'm aware of triple-click. That's not what I'm after. Visual Studio (proper) has a so-called "selection margin", and I was hoping Visual Studio Code would have the same thing but it seems like it may not be there, or I just haven't figured out how to get it.
I also see a breakpoint margin, and the code folding area (or some dead-space if you disable the code folding). But that area doesn't work like a selection margin either.
You must show the line numbers through settings.json file:
// Controls visibility of line numbers
"editor.lineNumbers": true,
Then, when hovering that area, you'll see the inverted mouse to select the entire line, as you wish:

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 left-justify lines of code to the left edge of the window in 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

How can I scroll left and right in Eclipse editor with the keyboard without moving the cursor?

To scroll within the Eclipse editor without moving the cursor up and down one can use CTRL+Down or CTRL+Up. But what about left and right?
It is not possible. If you search keys in Eclipse's Preferences, you will find out that you only have Scroll up and Scroll down that you can set hotkeys on.
My recommendation would be changing the maximum line length in the editor.
Make your code shorter. After all, looooong lines of code are not so readable.
Also, resize your editor area. If you feel strangled, remove the Outline, TaskList, and Build view from your right side of Eclipse, and enlarge the editor.

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.