ReSharper 2024.3 Help

Navigate file by its structure

File Structure window

With ReSharper, you can navigate the structure of the current document using the File Structure window, which greatly simplifies navigation in large files. The window is synchronized with the editor: as you switch to another editor tab, the window displays the structure of the corresponding file.

Open and use File Structure window

  1. Press Control+F11 or choose ReSharper | Windows | File Structure from the main menu . Alternatively, you can press Control+Shift+A, start typing the command name in the popup, and then choose it there.

  2. The contents of the current document appear in a tree structure, that you can explore and navigate through the document. You can double-click any symbol to make the caret in the editor switch to the corresponding position.

  3. If some parts of the code are surrounded by #region blocks, the regions appear in the file structure too.

    You can wrap symbols into a region right from the file structure. To do so, select the members you want to wrap (Ctrl-click items for multiple selection), and then click Surround with Region ThemedIcon.Enregion.Screen.(Gray).png on the toolbar.

    You can remove any region by clicking the cross icon ThemedIcon.Close.Screen.(Gray).png in the upper right corner of the region frame.

    To rename a region, double-click its name or press F2 over it, and then type the new name.

  4. To synchronize the way you change caret position in the editor with the symbol highlighted in the File Structure window, click Track Caret in Editor Track Caret in Editor on the toolbar.

  5. To synchronize symbols that you select in the File Structure window with the caret position in the editor, click Automatically Scroll to Source Automatically Scroll to Source on the toolbar.

ReSharper: File Structure window

Right from the File Structure window, you can access even more actions. To check available commands, you can right-click any symbol.

  • To open a specific type or member in the editor, double-click it or press Enter or Ctrl+Enter. There is a difference between these two shortcuts: Enter opens the corresponding line in the editor but keeps the focus in the Find Results window so that you can press Up and Down to study other results; Ctrl+Enter also moves the focus to the editor.

  • Navigate from symbols Control+Shift+G

  • Find usages of symbols Alt+F7

  • Generate type members Alt+Insert

  • Perform refactorings Control+Shift+R

  • Drag-n-drop types and type members to rearrange their order. Your changes are immediately reflected in the file.

  • If the opened file contains unit tests, these are marked with corresponding icons displaying the status of their last execution. You can also run and debug unit tests right from inside the File Structure window.

File Structure window toolbar controls

Control

Name

Description

ThemedIcon.ExpandAll.Screen.(Gray).png ThemedIcon.CollapseAll.Screen.(Gray).png

Expand All/Collapse All

Expands/collapses all nodes in the current tab.

ThemedIcon.Up.Screen.(Gray).png ThemedIcon.Down.Screen.(Gray).png

Previous/Next


Shift+F8/F8

Navigate to the previous/next item and scrolls through the source code accordingly.

ThemedIcon.Export.Screen.(Gray).png

Export

Click this button to export the data currently displayed in the window in text format , or use the drop-down selector to export the data in an XML or HTML format. The Export Data dialog that appears will help you save the data to a file or copy it to the clipboard .

ThemedIcon.SyncCaretToView.Screen.(Gray).png

Track Caret in Editor

When this button is pressed, items in the window are highlighted according to the position of the caret in the editor.

ThemedIcon.SyncViewToCaret.Screen.(Gray).png

Automatically Scroll to Source

When this button is pressed, the editor opens the file and scrolls it according to the items selected in the window.

ThemedIcon.Enregion.Screen.(Gray).png

Surround with Region

In C# and VB.NET files, surrounds the selected symbols with #region.

Select one or several adjacent nodes in the window and click Surround with Region ThemedIcon.Enregion.Screen.(Gray).png.

You can remove the region from the source code by clicking the X mark in the upper-right corner of the region frame. You can also collapse/expand the region frame using the arrow in the upper-left corner.

ThemedIcon.Macro.Screen.(SymbolsVs11Gray).png

Show Preprocessor Directives

In C++, shows all preprocessor directives in the current file.

This feature is supported in the following languages and technologies:

Language: C#

Language: VB.NET

Language: C++

Language: HTML

Language: ASP.NET

Language: Razor

Language: JavaScript

Language: TypeScript

Language: CSS

Language: XML

Language: XAML

Language: Resx

Language: Build Scripts

Language: Protobuf

Language: JSON

Feature is available in C#

Feature is available in Visual Basic

Feature is available in C++

Feature is available in HTML

Feature is available in ASP.NET

Feature is available in Razor

Feature is available in JavaScript

Feature is available in TypeScript

Feature is available in CSS

Feature is available in XML

Feature is available in XAML

Feature is available in Resource files

Feature is available in build script files

Feature is available in Protobuf

Feature is available in JSON

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the ReSharper by language section.

Last modified: 23 September 2024