How to change formatting rules for X++ in Visual Studio - visual-studio

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.

Related

Visual Studio Editor Tab settings

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

macOS, Visual Studio Community: How to change indentation/format settings

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.

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

How can we disable VS 2010 Intellisense

My Visual Studio 2010 is too slow most of the time. So I decided to disable the vs2010 Intellisense. Can any one help me?
For C/C++: Tools -> Options -> Text Editor -> C/C++ -> Advanced -> Disable IntelliSense.
Update: This also works with VS2012.
Microsoft doesn’t provide any way to disable Intellisense. This wouldn’t be a problem, except Intellisense can and does crash.
To disable Intellisense, close Visual Studio and navigate to your vcpackages folder:
C:\Program Files\Microsoft Visual Studio 8\VC\vcpackages
Rename the file feacp.dll to something like foulup.dll. Now Visual Studio won’t be able to load Intellisense, but rather than crash it will just quietly drop its features.
or
Also have look to this solutions : how to disable intellisense...
Ctrl + J.
In case you are using ReSharper the way to disable IntelliSense is as following: ReSharper > Options... > Environment > IntelliSense > Autopopup > Enable Automatic IntelliSense Popup > Uncheck > Save > Profit.
This also works in Visual Studio 2012 for C#.
Simplest way I can think of: change the file extension association so that *.cs files open in a plaintext document window, not the C# editor. Repeat for other extensions as desired.
It's actually easy for most languages:
Select Tools/Options on the menu. On the Options dialog box, select Text Editor, then select the language you use, then select "General". Uncheck "Auto list members" and "Parameter completion".
Works on VS 2012, 2010, and others, and seems to be available for most languages including C#, Basic, and C/C++.
Change the file extension to ".txt "
Edit without intellisense.
Change file extension back to what it was.

Turning off automatic outlining in Visual Studio

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.

Resources