How does one change format settings (namely indentation size) in Visual Studio Community on macOS? Answers say to go to Tools > Options but there's no Options option in my Tools menu. If I recall it's somewhere in Preferences > Text Editor but I can't seem to find it.
Found it.
Preferences > Source Code > Code Formatting, choose your language and see Whitespace options in the Text Style tab.
You can use SHIFT + CMD + L to reformat existing files individually.
Related
i am trying to set the tab size to 2 characters in Tools, Options, Text Editor, All languages, Tabs. When i do this, I can see that the tab settings in all other languages change. Also going back into code and forth in to settings i can see that the settings are applied (or didn't desapear).
Now, with the Keys STRG-K, STRG-F all the settings are gone!
What is overriding/overwriting my settings?
Note: I already removed the check of Text Editor, Advanced, Use adaptive formatting. Also i didn't find any .editorconfig file in my project overriding my settings.
Thanks in advance!
Visual Studio 2022
When I opened Visual Studio today, I observed there is a change in the background colour of the tabs, as shown in the picture.
How can I set it to the old/default color? Following Tools->Options, I didn't manage to find anything helpful.
You have the Productivity Power Tools extension installed, which, among other features, allows customizing the colors of tabs. The idea is that you can color tabs based either on the project with which they are associated and/or the language in which the file is written (which is implemented via the file extension).
These tab-coloring features are all part of the general "Custom Document Well" package, which provides a bunch of advanced customization options for the document tabs. If you don't want any of these, but use other features of Productivity Power Tools, then you can turn them off. Go to Tools → Settings → Productivity Power Tools, and then turn "off" Custom Document Well:
If you just want to disable the coloring and return the tabs to their default colors, then go to Tools → Settings → Productivity Power Tools → Custom Document Well, and uncheck both of the "Color tabs" checkboxes:
If you just don't like the default colors and want to change them, then you can do so by going to Tools → Settings → Productivity Power Tools → Custom Document Well → Color Coding:
There are other interesting options, too; be sure to explore! Personally, this is one of my favorite features because it allows me to distinguish between headers, C code, C++ code, assembly code, and resource files at a glance, making it easy to find the one I want to switch to. I can recognize colors a lot faster than I can read names. (The project coloring is less useful to me since I tend to work on only one project at a time, but I can see that being very useful, too, for the same reasons. Humans have evolved to distinguish color very quickly.)
Update: This is not available for Visual Studio 2019; see this Developer Community thread where support was requested by the community and subsequently denied by Microsoft.
Just FYI:
In Productivity Power Tools 2017 instead of Settings → Productivity Power Tools → Custom Document Well you should enable additional extension, that will be installed while Productivity Power Tools installation:
After that you will see tab for setting up colored tabs:
So if you want to disable colored tabs - just disable Custom Document Well extension
Update: This is not available for Visual Studio 2019.
Visual Studio 2022 give this feature out of the box.
Tools -> Options -> Environment -> Tabs and Windows -> Colorize document tabs by Project
As a shortcut you can directly change it from the text editor
Go to Tools -> Options
Click on font and colors in the left hand pane
Now either
you can USE DEFAULTS to reset the settings and try to customise your settings again.
or you can select the item from Show settings for dropdown.. find the tab colour in the one it shows in your dropdown. Change the font background colour
Visual Studio has the nice feature to autoformat your code.
Edit -> Advanced -> Format Document
Or you can use the according shortcut.
I would like to change some of the formatting settings for my language, which is X++ for Dynamics AX.
When I open the options menu (Tools -> Options), I see that there a lot of formatting options for C#, C++, HTML ... but none for X++ (except the usual use tab or whitespace options for intendation).
So my questions are:
What settings is Visual Studio using at the moment when I click
Format Document? It is definitly doing some things with the brace
style and not only changing intendation.
How can I change these settings - or how can I create my own set of formatting rules?
Any input is appreciated.
Is there a way to set TAB button to work as 4 spaces in Visual Studio 2010 instead of going to Edit->Advanced->Untabify Selected Lines?
You can edit this behavior in:
Tools->Options->Text Editor->All Languages->Tabs
Change Tab to use "Insert Spaces" instead of "Keep Tabs".
Note you can also specify this per language if you wish to have different behavior in a specific language.
First set in the following path Tools->Options->Text Editor->All Languages->Tabs
if still didn't work modify as mentioned below
Go to Edit->Advanced->Set Indentation ->Spaces
For VS2010 and above (VS2010 needs a plugin).
If you have checked/set the options of the tab size in Visual Studio but it still won't work. Then check if you have a .editorconfig file in your project! This will override the Visual Studio settings. Edit the tab-size in that file.
This can happen if you install an Angular application in your project with the Angular-Cli.
See MSDN blog
None of these answer were working for me on my macbook pro. So what i had to do was go to:
Preferences -> Source Code -> Code Formatting -> C# source code.
From here I could change my style and spacing tabs etc. This is the only project i have where the lead developer has different formatting than i do. It was a pain in the butt that my IDE would format my code different than theirs.
If you don't see the formatting option, you can do Tools->Import and Export settings to import the missing one.
For Visual Studio 2019 users:
By the comment under accepted answer, link:
Well... This is "almost" still the same in VS 2019... if you already done that and seems not to work, go to: Tools > Options, and then Text Editor > Advanced > Uncheck "Use adaptive formatting" as seen here
Can any one tell me how to turn off automatic outlining in Visual Studio? Outlining is the feature that collapses code into programmer defined regions.
In my opinion, there are precious few circumstances where outlining is useful. Yes, it makes large files easier to navigate, but mostly it obscures complexity. My preference would be to have this feature turned off by default when opening a source file.
In Visual Studio, go to Tools > Options > Text Editor > C# > Advanced
Clear the checkbox Enter outlining mode when files open
Tools -> Options -> Text Editor -> C# -> Advanced -> Outlining.
For VB it's Tools - Options - Text Editor - Basic - VB Specific - Enable outlining mode
For VS2008, it's under Tools – Options – Text Editor – C/C++ - Formatting - Enter outlining mode when files open.
For C/C++ in Visual 2017:
Go to Tools > Options > Text Editor > C/C++ > View
Then under > Outlining, set Enable Outlining to False.