How to automatically place XAML attributes on next line? - visual-studio

Visual Studio (for Mac) used to place XAML attributes on the next line when auto-formatting, but ever since a recent update (not sure which one), it now places them all on one line when auto-formatting, which is super annoying because I much prefer the previous way. I can't seem to figure out how to change it back. I did not touch any settings at all, and I can't seem to find any settings that will fix this for me.
I have looked at Microsoft's Docs, which shows a setting that looks like it would solve this issue for me:
Position each attribute on a separate line
Each attribute occupies its own line, which is useful when many attributes are present.
XAML
<Button
Height="23"
Name="button1"
Width="75">Hello</Button>
The issue with this is that I cannot find this setting. The page says to go to Tools > Options > Text Editor > XAML > Formatting, but I do not see Options under Tools, which lead me to another page that says to go to Preference > Text Editor > Behavior, but neither this tab nor its child XAML has any settings that would put attributes on the next line.
If anyone knows how to solve this issue, it would be much appreciated. I would prefer a solution that would allow me to customize how the auto-formatting (control + i) works rather than downloading an extension where I need to use a console command.
Thanks!

If anyone stumbles upon this having the same issue, I finally figured it out from poking around some more in the settings.
Go to Preferences > Source Code > Code Formatting > XML document > XML Format and then check the 'Attributes on new line' box.

Go to Tools➝ Options ➝ Text Editor ➝ XAML ➝ Formatting ➝ Spacing.
Then in the "Attribute Spacing" group, choose "Position each attribute on a separate line."
If you want the first attribute to start from the next line, uncheck the "Position first attribute on same line as start tag" checkbox.
Note: this approach is validated on Visual Studio 2019.
For more information, check the official documentation.

Related

Disable HTML element tooltips in Visual Studio

I was wondering if anyone has had any luck disabling the HTML element tooltips in Visual Studio 2015. I find them to be a real annoyance, especially when dragging/ctrl+dragging text around (they get in the way most the time). Here's a screenshot the feature in action (updated):
I Googled and was only able to find the post where the feature was announced, but no mentions of how to disable it. I checked my Visual Studio preferences and have "Auto list members" and "Parameter information" disabled for the HTML text editor.
Any ideas or suggestions?
Update (10/16/2015): I think this issue may be related to the Web Essentials package. I disabled the package and was able to make the tooltip show up, however, I don't currently have a computer with a default Visual Studio 2015 install to test my theory on. I updated the screenshot to reflect the actual tooltip I'm getting (the original one was the screenshot included in the linked blog post).
Try this:
Go to: Tools > Options... > Text Editor > HTML > General
In the 'Statement completion' section you will see an 'Auto list members' checkbox, uncheck it.
However, I'm not sure if the feature above reffers to an in-design html editing or will only affect in specific html development environment (editing an html file for example), so I'll give an additional solution:
Go to: Tools > Options... > Environment > Keayboard
Here, find the command Edit.ToggleCompletionMode and assign the keyboard shortcut that you desire.
Then just use it when you wish to toggle the auto completion of members (including html members I supose).
Update
Sorry If I confussed what you want, because with the absence of auto completion it will remove existance of tooltips but I don't know if you need auto completion suggestions or not.
Anyways, for tooltips you could try doing the same procedure I explained in the images above but with the "Parameter Information" checkbox and/or the corresponding keyboard shortcut, Edit.ParameterInfo. Because seems that html element tooltips are treated as parameter info.
This was annoying the Hell out of me as well & I found that ElektroStudios' solution wasn't suitable in my case. I'm fairly sure that they are VS-native (definitely not Web-Essentials or ReSharper).
For VS2015 at least, the offending tool-tips are located within the file:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Schemas\1033\HTML\html.loc
Deleting the contents of this file has "disabled" the tool-tips for me, although I can't say whether this will be a permanent fix.

How to disable Visual Studio's autocomplete while in comments

Visual Studio seems to have some kind of limited auto-complete that occurs while typing comments. It seems to be listing classes, variables etc just to fill in their name. Here's an image showing it popping up while I type "form".
I find this highly undesirable because comments are not usually code and I'm finding myself typing a common word (like "form") only for it to be replaced with the capitalized version because there's a class with the same name.
How can I disable it only in the comments? I do not want to disable it anywhere else nor make it harder to access elsewhere. Ideally I'd be able to manually open it with CTRL + SPACE or similar (right now that causes a seemingly useless second menu to appear).
Turns out this is being done by the Viasfora extension. It can be disabled from Options > Viasfora > General > Text Editor and set "enable plain-text completion" to be false.

Turn Off XAML error underlining

This is a simple issue, and I hope someone can help
For reasons I don't think I need to explain, my XAML thinks it has some errors in it in the Visual Studio code editor (which shows as wavy blue underlines across most of my XAML).
Does anyone know how to turn this underlining off in Visual Studio 2012 ?
It's incredibly annoying, and makes my XAML hard to read
Thanks
I would suggest setting the editor for .xaml-files manually.
Go into
Tools->Options->Text Editor->File Extension
Write xaml in the Extension field and choose XML (Text) Editor from the Editor drop down and then click Add.
Your XAML files should now open as ordinary XML files, without error underlining.
You will probably loose a lot of the nice to have features of the XAML editor, but as far as I know (I've struggled a bit with this myself) it is the only way.
Found this on MSDN. There is a specific setting to disable this.
Open the Options dialog by selecting Tools > Options, and then select
Text Editor > XAML > Miscellaneous.
Uncheck the Show errors detected
by the XAML designer check box.
Article from MSDN
It is possible to hide the SquiggleShape by making the surrounding adornment layer hidden or collapsed using the Snoop tool.
To achieve this, the Snoop crosshair tool has to be dragged on the editor window with shift and ctrl keys pressed (keep them pressed a while when releasing mouse button). You should end on some Canvas (with the editor window highlighted), and below there is some ViewStack. Inside, there are some AdornmentLayer, one of which contains multiple SquiggleShape. In the properties section on the right side of the Snoop window, scroll to the Visibility row and select the value Hidden or Collapsed. Now, the squiggle lines are not visible any more.
This involves some manual work, but as long as the file stays open, the squiggle lines are hidden. In principle, it should be possible to write an extension which hides the lines automatically. However, at the moment I don't find the time to do this...
The only decent fix for this silly bug that I can find is right click on the xaml and click open with. Select source code editor (without with encoding). Not a great fix when you consider it gets rid of important errors. But it should help you read it better for the most part.
Another Option for this is to change the color of the line under: Tools > Options > Environment > Fonts and Colors. Change it to the same as the background.
It will turn it off in all other editors also though.

Is it possible to hide outline margin in Visual Studio 2012?

In Visual Studio 2012 it's a lot of margins to the left of source code text: Indicator Margin, Selection Margin and Outline Margin. As an old programmer i prefer an uncluttered text, so i want all 3 margins to be hidden from me. In Text editor settings i can hide indicator and selection margins, but i didn't found how to hide an outline margins. Outline graphics (all this "+" things and ines) can be easily hidden from "edit" menu, but margins itself remains. Is it possible to hide it or such feature is not implemented? In previous versions of Visual Studio it auto-hides if "selection margin" was disabled, but now it seems that it don't hide at all :(.
Update
A little clarification why I need it. As correctly mentioned in comments, it's very unusual to have preferences for text formatting and appearance. I agree with that. Unfortunately, in my personal case, I work with text like 10 hours per day for dozens of years and my brain is kind of trained to calculate indentation from text editor left edge. And every time I work in Visual Studio my "wrong indentation" instinct is often triggered by this empty space :). Of course i can re-train myself, but since ALL editors except Visual Studio displays text close to left edge, I will try to configure Visual Studio first.
Turn off the Indicator margin with Tools + Options, Text Editor, General, untick "Indicator margin"
Turn off the Selection margin with Tools + Options, Text Editor, General, untick "Selection margin"
Turn off the Outline bar with Edit + Outlining, Stop Outlining. That is however liable to come back when you open a new file. You can make it consistent for the C# IDE with Tools + Options, Text Editor, C#, Advanced, untick "Enter outlining mode when files open". If you want to do this for other kinds of files as well then you need to write an add-in that listens for the DocumentEventsClass.DocumentOpened event.
I've created an extension for this, it's for VS2015 but if you haven't upgraded yet it should work for VS2012 as well (assuming you're using an edition that supports extensions). The source code is only a few lines and is shown in the screenshot of the posted link.
http://blogs.msdn.com/b/saraford/archive/2007/09/13/did-you-know-you-can-hide-outlining-selection-margin-without-turning-off-outlining.aspx
Tools – Options – Text Editor – General, and uncheck Selection Margin...
This work?
Go to VisualStudio->Tools->Options
Drill down to Text Editor->C#->Advanced and uncheck "Enter outlining mode when files open"
Other language editors have similar options to disable outlining mode.
Any files you have open before changing this setting need to be re-opened, or you can turn off outlining from the context menu for each open file. Easier to just close/re-open.
Hope that helps!
Here's an extension that worked perfectly for me: https://marketplace.visualstudio.com/items?itemName=JustinClareburtMSFT.HotSettings
It has custom options to hide/show:
the entire margin
breakpoint margin
line numbers
selection margin
I can't tell if anyone actually answered your question (which is mine today!). Please see http://www.codeproject.com/Articles/109611/Color-Indicator-for-Code-Changes-Track-Changes-in and particularly the "Enable / Disable" section: "Go to Tools > Options > TextEditor. In General section, you can check or uncheck the 'Track Change' option."
Agree this feature is a big visual hassle during initial development, but it can be helpful during "maintenance" changes.
Corrected per "external link" comment.

Xcode Line Wrapping setting doesn't work

I'm trying to disable line wrap in Xcode 4.3.2 (4E2002), but the setting doesn't seem to work. I seriously HATE line wrapping and it makes me super-unproductive. I've always had it turned off before, but since the latest XCode-update, it is enabled regardless of setting.
Is this an Xcode bug?
This is my settings dialog:
This comes by some files you have set Wrap line in Show the File inspector.
Please choose a file. View -> Utilities -> Show File inspector then deselect Wrap lines in Text Settings section.
I had >ONE< file out of two dozen that was wrapping it's text in the XCode editor. Although I don't know how/why the file got into this state, I figured out what it was and how to fix it.
If you show the XCode right-hand Utilities pane, and select the Document icon at the top left, you'll see a variety of settings relevant to that one file, including it's name, type, and location. Below that are some "Text Settings" values, including a checkbox for "Wrap lines". If that box is checked, it overrides the XCode preference and wraps the lines.
This picture shows the XCode editor areas, in case you are confused: XCode Editor Areas

Resources