Skip to content

Code Navigation

Scrivener07 edited this page Jun 29, 2019 · 3 revisions

The Papyrus Language extension supports a high productivity editor which gives you the power to navigate source code and files quickly.

Table of Contents

Quick File Navigation

The Explorer is great for navigating between files when you are exploring a project. However, when you are working on a task, you will find yourself quickly jumping between the same set of files. There are two powerful commands to navigate in and across files with easy-to-use key bindings.

Tip: You can open any file by its name when you type Ctrl+P (Quick Open).

Hold Ctrl and press Tab to view a list of all files open in an editor group. To open one of these files, use Tab again to pick the file you want to navigate to, then release Ctrl to open it.

Alternatively, you can use Alt+Left and Alt+Right to navigate between files and edit locations. If you are jumping around between different lines of the same file, these shortcuts allow you to navigate between those locations easily.

Go To Definition

You can go to the definition of a script symbol by pressing F12. If you press Ctrl and hover over a symbol, a preview of the declaration will appear.

Tip: You can jump to the definition with Ctrl+Click or open the definition to the side with Ctrl+Alt+Click.

Go to Symbol

You can navigate symbols within a Script with Ctrl+Shift+O. By typing : the symbols will be grouped by category. Press Up or Down and navigate to the place you want.

Peek

Peeked editors supports quickly checking another file without a big context switch. When you execute a Peek References search (via Shift+F12), or a Peek Definition (via Alt+F12), the preview result is embedded inline.

You can navigate between different references in the peeked editor and make quick edits right there. Clicking on the peeked editor filename or double-clicking in the result list will open the reference in the outer editor.

Tip: Additionally, the peek window is closed if you press Escape or double-click in the peek editor region. You can disable this behavior with the editor.stablePeek setting.

Find All References

Select a symbol then type Shift+Alt+F12 to open the References view showing all your file's symbols in a dedicated view.

Outline View

Provides a symbol tree outline and navigation for Script documents.

Do you sometimes feel lost in your own code? Navigating through scripts is streamlined with the Outline View. This view shows the symbol tree for the active Script which can filter and sort while also spotting warnings and errors.

The Outline View is a separate section in the bottom of the File Explorer that is enabled by default. When expanded, it will show the symbol tree of the currently active editor.

The Outline View has different Sort By modes, optional cursor tracking, and supports the usual open gestures. It also includes an input box which finds or filters symbols as you type. Errors and warnings are also shown in the Outline View, letting you see at a glance a problem's location.

There are several Outline View settings which allow you to enable/disable icons and control the errors and warnings display (all enabled by default):

  • outline.icons - Toggle rendering outline elements with icons.
  • outline.problems.enabled - Show errors and warnings on outline elements.
  • outline.problems.badges - Toggle using badges for errors and warnings.
  • outline.problems.colors - Toggle using colors for errors and warnings.

Breadcrumbs

Breadcrumbs are a navigation bar above a script's content that shows current file system location, and location within a file. This allows you to quickly navigate between symbols and files.

To start using breadcrumbs, enable it with the View > Toggle Breadcrumbs command or via the breadcrumbs.enabled setting.

When using editor tabs (default), breadcrumbs are displayed in a separate row below the editor title. If you are not using editor tabs, breadcrumbs show as an interactive file path next to the title.

Breadcrumbs show the file path and symbol path up to the cursor position. The symbols shown are the same as in Outline View.

The appearance of breadcrumbs can be customized. If you have very long paths or are only interested in either file paths or symbols paths, you can use the breadcrumbs.filePath and breadcrumbs.symbolPath settings. Both support on, off, and last and they define if or what part of the path you see.

To interact with breadcrumbs, use the Focus Breadcrumbs command or press Ctrl+Shift+.. It will select that last element and open a dropdown that allows you to navigate to a sibling file or symbol. Use the Left and Right keyboard shortcuts to go to elements before or after the current element. When the dropdown appears, simply start typing - all matching elements will be highlighted and the best match will be selected for quick navigation.

Diagnostics & Errors

Warnings or Errors are generated by the Papyrus language service which constantly analyzes your code in the background. The extension will validate source code with the Papyrus Compiler and report any problems as you type. When a compilation error is encountered, the invalid code will be underlined in the editor and appear as an entry in the VS Code Problems view. Read more about common Papyrus Compiler Errors.

Warnings and errors show up in multiple places. In the Status Bar, there is a summary of all errors and warnings counts.

  • You can click on the summary or press Ctrl+Shift+M to display the PROBLEMS panel with a list of all current errors.
  • If you open a file that has errors or warnings, they will be rendered inline with the text and in the overview ruler.

Tip: To loop through errors or warnings in the current file, you can press F8 or Shift+F8 which will show an inline zone detailing the problem and possible Code Actions (if available):

Search Creation Kit Wiki

The extension will search the CreationKit.com website for the current selection within a Papyrus document.

There are a few ways to start searching the CreationKit.com website with VS Code.

  • Select a papyrus document symbol.
    • Right click with the mouse and choose Search Creation Kit Wiki.
    • Optionally, open the VS Code Command Palette and begin typing papyrus. Select the Search Creation Kit Wiki command.
Clone this wiki locally