So, let's say I select a closing brace. I want eclipse to not only highlight the matching opening brace, I want it to show me its whole line on the top of my editor, no matter how higher up it is. I'm sure I've seen it on some other IDE, is it possible to do on Eclipse? For example, if it's a closing brace for an if statement, I want to see the opening of this if to see its condition. This could also apply to methods, loops, etc.
If not showing the whole line, I would at least like to highlight the whole line with a color that stands out, so that I can find it easier through scrolling. I know I can jump there with Ctrl+Shift+P, but it's not always practical.
Related
Let's say I have some xml like this:
<foo>
<bar>
Bad indentation here
</bar>
</foo>
You might not be able to tell, but the bad line is indented with tabs (3 of them), whereas the other lines are indented with spaces (3 of them). Frankly, that part doesn't matter -- just understand that the bad line has an inappropriate/inconsistent amount of indentation for this type of code (per my tab-stop settings).
In atom, if I use the move-line feature to move the bad line up and then back down, the indentation gets fixed -- it will change from tabs to the appropriate amount of spaces. (Or if it was already spaces, but just not the right amount per my tabstop settings, then that would have been fixed.)
How can I create a action + key-binding to make VS Code do this too?
In VS Code, extensions provide the necessary per-language logic to do document formatting and for better or worse, VS Code doesn't currently come with an XML formatter extension.
To resolve this:
Make sure the Language Mode (bottom right) is set appropriately (in this case, to XML)
Select the Format Document command from the palette
You should get a popup saying There is no formatter for 'xml-files' installed. (or something else, if you weren't dealing with XML)
Click the "Install Formatter..." button in the popup
Install something near the top with a decent star-rating and a lot of downloads (for XML, the "XML" extension by Red Hat would be a great choice)
Now that you have that, you can go back to your document. Make sure the tab-type and tab-size settings are appropriate. Once you've done that, the standard Move Line Up / Move Line Down commands should reformat indentation as expected.
When I run the command "Expand Selection" with my cursor in a kebab-case-word-like-this, I want it to select the whole word including the dashes, but it breaks at the dash, even though my configured "Editor: Word Separators" (editor.wordSeparators) does not include dash (it's unchanged from the default). Any way to make it select the entire thing on the first expansion? Kebab case is the convention for clojure and this glitch makes it really tedious. It seems that deleteWordLeft and deleteWordRight also don't respect editor.wordSeparators.
I want to use the tab character rather than the set of spaces in every opportunity that presents itself. In Eclipse helios, this was not a problem. Eclipse did not attempt to change anything but the indentation, and that setting was settable. Now, I will go from:
...
(tab)/**
(tab)*(cursor)
...
then I will hit the tab character with my cursor where shown, resulting in:
...
(tab)/**
(tab)*(space)(space)(cursor)
...
Anyone know why this might be and how to prevent it? The single most annoying application of this problem is when I copy a tab character and paste it somewhere else, it shows up as a set of spaces.
Note: I can overcome this via ctrl+f and replace, but that is so annoying to use after the fact. I am looking for something that prevents that from being necessary in the first place
I'm trying to use the multi cursor functionality of vscode on a large(ish) file.
the file is too large to select every line individually with ctrl-alt-up or down. In sublime-text I would select everything and push ctrl-shift-l. Is there a similar thing in vscode. I've tried using a regex search for ^, but that gives me an error stating "Expression matches everything".
The command Selection / Add Cursors to Line Ends altshifti will put a cursor on every line in the current selection. (For mac use optshifti)
Tip: You can pull up the keyboard shortcut reference sheet with ctrlk,ctrls (as in, those two keyboard combos in sequence).
(For mac use cmdk,cmds)
Hold Alt+Shift and select the block. Then press End or Right button.
You get selected individual lines.
I use version VSCode 1.5.3 in Windows.
Hold Alt+Shift+i
Hold Home (fn+-> Mac) for right-most or End for left most(fn+<- Mac)
This feature is actually called split selection into lines in many editors.
Sublime Text uses the default keybinding, CTRLSHIFT L
VSCode uses ALTSHIFTI
For Atom you actually need to edit your keymap to something like this
'.platform-win32 .editor, .platform-linux .editor':
'ctrl-shift-L': 'editor:split-selections-into-lines'
Real Lines vs Display Lines
First we have to understand the difference between Real Lines and Display Lines to completely understand the answer of the question.
When Word Wrap is enabled, each line of text that exceeds the width of the window will display as wrapped. As a result, a single line in the file may be represented by multiple lines on the display.
The easiest way to tell the difference between Real Lines and Display Lines is by looking at the line number in the left margin of the text editor. Lines that begin with a number correspond to the real lines, which may span one or more display lines. Each time a line is wrapped to fit inside the window, it begins without a line number.
Cursor At the Beginning of each Display Lines:
Cursor At the Beginning of each Real Lines:
Answer to the Question
Now that we know the difference between Display Lines and Real Lines, we can now properly answer the actual question.
Hold AltShift and select the text block.
Press Home to put cursor on the beginning of every Display Line.
Press End to put cursor on the end of every Display Line.
Press HomeHome (Home twice) to put cursor on the beginning of every Real Line.
Press EndEnd (End twice) to put cursor on the end of every Real Line.
Please understand that AltShiftI put cursor on the end of every Real Line.
Install the extension Sublime Commands.
[Sublime Commands] Adds commands from Sublime Text to VS Code: Transpose, Expand Selection to Line, Split into Lines, Join Lines.
(Don't forget to add the keybinding(s) from the extensions details page to your keybindings.json)
Doesn't VS Code already have a "split into lines" command?
Yes, yes it does. However it differs from the one in Sublime.
In VS Code, when you split into lines your selection gets deselected and a cursor appears at the end of each line that was selected (except for the last line where the cursor appears at the end of the selection).
In Sublime, when you split into lines a cursor appears at the end of each line (with the same exception as in VS Code) and the selection is divided on each line and "given" to the same line.
I have the same problem, i'm used to Alt + drag to do 'box selections' in visual studio but it does'n work in code.
It seems to be impossible for now to do it differently than by selecting every single line.
However plugins should be supported soon so we will likely see a plugin for this if not implemented directly by microsoft.
From visual studio uservoice forums:
We plan to offer plugin support for Visual Studio Code. Thank you for your interests and look for more details in our blog in the coming weeks. http://blogs.msdn.com/b/vscode.
For the preview we are looking for exactly this type of feedback. Keep it coming.
Sean McBreen – VS Code Team Member
I want to know if there is a way to highlight the full content in an expression like if, while, etc.
I have to work in a code that is bad indented where expressions can cover over 1000 lines and I can't format it.
for exemple :
if ($somethingTrue) {
while ($somethingHappen) {
// 500 lines...
} }
if ($someCondition) {
}
look, it's very hard to see the end of the first if and what it cover...
Does someone know if there is a native feature or plugin on netbeans that do this job ?
Thanks !
You don't need any plugin/external jar file for achieving the same. Whichever expression you want to check the body of, just click on the opening brace after that expression and NetBeans will automatically show you the closing brace for that expression.
Basically, Netbeans shows the ending brace for a corresponding starting brace entry---for each of if-statements,loop-statements,method declarations,etc.
In the shown figure, see my if-statement starting with yellow brace(cursor blinking there), and the corresponding ending brace for the if-statement.
EDIT :-
You also can also have a brand new-code fold,just by typing fcom, and hitting (Tab) button on KeyBoard. And, then put whatever block you want inside it and done. Expand whenever you wish and collapse whenever you want.
Check the position of my mouse-pointer which shows the current block of if-statement. You can expand and collapse as per your wish. And, also you can have several of them for each of your expression-tree.