4
4
5
5
namespace JetBrains . ReSharper . Koans . Navigation
6
6
{
7
- // Navigate To menu
7
+ // 移動メニュー ( Navigate to) を使ってみます。 - Menu on Type
8
8
//
9
- // Displays a contextual menu of options you can use to navigate to from
10
- // your current location
9
+ // 現在の場所から移動する便利な方法です。
10
+ // 基本的な仕組みは 基本編 4.1-Navigate_To_menu.cs を参照してください。
11
11
//
12
- // Very useful way of navigating without having to learn ALL of the shortcuts!
12
+ // Navigate to の操作方法
13
+ // <shortcut id="Navigate to">Alt+` (ReSharper VisualStudio Keymap)</shortcut>
14
+ // <shortcut id="Navigate to">Ctrl+Shift+G (Rider Default IntelliJ Keymap)</shortcut>
13
15
//
14
- // <shortcut id="Navigate To...">Alt+`</shortcut>
16
+ // 対象の上にキャレットを置き、実行してみましょう。
15
17
//
16
18
17
-
18
- // 1. When the caret is on a type definition (DerivedClass)
19
- // (Find Usages, related files covered later)
20
- // a) Go to Base Symbols + Derived Symbols
21
- // b) Extension methods
22
- // c) Object Browser, Windows Explorer, Command Prompt
23
- // d) Locate in Solution Explorer
24
- // d) Referenced Code finds all code referenced by the type, e.g. BaseClass
25
- public class DerivedClass // <- Text caret on DerivedClass
19
+ // 1. 型定義 (継承クラス) にキャレットがある場合、以下のような候補が表示されます。
20
+ // それぞれ試してみましょう。
21
+ // - Declaration : 宣言に移動します
22
+ // - Implementation : 実装に移動します
23
+ // - Base Symbols : 基底クラスに移動します
24
+ // - Find Usages of Symbol : (*1)
25
+ // - Related Files... : (*1)
26
+ // - Usages of Symbol : (*1)
27
+ // - Derived Symbols : 派生クラスに移動します
28
+ // - Extension methods : 拡張メソッドに移動します
29
+ // - Consuming APIs : 自身をパラメーターで受け取る箇所に移動します
30
+ // - Exposing APIs : 自身を戻り値として返す箇所に移動します
31
+ // - Referenced Code : 型が参照されるすべてのコードを見つけます (例: BaseClass)。
32
+ // - Locate in Solution Explorer : (Only ReSharper) Solution Explorer で現在のファイルに移動します
33
+ //
34
+ // (*1) Find Usages of Symbol, Usages of Symbol, Related files は後の演習で詳細に説明します。
35
+ public class DerivedClass // <- DerivedClass を選択してキャレットを置き、試してみてください
26
36
: BaseClass
27
37
{
28
38
}
29
39
30
40
31
- // 2. When the caret is on a base class (BaseClass)
32
- // a) As above (find usages, base symbols, etc.)
33
- // b) Declaration navigates to the declaration of BaseClass
34
- // c) Implementation navigates to the implementations of BaseClass - deriving symbols
35
- // d) Overriding members highlights all members that override from BaseClass
36
- // Escape clears the highlight
41
+ // 2. 型定義 (基底クラス) にキャレットがある場合も同様の候補が表示されます。
42
+ // このクラスの場合、 override したメソッド定義があるので、
43
+ // ReSharper や Rider は正しく認識して候補に表示します。
44
+ // - Overriding members : 全ての override されているメソッドをハイライト表示します
45
+ // Escape を押すとハイライトはクリアされます
46
+ //
47
+ // (参考) 候補間の移動方法
48
+ //
49
+ // TODO: Rider のショートカットはデフォルトで未定義(設定なし)であり、独自に設定しなければ動作しない
50
+ // [Settings] > [Keymap] > [Main Manu] > [Edit] > [Find Usages]
51
+ // - Next Highlited Usage
52
+ // - Previous Highlited Usage
53
+ //
54
+ // <shortcut id="Go to Next/Previous">Ctrl+Alt+PageUp/Ctrl+Alt+PageDown (ReSharper VisualStudio Keymap)</shortcut>
55
+ // <shortcut id="Find Next/Previous"> F3 / Shift+F3 (Rider Default IntelliJ Keymap)</shortcut>
37
56
//
38
- // <shortcut id="Find Next / Move to Next Occurrence">Ctrl+Alt+PgUp/Ctrl+Alt+PgDown (VS)</shortcut> to navigate between
57
+ // (ReSharper) https://www.jetbrains.com/help/resharper/Navigation_and_Search__Navigate_from_Here__Overriding_Members.html
58
+ // (Rider) https://www.jetbrains.com/help/rider/Navigation_and_Search__Navigate_from_Here__Overriding_Members.html
39
59
//
40
60
public class DerivedClass2
41
- : BaseClass // <- Text caret on BaseClass
61
+ : BaseClass // <- BaseClass を選択してキャレットを置き、試してみてください
42
62
{
43
63
public override void VirtualMethod ( )
44
64
{
@@ -51,14 +71,26 @@ public override string VirtualProperty
51
71
}
52
72
53
73
54
- // 3. When the caret is on an implemented interface (ISimpleInterface)
55
- // a) as above (find usages, base symbols, declarations, implementations, etc.)
56
- // b) Implementing Members highlights all members of the interface
57
- // Escape clears the highlight
58
- // <shortcut id="Find Next / Move to Next Occurrence">Ctrl+Alt+PgUp/Ctrl+Alt+PgDown (VS)</shortcut> to navigate between
74
+ // 3. 実装時のインターフェース型 (ここでは ISimpleInterface ) にキャレットがある場合も同様の候補が表示されます。
75
+ // ReSharper や Rider は Interface であることを正しく認識して候補に表示します。
76
+ // - Implementing Members : Interface で定義されている全てのメンバーをハイライト表示します
77
+ // Escape を押すとハイライトはクリアされます
78
+ //
79
+ // (参考) 候補間の移動方法
80
+ //
81
+ // TODO: Rider のショートカットはデフォルトで未定義(設定なし)であり、独自に設定しなければ動作しない
82
+ // [Settings] > [Keymap] > [Main Manu] > [Edit] > [Find Usages]
83
+ // - Next Highlited Usage
84
+ // - Previous Highlited Usage
85
+ //
86
+ // <shortcut id="Go to Next/Previous">Ctrl+Alt+PageUp/Ctrl+Alt+PageDown (ReSharper VisualStudio Keymap)</shortcut>
87
+ // <shortcut id="Find Next/Previous"> F3 / Shift+F3 (Rider Default IntelliJ Keymap)</shortcut>
88
+ //
89
+ // (ReSharper) https://www.jetbrains.com/help/resharper/Navigation_and_Search__Navigate_from_Here__Overriding_Members.html
90
+ // (Rider) https://www.jetbrains.com/help/rider/Navigation_and_Search__Navigate_from_Here__Overriding_Members.html
59
91
//
60
92
public class SimpleClass
61
- : ISimpleInterface // <- Text caret on ISimpleInterface
93
+ : ISimpleInterface // <- ISimpleInterface を選択してキャレットを置き、試してみてください
62
94
{
63
95
public void SayHello ( )
64
96
{
@@ -72,13 +104,15 @@ public void SayGoodbye()
72
104
}
73
105
74
106
75
- // 4. When the caret is on an implementing interface defined in another assembly
76
- // a) Doing Go To Derived Symbols on IComponent will only show SimpleComponent
77
- // b) Navigate to Declaration of IComponent and then doing Go To Derived Symbols
78
- // widens the scope, and includes all referenced assemblies, showing many more
79
- // derived types
107
+ // 4. 他のアセンブリで定義された実装インターフェース (ここでは IComponent)
108
+ // にキャレットがある場合も同様の候補が表示されます。
109
+ // ここでのポイントは、
110
+ // - Derived Symbols で派生クラスを探すとこのSolutionに関係したものだけがフィルターして表示されます
111
+ // - Declaration で宣言に移動した後で、 IComponent に対して Derived Symbols を実行すると、
112
+ // 全ての参照アセンブリを含み、もっと多くの派生型を探すことが出来ます。
113
+ //
80
114
public class SimpleComponent
81
- : System . ComponentModel . IComponent // <- Text caret on IComponent
115
+ : System . ComponentModel . IComponent // <- IComponent を選択してキャレットを置き、試してみてください
82
116
{
83
117
#region Implementation details
84
118
@@ -92,4 +126,4 @@ public void Dispose()
92
126
93
127
#endregion
94
128
}
95
- }
129
+ }
0 commit comments