Find code changes and references with CodeLens

With Microsoft Visual Studio 2019 version 16.1, P4 for Visual Studio supports the CodeLens feature. With the relevant CodeLens option enabled (which is the default), you can view the names of users who made changes to classes, functions, and methods throughout the code and get a preview of up to five changelists. You can also open a changelist, the file history, and the Time-lapse View.

The Time-laps View link is only available if P4V is installed.

If needed, you can modify the configuration under Tools > Options > Text Editor > All Languages > CodeLens > Show Submitted Changelists (P4).

To use the CodeLens feature with P4 for Visual Studio:

  1. Above a class or function, move the pointer over the gray user name. A tooltip with additional information about the last changes appears.

  2. To open a callout displaying the latest five changes, as shown in the following figure, click the user name.

    Codelens details
  3. To view more information on any of these changes, do one of the following:

    • Move the pointer over the change to view the full description.
    • Double-click the change to open the Submitted Changelist dialog. For details, see the Check in files and work with changelists section.
  4. To view more information on the file itself, click the Show History or Time-lapse View links.