If I type if (true) Enter
the cursor will be indented like
and if I continue with { Enter }, I will get a brace layout like
Why?
I expect the braces to be like
In resharpers Braces layout section I have setup braces layout to be At next line (BSD style).
In visual studios options, going into Text Editor, C#, Code Style, Formatting, Indentation I have the checkbox Indent open and close braces checkbox unchecked.
How is it possible with two separate options sections for code style, both Visual Studio and Resharper? Who wins?
I think the solution is to:
go to Visual Studio Options -> Text Editor -> All Languages -> Tabs and set Indenting to Block, then
go to ReSharper Options -> Environment -> Editor -> Editor Behavior and make sure Smart Indent on Enter is unchecked.
Related
Is there a way, either built-in or by third-party extension, to disable triple-click from selecting the entire line while in a text editor? Either my mouse is too sensitive, or I'm inadvertently doing it, but more often than not, clicking a word, then copy / pasting it results in pasting of the entire line -- not my intention and very annoying. Ideally, it could be disabled (aka any click more than 1 just selects the word the cursor is over)
As already stated in the comments the problem is most likely that the word highlighting color is so similar to the color of selected text. So seems like we sometimes deselect a word instead of selecting it. And without a selection Ctrl-C copies the whole line. I had the same issue with JetBrains WebStorm. In Visual Studio for me it was ReSharper.
Changing the color helps. Tools -> Options -> Environment -> Fonts and Colors -> "ReSharper Usage of element under cursor". I made that darker such that selected text is clearly distinguishable.
VS offers highlighting of matching braces, so for an 'If' block when the cursor is placed next to the opening brace VS will highlight both the opening and the closing brace.
Currently, for the default Blue theme, it's light gray for the highlight.
Is there a setting that help in changing the color of the highlight?
Regards.
If I understood you correct this may help you:
Tools -> Options -> Fonts and Colors -> Auto Brace Complete Marker
I just started using Visual Studio 2013. I liked the auto brace completion feature. But in C#, when I press enter after entering {, no extra line to write our code is formed, like in eclipse. Instead the cursor will be at the left side of the }. Did anybody notice that? Is there a way to fix it.
When I press Enter key after putting brace, the editor is like this:
class Example {
|}
(The cursor is where the pipeline character is..)
EDIT:
I just found that in Visual C++ 2013, the braces work as expected.
class Example {
|
}
(The cursor is where the pipeline character is..)
Check within Options on the Text Editor/All Langauges/General page. Select "Automatic brace completion."
By the way in 2013 you can search for words like "brace" at the top of the treeview control in Options to find all the pages were "brace" is found.
Answer taken from here.
Try typing
class
then press Tab.
Same goes for interface, if blocks, etc.
If you want to write a property, type
prop
then press Tab.
You can press Ctrl-Enter and it will reposition the closing brace as you expected. Because Ctrl-Enter makes a new line above the current line.
In Vi / Vim you can move to a bracket and press % and the editor would move the cursor to the matching bracket. This saved large amounts of time when moving around the large files in the editor. Is there a Visual Studio equivalent?
There is a keyboard binding Edit.GotoBrace which will do what you need.
The default binding is CTRL + ], which you can change here:
Tools -> Options -> Environment -> Keyboard
You can press Ctrl + } to move to the matching bracket.
When Visual Studio (2005) has Options -> Text Editor -> C/C++ -> Tabs -> Indenting set to Smart it will automatically indent code blocks and line up squiggly brackets, {}, as expected. However, if you hit enter inside a code block, move the cursor to another line, and then move it back, the inserted tabs are gone and the cursor is positioned all the way to the left. Is there a way to set Visual Studio to keep these tabs?
As far as I know, the only way to do that is to enter something (anything) on that line, then delete it. Or hit space and you'll never see it there until you return to that line.
Once VS determines that you've edited a line of text, it won't automatically modify it for you (at least, not in that way that you've described).
This is an annoyance to myself as well. Anytime the code is reformatted the blank lines are de-tabbed.
You might look at this: http://visualstudiogallery.msdn.microsoft.com/ac4d4d6b-b017-4a42-8f72-55f0ffe850d7 it's not exactly a solution but a step in the right direction