How do I turn off auto formatting for Visual Studio Mac? - formatting

I'm coding in C# using Visual Studio 2022 for Mac.
I would like to turn off auto indent, words suggestions when I'm typing, and also the auto-placement of the closing "}" (it adds a space before it for some
reason).
I went into "Preferences" -> "Text Editor" and unchecked everything.
I also went into "Preferences" -> "Behaviour" and unchecked everything except for:
Generate additional undo steps for formatting.
Enable source analysis of open files.

Related

Where is the option in Visual Studio 2019 to have Ctrl-K Ctrl-D not make stylistic changes to VB.NET code?

When I press Ctrl-K Ctrl-D, Visual Studio formats my VB.NET code, same as it does with C#, but it also makes some other changes that I'd like to disable because they are making it hard to see actual changes in source control. For instance, it adds parentheses after method calls:
connection.Close
becomes
connection.Close()
and spaces are added around operators:
"answer is "&42
becomes
"answer is " & 42
There's got to be some option to disable these changes but I'm having trouble finding it...
In Visual Studio, the code of VB.net is automatically formatted by default. If you want to cancel the automatic formatting, taking Visual Studio 2017 as an example, you can change the settings as follows.
If you write code after that, the code will not be automatically formatted.
As for Ctrl-K Ctrl-D, you can disable them in the following steps:

How to google from the context menu of the Visual Studio 2015 code editor

how can I modify Visual Studio 2015 to be able to search the internet (my fav search engine happens to be google) from the context menu in the code editor?
Ideally, I would like it to open as a new tab in my (default) external browser, because the internal web browser is still...lacking, shall we say?
I found one extension "web search" for older VS, but I have found no extension that works with VS 2015. I found no article that still works.
For comparison, when you're in Chrome, you can select some text, right click and say Search Google for 'what you selected'.
I think this would be handy when learning new technologies from a project that uses those technologies, or just for help.
Ok this turned out to be fairly easy. I just added a tool to Tools, External Tools
Command: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Arguments: https://www.google.com/?gws_rd=ssl#newwindow=1&safe=active&q=%22$(CurText)%22
I enclosed the $(CurText) variable around quotes (%22) so that it would search on the exact phrase.
Then, to make it more accessible and actually put it in the context menu (and other places), I clicked the Move Up button to make it the first command, then customized the Standard toolbar to include Tools.External Command 1. I also added it to Other Context Menus | Html Context and Editor Context Menus | Code Window
Then I also went into Tools, Options, Keyboard and associated Tools.ExternalCommand1 with Alt+G
IMPORTANT: Because Visual Studio (still, in 2015) doesn't save some modifications to the IDE until it shuts down, you need to shut down all other instances of VS and then lastly shut down the instance that you used to enact these IDE modifications for them to "stick". And, if VS 2015 is like previous versions, be prepared for the menu / toolbar modifications to simply go away one day, at which point you'll just have to redo them.

No xaml color formatting in visual studio 2012

This is the second time i have installed VS 2012 and the first time the color formatting for xaml was working but not anymore. If i can change some element in the tools -> fonts and colors but i cant get the normal default scheme back with the blue | red | yellow look, even if i change back to defaults.
Any help would be nice. Thanks
I've had this exact same issue. The solution is:
close all running instances of Visual Studio
open a "Run" window and type in devenv /resetuserdata
That's it. Open your projects again and everything should work fine.
Beware: your personal settings will be lost. Recently opened projects list also.
Right click on the .xaml file -> open with option from the list choose HTML Editor With Encoding
You can try Tools -> Options -> Environment -> Fonts & Colors and Display Items as Use Defaults..as suggested by gerdi...Also make sure all options are ticked Under Tools -> Options -> TextEditor -> General...

Disabling Intellisense Auto Line Return [duplicate]

When editing C# code in Visual Studio 2010, the ENTER key makes IntelliSense complete the current suggestion, without adding a new line.
In VB.NET, the default IntelliSense behavior for the ENTER key is to add a new line after completing the current suggestion.
How can I configure IntelliSense to change the VB.NET behavior to the C# one?
I already know that I could press TAB or SPACE, but out of habit I always end up hitting ENTER (and changing line).
UPDATE VISUAL STUDIO 2017:
Now with Visual Studio 2017 you can change it. Tools -> Options -> Text Editor -> Basic -> IntelliSense.
In Enter key behavior select Never add new line on enter
ANSWER FOR VISUAL STUDIO 2015 AND PREVIOUS:
If you want to avoid inserting new line on enter with autocomplete suggestion, just don't press enter. Instead of Enter press Space bar which completes your autofill and just inserts a space.
Or you may use this third party app:
Resharper makes it possible overriding Visual Studio intellisense and using its own intellisense. It is the only way I've found.
It has a 30 days free trial if you want to test it.
Unfortunately the set of trigger keys for intellisense completion is not a configurable item for VB.Net. There is no way in the default Visual Studio environment to change this behavior.
It would be possible to develop a plugin of sorts to accomplish this. However that's a pretty extreme measure.
EDIT
As of Visual Studio 2017, it is now possible to change this. See the answer below

Turn Off Visual Studio/VB.Net Lines around each method

In Visual Studio when working in VB.Net, it automatically creates lines/regions around methods etc.
How can this be turned off somewhere in the options?
If you open Tools ==> Options, and select Text Editor, there is a "Basic" section for Visual Basic. This option is on the "VB Specific" sub-section. Unselect "Show procedure line separators".
Using Visual Studio 2017 and above
For C# and Basic
Open Tools > Options or press Alt + T + O
At the top of the list search for "Show procedure line separators"
select Advanced
In group box Outlining
Uncheck "Show procedure line separators"
This is known as "Outlining Mode" and can be disabled by doing the following
Tools -> Options -> Text Editor
Navigate to the Basic -> VB Specific sub category
Uncheck "Enable outlining mode"
For anyone that comes across this and is using Visual Studio 2012. Those lines are off by default. If you want the lines back then you need to:
Tools -> Options -> Text Editor
Navigate to the Basic -> VB Specific sub category
Uncheck "Enable outlining mode"
Yes, these are the same steps that JaredPar explained to turn the lines off. However, it's completely backwards in 2012 and unchecking this option will bring the lines back.
Way to go Microsoft!
The menu sequence is a bit different for VS2015.
Tools -> Options -> Text Editor -> Basic -> Advanced
Uncheck "Show procedure line separators."