Inside TFS

Collaborative Commenting with TFS 2013's Lightweight Code Comments

Team Foundation Server 2013's lightweight code comments could change the way your team collaborates.

Here's a scenario: You're sitting in an airport, waiting to get on the plane. You receive a frantic text from a team member, begging you to review a code change the he just checked into your Team Foundation Server environment. He really needs your opinion on the code change that's just been made.

Before Team Foundation Server 2013, you might have asked your team member to e-mail the code change to you. Or you might have booted your laptop, connected to the wireless network at the airport, opened Visual Studio, downloaded the change from Team Foundation Server and then reviewed the change, finally e-mailing the team member back with your comments.

Now, imagine calling up a Web browser on your phone, opening the modified file and leaving comments directly attached to the file that your team member can see and also comment on. And all those comments are tracked in Team Foundation Server. This new feature, called lightweight code commenting, is available with Team Foundation Server 2013 and Team Foundation Service.

It enables commenting on entire files or specific lines of a file. This allows for both an interactive or time-shifted conversation about the code, and works wherever you are, including smartphones.

Lightweight code commenting starts with Team Foundation Server Web Access, which provides Web-based access to a variety of Team Foundation Server features. Open your Web browser and navigate to the Team Web Access site of your team project to get started. From the main page of the site, click the Code tab at the top of the page, then select the Changesets sub-tab. Note that there is also a sub-tab for Shelvesets. Lightweight code comments can be applied to both changesets and shelvesets.

From this page, you can see all the different changesets checked into Team Foundation Version Control. Selecting a changeset link displays detailed information about the changeset, including all the files contained within the changeset, and the details of what was changed within each file, as shown in Figure 1.

[Click on image for larger view.] Figure 1. Leave Comments on a Changeset Using Team Web Access

Clicking the highlighted button at the left of the toolbar lets you leave a comment for the entire changeset. Users can click the reply link in the comment to respond back to it, allowing a chained conversation to begin, similar to a message board. You can also select a comment and create a work item from that comment.

You have the capability to comment on specific files, in addition to the entire changeset. To comment on a specific file, first select it. Then, within the file, move your mouse over the line on which you want to comment. Notice that a new comment button appears to the left of the line number, as shown in Figure 2. Clicking this button opens a new comment, tied to that specific line of code.

[Click on image for larger view.] Figure 2. Add a Comment to a Specific Line of the File

On the left side of the Web page is a Send Email icon for Changesets and Shelvesets that allows you to send a permalink to that source control artifact. This includes data about the files in the changeset or shelveset, and any comments left against those files. This can be very handy if you've left comments on someone's code and want to make sure they know about them.

Lightweight code commenting isn't designed to take the place of the code review process built into Team Foundation Server and Visual Studio. Instead, it should be used as just one more method for team members to provide feedback on the code being developed.

About the Author

Mickey Gousset spends his days as a principal consultant for Infront Consulting Group. Gousset is lead author of "Professional Application Lifecycle Management with Visual Studio 2012" (Wrox, 2012) and frequents the speaker circuit singing the praises of ALM and DevOps. He also blogs at ALM Rocks!. Gousset is one of the original Team System/ALM MVPs and has held the award since 2005.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube