Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
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

In there, you will see that we are working with a class called Package that creates a new package we would like to track.

Place your cursor on Package, and hit F12 to jump to the class definition as seen in Figure 1-29. You can also hold down the Ctrl button and hover over the class name. You will notice that Package becomes a link you can click. Lastly, if you have your feet up and you only have your mouse to navigate with (the other hand is holding a cup of coffee), you can right-click and select Go To Definition from the context menu.

Figure 1-29.  Go To Definition

Peek Definition

Where Go To Definition navigates to the particular definition in question, Peek Definition simply displays the definition of the selected element in a pop-up. Place your cursor on Package and right-click. From the context menu, select Peek Definition.

35

Chapter 1 Getting to Know Visual Studio 2022

Figure 1-30.  Peek Definition pop-up

As can be seen in Figure 1-30, the pop-up window displays the code for the Package class. You can navigate through the code displayed in this pop-up as you would any other code window. You can even use Peek Definition or Go To Definition inside

this pop-up.

In the pop-up window, right-click Location, and select Peek Definition from the context menu. The second Peek Definition will start a breadcrumb path as seen in Figure 1-31.

36

Chapter 1 Getting to Know Visual Studio 2022

Figure 1-31.  Breadcrumb path

You can now navigate using the circles and arrows that appear above the Peek Definition pop-up window. The arrows only appear when you hover your mouse over the circles, but this makes it much easier to move between the code windows.

Subword Navigation

Subword navigation is a very nice feature in Visual Studio 2022. Suppose you have a method name called DetermineValueOfFoo that consists of four subwords, namely, Determine, Value, Of, and Foo. Subword navigation allows you to move the caret to the next or previous subword in the string by holding down Ctrl+Alt+Left or

Ctrl+Alt+Right. To select the previous or next subword, hold down Ctrl+Alt+Shift+Left or Ctrl+Alt+Shift+Right. This will select the next subword in the string. You can also turn on Select subword on double click by going to Tools Options Text Editor General and check the Select subword on double click option. Now, when you double-click a string, it will select the current subword you clicked instead of the entire string.

37