Visual Studio Editor Tab settings - visual-studio

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

Related

Export Visual Studio's 'Code Style settings' as .editorconfig

Our team works with Visual Studio 2017 Professional.
I've been trying to unify the Code Style across the team and apparently the industry standard right now is to use .editorconfig files. Even Visual Studio in it's settings windows suggests to use that configuration file and links to a useful page on how to write an editorconfig file.
but I don't want to write all the settings that I already have configured in VS by hand. I would like a tool that exports those settings as a .editorconfig file to distribute them.
I haven't been able to find any tool to do just that so I thought on righting it myself and share it with other people like me. But apparently if go to "Tools -> Import and Export Settings..." you can't download your current Code Style settings.
Is there a way around this?
do you know any tool to convert my settings to an editorconfig file or a way to export my current Code Style settings?
Edit
I have created my own version of the .editorconfig file based on the information found in here
You can find it in my github repo
I realise this isn't much help for VS2017 users, but VS2019 has a button "Generate .editorconfig file from settings" on the Code Style options page:
This options page is available at Tools > Options > Text Editor > [C# or Basic] > Code Style > General.
I know this question is ancient but worth an answer...
The latest Visual Studio extension allows you to do this (Guide here):
Basically install the extension and right click on the solution or project (you can restrict the rules to solution/project or even folder) and click add > new EditorConfig (IntelliCode)
There are still some restrictions about what you can do in the latest releases of Visual Studio, but Visual Studio 2017 15.8 Preview 3 or higher allow you to use a new extended “Format Document” command to perform additional code cleanup for the current document.
It's a shame you can't make all your rules cause build errors, only some of the options allow this - without this, a lot of the styling options can be ignored.

Visual Studio tab header color in the IDE

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 replace tab with 4 spaces?

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

Class names not coloured in Visual Studio 2012

I am evaluating Visual Studio 2012 and am having some problems with the color schema.
Sure enough I was able to overcome the initial discomfort by setting my color for the text editor.
One thing I have not been able to set corrent are the color for the class names.
Say you have a line like below.
Class name = new Class();
the entire line is in the same color, expect the new keyword.
I want the word 'Class' to be in a different color like in earlier versions of Visual Studio.
I am not able to set the color for this from the Option.
I have tried chaning color for all fields like plain text, literals, identifier, etc under
Tool -> Option -> Environment -> Font & Colors
but still I am not able to fix this.
I have also applied custome themes, those are also not helping.
I wouldn't want to install a productivity power tool for such basic preference right ??
Edit:
I'm on Windows 7 x64 and Visual Studio Professional 2012, Version 11.0.50727.1 RTMREL
The solution I found is a combination of the suggestions found in a mish mash of related threads:
Close Visual Studio and open the VS command prompt as an administrator. Navigate to the devenv.exe file (in Express versions it is titled something along the lines of *express.exe) usually located in C://Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE.
Type devenv.exe /setup
Reopen Visual Studio. If everything is all colored now, great! If not, close the tabs and reopen them.
Performing all of step 3 is what has got my coloring to come back to normal.
Here is where I got the suggestions:
Visual Studio 2012 - Intellisense sometimes disappearing / broken
How can I get user type C# syntax highlighting working again in VS 2012 RC?
If you're using Productive Power Tools, go to => Tools -> Options -> Productive Power Tools. In main menu, TURN OFF the option: Colorized Parameter Help.
I solved my problem, I'm on Windows 8 Pro, Visual Studio 2012 Ultimate.
You're on the right track. Under Tools -> Options -> Environment -> Fonts and Colors, you want to change "User Types", first making sure at the top of the dialog that you are viewing the settings for the "Text Editor"
Although, by default with my install of Visual Studio 2012 these were already set, so you may want to try the "Use Defaults" button, unless you've made other changes that you want to keep.
go to the tools >Option click on enviroment navigation and click on import and export setting and copy the url and open directory from the url and delete all font and color file .which you got setting folder
The workaround provided by Donatas on Microsoft Connect works without having to turn off any option of Productivity Power Tools:
There is a workaround without turning off "Colorized Parameter Help".
Go to Tools > Options > Environment > Fonts and Colors in Display
items select "User Types (Value types)" click Custom next to Item
foreground color and in the color picker change Red, Green or Blue by
1, i.e. to make a custom color which basically looks the same. OK on
all the dialogs and problem solved.

How to use different tab settings in different projects in Visual Studio

The Visual Studio options dialog allows you to set tab preferences (size, insert-spaces, etc.) on a per-language basis. But I am regularly working on a couple of c# projects with different settings for these values.
Is there a way to override the global settings on a per-project basis, or at least toggle between them easily?
Another approach may be through the extensibility API: it should be possible to write a macro or add-in that changes these settings.
E.g. to change the tab size to 6, use the following:
DTE.Properties("TextEditor", "CSharp").Item("TabSize").Value = 6
Here's a link that explains how to find out the names of the properties: http://support.microsoft.com/kb/555445
You can open visual studio with a special "reset" settings file which overrides the default settings. Using this method it is possible to create two shortcuts, one with each tab setting. Details are here.
I'm afraid you can't do that on a per-project basis.
But, with Tools/Import and Export Settings... you can export each settings in a file and you could import the one that fits your current project.
Visual studio 2017 adds .editorconfig support, which is very handy for such settings.

Resources