In this tutorial I will show you how to use Differences viewer for files on PhpStorm in order to compare two files. You will explore how to compare plain text files and I explain what the Differences viewer for files tooltip buttons represents.
Code used during this tutorial:
# PhpStorm Differences viewer for files (Compare two files)
# You can open the differences viewer without running PhpStorm
<path to PhpStorm executable file> diff <path_1> <path_2>
Expand "share/compare" directory
Open "file-1.txt" and "file-2.txt"
Select "file-1.txt" and "file-2.txt"
Right Click / Compare Files
Differences viewer for files dialog is displayed every time you compare two files, or compare two versions of
a file (local changes or changes between local files and their revisions in a remote repository).
You can compare files of any types, including binaries and .jar files.
# Tooltip Buttons
# Use these buttons to jump to the next/previous difference
Previous Difference / Next Difference
# Click this button to open the selected file in the active pane in the editor. The caret will be placed
# in the same position as in the Differences Viewer
Jump to Source
# Use this drop-down list to choose the desired viewer type.
# The side-by-side viewer has two panels; the unified viewer has one panel only.
# On unified viewer you can change text only in the right-hand part of the default viewer
# 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.
# Trim whitespaces: ("\t", " ") , if they appear in the end and in the beginning of a line.
# Ignore whitespaces: white spaces are not important, regardless of their location in the source code.
# Ignore whitespaces and empty lines. For example, changing a b c to a \n b c is not highlighted in this mode.
# Select the way differences granularity is highlighted.
# Do not highlight: the differences are not highlighted at all
# Highlight lines: the modified lines are highlighted
# Highlight words: the modified words are highlighted
# Highlight split changes: big changes are split into smaller 'atomic' changes
# Collapse all unchanged fragments in both files
Collapse unchanged fragments
# Click this button to simultaneously scroll both differences panes
# Click this button to reveal the drop-down list of available check commands.
# Right-click the gutter to show the menu of check commands.
# Useful links