Visual Studio Mac Auto Format

Posted on  by 



Auto format visual studio code mac

My last few articles have focused on using Visual Studio Code to build a series of scripts to help manage Analysis Services data models. As part of this work, I’ve found Visual Studio Code to be extremely helpful in other ways too, such as a very powerful text editor with many features you may find in other advanced text editing tools. So much so, I now use Visual Studio Code as the primary tool I use when working with text files – regardless if any code is involved.

Visual Studio Mac Auto FormatVisual studio mac auto formatting
  • Visual Studio supports auto formatting of the code with the CTRL+E,D or CTRL+E,F key shortcuts but with this extension the command 'Format Document' is executed on Save. Note: I highly recommend you to use EditorConfig. Just create.editorconfig file and install a plugin for your code editor. Here is one for Visual Studio.
  • Use the Visual Studio debugger to quickly find and fix bugs across languages. The Visual Studio for Mac debugger lets you step inside your code by setting Breakpoints, Step Over statements, Step Into and Out of functions, and inspect the current state of the code stack through powerful visualizations.

Building apps with Xamarin.Mac is a great way to build powerful apps for macOS that harness the power of C#. In this blog post, we created a basic Pomodoro timer application for macOS. If you want to learn more about Xamarin.Mac, check out the Xamarin.Mac documentation and get involved in discussions on the forum!

One task in particular I find helpful is to auto format JSON text to either make it more readable, or to identify issues with the structure of the JSON itself – such as missing brackets etc.

Visual Studio Mac Auto Format Free

Here is a simple example showing how you can create an empty file and paste in some JSON text. Depending on the JSON, the file will auto detect you are working with JSON data, or you need to set the language using the status bar in the bottom right-hand corner.

The animation also shows how you can use the tool to help you fix issues to do with how well-formed the the JSON code is.

The key-map to auto-format the selected JSON is ALT-SHIFT-F.

Visual Studio Mac Auto Format

Visual Studio Mac Auto Format Download

This is the same key-map to auto-format other languages too, so I often find myself doing CTRL-A (for select all text) followed by ALT-SHIFT-F to fix my messy C# code after a series of cut and paste operations.

Visual studio for mac tutorial

Another Visual Studio Code tip

If you find you enjoy using Visual Studio Code to work with text documents, I recommend you ensure the following settings are enabled when you install (or re-install) Visual Studio Code. Once you enabled these check-boxes, you get the option to “Open in Code” when right-clicking a file or folder in Windows Explorer. Essential stuff!

Article Rating




Coments are closed