Here:
https://social.msdn.microsoft.com/Forums/de-DE/b77c7529-298f-4b9a-874a-f94f699986ac/automatically-formatting-xaml-code?forum=vswpfdesigner
... it is written that one can use "Ctrl+K+D" ... but that didn't work.
I also tried "shift + alt + F", which was suggested here:
How do you format code in Visual Studio Code (VSCode)
... it didn't work either.
So my question is: how can you automatically format XAML code in Visual Studio?
Probably your formatting options are wrong, go to: Tools -> Options -> Text Editor -> XAML -> Formatting -> Spacing and on Attribute Spacing section click "Position each attribute on a separete line" and then try "Ctrl+K+D" again.
I would check out XAML Styler, which is a Visual Studio extension to help format your XAML source code (full disclosure, I am one of the owners on the project).
Edit: Forgot to mention that Visual Studio does not have a very rich set of XAML formatting capabilities on its own.
Shortcut key for XAML formatting in Visual Studio for Mac machines: Ctrl+I
In case you guys still don't know how...
It's called 'Format Document', you can find it inside menu:
Edit => Advanced => Format Document
There is also shortcut for it:
Ctrl+E then Ctrl+D
This works for most document, including XAML.
EDIT: When this post was made, I was using VS 2017
I use Xaml Formatter. Works pretty good for me. You will just have to assign code formatting with Xaml Formatter to a Ctrl+K Ctrl+D shortcut in Xaml files, since it is not done by default (it's creating Format Xaml option in Tools menu).
Also Inline Color Picker is a very simple but extremely useful extension if you are developing a lot of Xaml code.
Try using "XML Tools" for VS Code, the shortcut is Alt + Shift + F
For anyone who is searching for kind of combining "Insert a single space between attributes" and "Position each attribute on a seperate line" I found this solution:
Tools -> Options -> Text Editor -> XAML -> Formatting -> General -> Tag Wrapping
and tick "Wrap tags that exceed specified length".
Self-explanatory that one can adjust the length in the following input field.
Related
I've just installed Visual Studio 2017 and got strange vertical indentation marks in code editor.
How can I remove them?
P.S. I disabled all extensions but it doesn't help.
There is an option under Tools → Options → Text Editor called Show structure guide lines that should remove that.
In the last version of Visual Studio Code, downloaded in July/2017 (please note that this is not Visual Studio, but as #tambre pointed out, this may help in VS too), the name of this setting changed:
Go to the menu Code->Preference->Settings and search for "renderIndentGuides". The complete setting should appear as:
"editor.renderIndentGuides": true,
Change it to false and that's it.
Just press ctrl+E,S and it will be removed.
The same thing in VS2019 is called Show guides for declaration level constructs in the section of Tools → Options → Block Structure Guides; you might want to uncheck Show guides for code level constructs as well.
A slight update for those using Visual Studio Code, version 1.48.1 (2020-08-19) on Windows 10.
Go to the Settings: Ctrl+, OR File => Preferences => Settings
Search for renderindent
Toggle the settings checkbox for Editor: Render Indent Guides
It's been mentioned in a comment, so I'm just bringing this up as an alternative answer: you can change the color of the vertical dotted lines. They are called "Structure Guide Lines" in the Visual Studio Tools -> Options -> Fonts & Colors dialog. I set mine to { 55, 55, 55} so they are barely visible on the dark-mode background.
Another related setting is "Visible White Space" color, which I set to { 13, 52, 60} after activating the Edit -> Advanced -> View White Space (Ctrl+R, Ctrl+W) option.
Go to Settings->Text editor -> Editor>Guideline:indentation -> uncheck
I have a question about how to enable automatic code tidying property in Visual Studio. I have no idea whether I have used the word correctly or not. What I'm doing is that I'm using Visual Studio in my personal laptop and also on a separate computer. In the laptop when I'm working on writing C++ code when I press "Enter" all the code automatically rearranges so that it looks more elegant and tidy. I did not enable it on purpose; I just like it and I would like to do the same thing on another computer as well. Is there anyone out there who knows how to do this stuff? Thanks.
I believe you're referring to "code formatting" support. Each language (C#, C++, VB, etc.) have their own implementation of this. To trigger it directly, you can find the command in the menus by going to Edit -> Advanced -> Format Document (or Format Selection). There are also keyboard shortcuts that do it, I use CTRL-E, D all the time, but that may be language specific so you should experiment some.
Hope that helps.
You can either Format Selection by using CTRL+K, CTRL+F and you can format the whole document by pressing CTRL+E, D.
You can also do this by going to Edit -> Advanced -> Format Document/Format Selection
For more options about formatting you can go to Tools -> Options -> Text Editor -> C++ -> Formatting
I work with large C# files. I use the Edit > Format Document feature of VS2010 (Keyboard shortcut=> Ctrl+k, Ctrl+d) to format the layout of the code. Sometimes however, I would like to align code in a specific way; for readability.Question: Is it possible to isolate a section of code which I want the VS formatter to ignore?
How about using
Ctrl+k, Ctrl+f
Which is Format Selection
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
I just installed MSVS2010 Ultimate & I've noticed something which is somewhat annoying & conflicting with my syntax highlighting, as can be seen:
alt text http://localhostr.com/files/19038c/capture.png
As can be seen, when a keyword/function/variable/etc is highlighted all other instances of the aforementioned are highlighted too. This is somewhat annoying.
Is there any way to disable this?
This is considered a new feature of Visual Studio 2010.
But a fast trick to disable is following these steps:
Tools -> Options -> Environment -> Font and Colors
Choose the item Highlighted Reference
Set its color equal to the background you are using (i suppose a
really dark gray from your screenshot)
I like this feature but I tuned the color a bit to have it only little more lighter than the background :)
When using Visual Assist, find "VA X Find Reference" in Display Items
(Tools -> Options -> Environment -> Font and Colors)
Looks like it might be Visual Assist X. If you have that installed, disable "Automatically highlight references..." on the Advanced | Refactoring page of the VA Options dialog .
This is a new feature from VS IDE to show you other changes tothis object. but ifyoudo not like it you can easily changed it by pressing
CTRL + ALT + Spacebar
you can read detail in my blog
updtae : thismentioned in VS2010 official Website here
You also can try CTRL+SHIFT+DOWN ARROW or CTRL+SHIFT+UP ARROW. see the VS page