dcsimg
December 15, 2019
Hot Topics:

Code Editing Tools in Visual Studio 2019

  • December 3, 2019
  • By Hannes DuPreez
  • Send Email »
  • More Articles »

To write good code, you need proper tools. Tools such as IntelliSense, Code Cleanup, and IntelliCode not only reduce our coding time but also assist us in conforming to most coding standards. Today, I will highlight a few tools that you can use.

IntelliSense

IntelliSense is a code-completion tool that assists us while we are typing our code. It helps us add property and method calls by using only a few keystrokes, it keeps track of the parameters being typed, and helps us learn more about the code we are busy using. IntelliSense is mostly language-specific.

IntelliSense includes the following features:

  • List Members
  • Parameter Info
  • Quick Info
  • Complete Word

Let's have a look at them one by one.

List Members

When a period (.) is pressed, a list of members from a type or namespace appears. The list filters as you type to provide a proper Camel Case selection. We can double-click the suggested item, or press the tab or space button.

You also can invoke this feature by typing Ctrl + J, choosing Edit, IntelliSense, List Members, or by choosing the List Members button on the editor toolbar.

Parameter Info

Parameter Info provides us with information on the number, names, or the types of parameters required by a certain method, template, or an attribute generic type parameter. The bold parameter indicates the next required parameter while we type. In an overloaded function, we can simply use the Up or Down arrow keys to view different parameter information for the function overloads.

Quick Info

Quick Info displays the complete declaration for any identifier in our code. After you select a member from the List Members box, Quick Info appears. You also can invoke Quick Info by choosing Edit, IntelliSense, Quick Info, or by pressing Ctrl + I, Ctrl + K, or by choosing the Quick Info button on the editor toolbar.

IntelliTrace

IntelliTrace is included in Visual Studio Enterprise only. It records and traces the code's execution history by performing the following functions: Recording specific events in code, examining code, Locals Window data, and function call information, debugging difficult-to-find errors, or errors that happen in deployment.

IntelliCode Extension for Visual Studio 2019

The IntelliCode Extension for Visual Studio 2019 enhances your software development efforts with the help of artificial intelligence (AI). It helps developers find issues faster and focus on code reviews. It improves developer productivity with features such as contextual IntelliSense, code formatting, and style rule inference. It combines existing developer workflows with machine-learning to provide an understanding of the code and its context.

IntelliCode is available on the Visual Studio Marketplace.

Code Cleanup

Code Cleanup formats the code and applies any and all code fixes as suggested by its current settings. The Health Inspector can be accessed at the bottom of the Code Window, indicated by a little brush icon, as shown in Figure 1.

Code Cleanup
Figure 1: Code Cleanup

There are two built-in Profiles. One is pre-set, but can be edited. Profile2 is initially empty but can be set and amended at any time. To edit these profiles, we can select Tools, Options, Text Editor, C#.

EditorConfig

EditorConfig helps us maintain a consistent coding style while working with multiple developers on the same project with different editors and IDEs.

Solution Filtering

We can share project-load configuration files by creating a Solution Filter File (with the extension .slnf); you can see this in Figure 2. Use the following steps:

  1. Right-click the solution.
  2. Select Save As Solution Filter.
  3. Choose a name and location.

Solution Filter
Figure 2: Solution Filter

Conclusion

Visual Studio 2019 makes a lot of tedious tasks so much easier and fun to do. These tools that I have talked about help us to code better and faster. To find out about more tools like these, you are welcome to have a read through Visual Studio 2019 In Depth, my new book on the subject.







Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.


Thanks for your registration, follow us on our social networks to keep up-to-date