-
Notifications
You must be signed in to change notification settings - Fork 40
docs: Improve clarity and usability of VS Code Code Navigation tutorial #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f2098cc
e10e0eb
6c8ea7b
4337a71
22b9b32
bb4e6bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,30 +33,45 @@ The Java Projects view gives you an overview of your Java projects and their dep | |
| The Java Projects view should appear at the bottom of the Explorer view by default. If you do not see it, try clicking the `...` (Views and More Actions...) button at the top right in the EXPLORER title bar and select **Projects**. | ||
| </box> | ||
|
|
||
| <box type="tip" seamless> | ||
| If the Java Projects or Outline view does not appear, ensure that: | ||
| - A Java file is currently open | ||
| - The Java Extension Pack is installed from the Extensions Marketplace | ||
| - Your project follows a recognized structure (e.g., `src/main/java`) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per our Markdown coding standard, use |
||
| </box> | ||
|
|
||
|  | ||
|
|
||
| ## Search for Symbols | ||
| Symbol search helps you quickly locate and jump to methods, classes, and variables across your codebase. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave a blank line between a heading and the next paragraph, for better readability. |
||
|
|
||
| You can search for symbols in the current file or workspace to navigate your code more quickly. | ||
|
|
||
| To search for a symbol **in the current workspace**, press `Ctrl+T` and enter the name of the symbol, then select from the list of matches to navigate to its location. | ||
| To search for a symbol **in the current workspace**, press ({{ icon_windows }}/{{ icon_linux}} Ctrl+T | {{ icon_apple }} Cmd+T) and enter the name of the symbol, then select from the list of matches to navigate to its location. | ||
|
|
||
| <box type="info" seamless> | ||
|
|
||
| You can also use **Quick Open** (`Ctrl+P`), then enter `#` to search the current workspace. `Ctrl+T` is simply the shortcut. | ||
| You can also use **Quick Open** ({{ icon_windows }}/{{ icon_linux}} Ctrl+P | {{ icon_apple }} Cmd+P), then enter `#` to search the current workspace. `Ctrl+T` is simply the shortcut. | ||
| </box> | ||
|
|
||
|
|
||
| <video src="https://code.visualstudio.com/assets/docs/java/java-editing/search-in-workspace.mp4" controls width="700px">Your browser does not support the video tag.</video> | ||
|
|
||
| To search for a symbol **in the current file**, **Quick Open** (`Ctrl+P`) and enter `@` before entering the name of the symbol, then select from the list of matches to navigate to its location. | ||
| To search for a symbol **in the current file**, open **Quick Open** ({{ icon_windows }}/{{ icon_linux}} Ctrl+P | {{ icon_apple }} Cmd+P) and enter `@` before the name of the symbol, then select from the list of matches to navigate to its location. | ||
|
|
||
| <video src="https://code.visualstudio.com/assets/docs/java/java-editing/search-in-file.mp4" controls width="700px">Your browser does not support the video tag.</video> | ||
|
|
||
| <box type="tip" seamless> | ||
| You can enhance your use of **Quick Open** ({{ icon_windows }}/{{ icon_linux}} Ctrl+P | {{ icon_apple }} Cmd+P) by using these special prefixes: | ||
| - `@` — Search symbols in the current file | ||
| - `#` — Search symbols in the entire workspace | ||
| - `:` — Go to a specific line number | ||
| </box> | ||
|
|
||
| ## Go to Definition | ||
|
|
||
| You can view or navigate to where a class, method, or variable is defined in your code to understand and trace how different parts of your project are connected. | ||
| You can quickly view or navigate to the definition of a class, method, or variable in your code to understand and trace how different parts of your project are connected. | ||
|
|
||
| To view a symbol's definition without leaving your current location, place your cursor on the symbol and press `Alt+F12`. Alternatively, right-click on the symbol and select **Peek > Peek Definition** from the context menu. | ||
| To view a symbol's definition without leaving your current location, place your cursor on the symbol and press ({{ icon_windows }}/{{ icon_linux}} Alt+F12 | {{ icon_apple }} Option+F12). Alternatively, right-click on the symbol and select **Peek > Peek Definition** from the context menu. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For keys, use either |
||
|
|
||
| To navigate to a symbol's definition, place your cursor on the symbol and press `F12`. Alternatively, right-click on the symbol and select **Go to Definition** from the context menu. If there are multiple definitions, you will be prompted to select the definition that you wish to navigate to. | ||
|
|
||
|
|
@@ -70,7 +85,9 @@ You can trace class implementations and overriding methods by hovering over the | |
|
|
||
| ## Call Hierarchy | ||
|
|
||
| You can view all calls from or to a function to understand the flow of your code and dependencies between functions. | ||
| You can view all calls from or to a function to understand the flow of your code and dependencies between functions. This is useful for understanding how your functions are connected and which parts of the code may affect each other. | ||
|
|
||
|
|
||
|
|
||
| To view the call hierarchy of a function, right-click on the function and select **Peek > Peek Call Hierarchy** to open in an inline panel, or select **Show Call Hierarchy** to open in the sidebar. | ||
|
|
||
|
|
@@ -80,7 +97,8 @@ To view the call hierarchy of a function, right-click on the function and select | |
|
|
||
| ## Type Hierarchy | ||
|
|
||
| You can explore the inheritance relationships between classes and interfaces in your code to understand and navigate complex type hierarchies between Java Objects. | ||
| You can explore the inheritance relationships between classes and interfaces in your code to understand and navigate complex type hierarchies between Java Objects. Use this to visualize how your classes relate through inheritance, especially when working with abstract classes or interfaces. | ||
|
|
||
|
|
||
| To view the call hierarchy of a class or interface, right-click on the class or interface and select **Show Type Hierarchy** to open in the sidebar. | ||
|
|
||
|
|
@@ -102,4 +120,23 @@ You can collapse or expand code blocks to focus on relevant sections of your cod | |
|
|
||
| --- | ||
|
|
||
| **Contributors**: John Wong ([@Johnwz123](https://github.com/Johnwz123)) | ||
| ## Summary of Shortcuts | ||
|
|
||
| The following table summarizes the key keyboard shortcuts introduced in this guide: | ||
|
|
||
| | Feature | Windows/Linux | Mac | | ||
| |-----------------------------|--------------------------|------------------------| | ||
| | Search Symbols (Workspace) | `Ctrl+T` | `Cmd+T` | | ||
| | Search Symbols (File) | `Ctrl+P`, `@` | `Cmd+P`, `@` | | ||
| | Peek Definition | `Alt+F12` | `Option+F12` | | ||
| | Go to Definition | `F12` | `F12` | | ||
| | Go to Super Implementation | Right-click menu | Right-click menu | | ||
| | Call Hierarchy | Right-click > Peek Call Hierarchy | Same | | ||
| | Type Hierarchy | Right-click > Show Type Hierarchy | Same | | ||
| | Toggle Fold | `Ctrl+K Ctrl+L` | `Cmd+K Cmd+L` | | ||
| | Fold Recursively | `Ctrl+K Ctrl+[` | `Cmd+K Cmd+[` | | ||
| | Unfold Recursively | `Ctrl+K Ctrl+]` | `Cmd+K Cmd+]` | | ||
| | Fold All | `Ctrl+K Ctrl+0` | `Cmd+K Cmd+0` | | ||
| | Unfold All | `Ctrl+K Ctrl+J` | `Cmd+K Cmd+J` | | ||
|
|
||
| **Contributors**: John Wong ([@Johnwz123](https://github.com/Johnwz123)), Arshin Sikka ([@arshinsikka](https://github.com/arshinsikka)) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be blank line between a tag and text. Fix in other places too.