Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
strauss_d_getting_started_with_visual_studio_2022_learning_a.pdf
Скачиваний:
123
Добавлен:
26.06.2023
Размер:
17.04 Mб
Скачать

Chapter 1 Getting to Know Visual Studio 2022

Features and Productivity Tips

Visual Studio is full of existing productivity tips that have been around for years and that some developers do not know about. In this section, we will be looking at some of those.

Track Active Item in Solution Explorer

In Visual Studio, this option is not on by default. As you change the code file you are working in, the file isn’t highlighted in the Solution Explorer. You will know this is the case when you see the following arrows in the toolbar of the Solution Explorer as seen in Figure 1-32.

Figure 1-32.  Track Active Item in Solution Explorer

Figure 1-33.  Track Active Item setting

38

Chapter 1 Getting to Know Visual Studio 2022

Clicking these arrows will highlight the file that you are currently editing in the Solution Explorer. I find this extremely useful, so I let Visual Studio permanently track the current file. To set this, click Tools Options Projects and Solutions General, and check Track Active Item in Solution Explorer as seen in Figure 1-33.

Figure 1-34.  Special context menu

With this setting enabled, the arrows are not displayed in the toolbar of the Solution Explorer.

Hidden Editor Context Menu

When you are in a code file, you can access a variety of menu items by right-clicking and selecting the menu items in the context menu. But did you know that you can hold down Alt+` to bring up a special context menu (that is different from right-click)? It has more editor commands in it as seen in Figure 1-34.

This gives you a little more control over navigating through errors, methods, etc., in your current code file.

39

Chapter 1 Getting to Know Visual Studio 2022

Open in File Explorer

Sometimes, you need to quickly get to the actual Visual Studio files of your solution. This might be to go and copy a file from the bin folder or to open a file in another text editor. To do this, you don’t even need to leave Visual Studio. As seen in Figure 1-35, you can right-click the solution and click Open Folder in File Explorer.

Figure 1-35.  Open Folder in File Explorer

This will open a new File Explorer window where your Visual Studio solution is located.

40

Chapter 1 Getting to Know Visual Studio 2022

Finding Keyboard Shortcut Mappings

Sometimes, when you use a keyboard shortcut, and nothing happens, you might be using it in the wrong context. To see what keyboard shortcuts are mapped to, head on over to Tools Options Environment Keyboard as seen in Figure 1-36.

Figure 1-36.  Find keyboard shortcut mappings

Press the shortcut keys, and Visual Studio will show you what the shortcut is currently used for. This is also very useful for assigning new keyboard shortcuts to check that the keyboard shortcut you have in mind is not already bound to another command.

Clipboard History

Visual Studio allows you to access your clipboard history. This is very useful if you have to copy and paste several items repeatedly.

Instead of going back and forth between copy and paste, simply hold down Ctrl+Shift+V to bring up the clipboard history as seen in Figure 1-37.

41