PhpStorm 2017.1 Help

Duplicates Tool Window

View | Tool Windows | Duplicates

The Duplicates tool window displays results of the search for duplicates.

On this page:

Panes of the Duplicates tool window

The window consists of the following panes:

  • The left pane displays the tree view of the duplicate fragments of source code. Each node shows the following information:
    • The number of duplicated code fragments found in scope.
    • The 'cost' of the duplicate (which is an arbitrary unit calculated using an additive algorithm on the base of the code block size; generally, the larger is the code fragment, the higher is its cost).
    • The containing class where the duplicates are located.
  • The right pane shows the differences between the duplicated fragments of source code, selected in the left pane.

Left toolbar

ItemShortcutDescription
rerun.png RerunClick this button to rerun the duplicates analysis in the active tab.
close.png Close Active Tab
Ctrl+Shift+F4
Click this button to close the active tab.
autoScrollToSource.png Autoscroll to SourceIf the button is pressed, selecting an entry in the left pane opens the respective file in the editor.
help.png F1 Click this button to show reference.

Upper toolbar

ItemTooltip/Image/ShortcutDescription
arrowDown.png arrowUp.png F7 / Shift+F7Move to the nxt/previous difference
Whitespace
/help/img/idea/2017.1/diffViewer_whitespaces.png
Use this drop-down list to define how the differences viewer should treat white spaces in the text.
  • Do not ignore: white spaces are important, and all differences are highlighted. This option is selected by default.
  • Trim whitespaces: ("\t", " ") , if they appear in the end and in the beginning of a line.
    • If two lines differ in trailing whitespaces only, these lines are considered equal.
    • If two lines are different, such trailing whitespaces are not highlighted in the By word mode.
  • Ignore whitespaces: white spaces are not important, regardless of their location in the source code.
  • Ignore whitespaces and empty lines: the following entities are ignored:
    • all whitespaces (as in the 'Ignore whitespaces' option)
    • all added or removed lines consisting of whitespaces only
    • all changes consisting of splitting or joining lines without changes to non-whitespace parts.
      For example, changing a b c to a \n b c is not highlighted in this mode.
  • Ignore imports and formatting: changes within import statements and whitespaces are ignored (whitespaces within String literals are respected though).
Highlighting mode
/help/img/idea/2017.1/diffViewer_highlight.png
Select the way differences granularity is highlighted.
The available options are:
  • Highlight words: the modified words are highlighted
  • Highlight lines: the modified lines are highlighted
  • Highlight split changes: if this option is selected, big changes are split into smaller 'atomic' changes.
    For example, A \n B vs. A X \n B X will be treated as two changes instead of one.
  • Do not highlight: if this option is selected, the differences are not highlighted at all. This option is intended for significantly modified files, where highlighting only introduces additional difficulties.
/help/img/idea/2017.1/edit.pngJump to Source
F4
Click this button to open the file in the active pane in the editor. The caret will be placed in the same position as in the Duplicates tool window.
/help/img/idea/2017.1/sync_scrolling.pngSynchronize scrollingClick this button to simultaneously scroll both differences panes; if this button is released, each of the panes can be scrolled independently.
/help/img/idea/2017.1/cogwheel_blue_with_arrow.pngEditor settingsClick this button to invoke the list of available settings. Select or clear this options to show or hide whitespaces, line numbers and indent guides, to use or disable the use of soft wraps, and to set the highlighting level.

These commands are also available from the context menu of the differences viewer gutter.

Context menu commands

ItemKeyboard ShortcutDescription
Jump to Source F4 Open in the editor the file that contains the selected duplicate, and place the caret at the beginning of the duplicate. The fragment of code is highlighted.
Show Source Ctrl+Enter Open in the editor the file that contains the selected duplicate, and highlight the fragment of code.
Send to left/Send to rightUse these commands, or the arrow icons /help/img/idea/2017.1/arrowLeftDiffVersion.png/help/img/idea/2017.1/arrowRightDiffVersion.png, to place the selected duplicate to the left or right pane of the differences viewer.

See Also

Last modified: 19 July 2017