Is it possible to do this? I can't find anything in the Options that disables this.
For example, if I type
<table cellpadding=
it automatically inserts "" and positions the cursor between the two quotes. This is not what I prefer to do. I prefer to type without quotes, and then select the text and format it -- it is much quicker. In previous versions of Visual Studio, it did the auto-insert by default, but I was able to disable it. I can't find a way to do it in Visual Studio 2013. Disabling "brace completion" does not work. It's driving me nuts!
Tools -> Options -> Text Editor -> HTML
General -> Automatic brace completion
Advanced -> Insert attribute
value quotes
or/and in HTML (Web Forms)
Formatting -> Insert attribute value quotes when typing
Related
Visual Studio 2013 frequently marks my code with a green _ ( green underscore bar).
What does it represent and is there a feature that it's linked to, like auto complete or intellisense ?
This is the automatic brace completion feature that was introduced in Visual Studio 2013 (although, like so many new features in Visual Studio, it was actually in the Productivity Power Tools extension first).
When you write an opening brace, Visual Studio 2013 inserts a closing brace for you automatically. The underline simply indicates that the code editor is still in brace-complete mode. While in this mode, Visual Studio is waiting to see if you close the brace yourself, in which case it will remove the redundant brace and move the text cursor if necessary. While in this mode, you can also press tab to move the cursor past the closing brace; although, this only seems to work when both braces are on the same line and there is nothing (except whitespace) between the cursor and the closing brace. Moving the cursor outside of the braces exits this mode.
This feature works not only for braces, but also parentheses, square brackets, and quotes (single and double).
You can enable or disable this feature by checking or unchecking the Automatic brace completion checkbox located in:
Tools → Options → Text Editor → All Languages* → General
* or a specific language, e.g. C#
Just go to tools, then options.
You will see the item fonts & Colors there you can choose what you wanna do in such part of your code, such as choosing the type of text and color.
In Visual Studio 2013, under Tools > Options > Text Editor > File Extension, I have set three file extensions, namely .cginc, .compute, and .shader (these are Unity3D shader files) to use Microsoft Visual C++ for auto formatting.
Sometimes auto indent (for curly braces) works, and sometimes it doesn't...I can't find any rhyme or reason for this. When it doesn't work, it starts every new line flush to the left.
I Google around every couple weeks and can't find an answer.
Does anyone know any setting to make auto indent work consistently?
Try this:
Tools -> Options -> Select the language of your choice (Expand the menu) -> Select Formatting (Expand this sub menu) -> Select Indendation
Once you have selected Indentation, on the right are options displayed - Check/Tick the option: Indent Braces.
Note: You may also format the entire document/file using the shortcut Ctrl+K+D
I'm using VS 2010, and I'm getting constantly annoyed when I type "else" and then it auto returns line and adds braces. Something like:
else
{
}
I cannot imagine I'm the only one who often puts one-liners after the else and prefers no braces. How do I stop this from happening?
I also found this behavior very annoying.
My first attempt involved opening the Templates Explorer (ReSharper / Templates Explorer...), selecting C#, then unchecking "else". This did get rid of the braces. Unfortunately, hitting enter after "else" now just added a space! I was having to hit enter twice. Not quite what I was hoping for.
But if you double-click on the else template it opens up an editor where you can specify what happens. I found that simply removing the braces gave me the functionality I desired - hitting enter after an else was now putting me on a new line, tabbed over under the else - without braces.
To recap, to fix this you need to open Resharper's Templates Explorer, select the C# scope, then double-click on the else template and remove the braces. Your template "snippet" should look like this (just two lines):
else
$END$
This works in Resharper 6.1 and Visual Studio 2008. I have no idea about other versions of the software.
Okay, finally figured out what the hell is doing this. I have ReSharper installed on this machine, and apparently the "else" keyword is a ReSharper autocomplete keyword. So even after I turned off the braces completion, ReSharper was still kicking in and adding them. Rage. In order to stop this, you have to turn off the ReSharper autocomplete.
I don't think there's any way to disable brace auto-complete for specific keywords. If you go to:
Tools -> Options -> Text Editor -> C# -> Formatting
you'll find the various formatting options. It's possible to disable auto complete in general or affect indentation and such, but I don't see any way to disable brace auto complete for specific keywords.
Are you using Productivity Power Tools? You can turn it off in Tools, Options, "Productivity Power Tools", "Automatic Brace Completion". (I know I do)
While editing javascript content VisualStudio is starting to bug me with how it keeps inserting highlighted suggestions. For example it keeps inserting valueOf( if I type val(. This is really annoying.
I want to invoke intellisense manually just like I can with C#, is there any way of turning off the auto-complete suggestion or at least preventing it from selecting an entry for me?
In Visual Studio Tools > Options > Text Editor > JScript
In corresponding panel as Statement completion
Uncheck Autolist members & Parameter Information
I think that should do the trick
I realize resharper isn't mentioned in the question, however there is an easy solution if you're using it.
Navigate to Resharper -> Options -> Intellisense -> Completing Character. Once there, add ".val(" to the "Do not complete on" text field beside the JavaScript row.
Like so:
I tried Myra's solution but it didn't solve it completely for me due to ReSharper. Turned out it was the ReSharper intellisense that autocompleted whatever I was writing to the current/top option in the intellisense list, not the VS default intellisense.
I fixed this by turning off ReSharper's JavaScript support completely by going to ReSharper -> Options -> Products & Features -> Uncheck JavaScript and TypeScript.
This might not be a good solution if you depend on any other JavaScript- or TypeScript-related features in ReSharper but I finally got control of the intellisense. Peace, at last...
(Just to be clear, I still have the "Autolist members" and "Parameter Information" options as described in Myra's post above checked/activated, and the "Only use Tab or Enter to commit" option as described in Brett Ryan's comment above also checked/activated)
for me it was also resharper (replacing my .each with .forEach), and what I did is go to
menu
Resharper -> Options
Environment -> IntelliSense -> Autopopup
select JavaScript tab
"After dot" -> select "Display but do not preselect" in the dropdown
As I am copying something from within a method, and pasting it into a word document, the code I am copying is already indented. When I paste it I therefore end up with a load of white space next to each line.
I need to copy without this. In C# I can just unindent my code, hit copy, and then indent it back again using the buttons in the IDE. But Visual Basic automatically forces indentation so any attempts to change it don't work.
Visual Studio supports block selection. Press the alt key and drag the cursor to start block selection.
Visual Studio Select Block Text
This is a very useful feature, specially when pasting code here on SO. Visual Studio 2010 will even support multi-line editing using the box selection.
Unfortunately, it seems VB doesn't support the Edit.Advanced.Tabify/Untabify or Increase / Decrease Indent commands.
Here is what you can do:
Go to Tools -> Options -> Text Editor and uncheck "pretty listing (reformatting) of code"
Select the text block you wish to copy without indentation
Go to Edit -> Advanced and click "Delete Horizontal White Space" (or: Ctrl K, Ctrl )
Copy and paste your code in Word.
Turn the "pretty listing" option back on.
the "Delete Horizontal White Space" command will unindent the entire selected text so that there is no tab/whitespace to the left of any line (unlike Block Selection, as prorposed by João Angelo, which will unindent the selected block but keep any indentation within the block).
You may use the Visual Studio extension Copy for review. Besides some formatting, it removes unnecessary whitespace. It works for Visual Basic, among other languages.
Disclosure: I am the author of that extension. Please notify me, if I can improve it to your needs.