CodeTogether supports coding alone or with a group in a shared room, and you can even have multiple rooms in a session. If the host allows participants to drive/edit when starting a session, everyone in the session can choose whether to explore/edit code alone or in a room. Multiple rooms of developers, as well as individual developers, can code or browse the shared workspace simultaneously.
To start coding, a developer simply needs to start typing, whether in a room or alone. There is no need to request control and no confirmation dialog to step through. Several developers can be editing different files at the same time, and starting with CodeTogether 3.0, simultaneous edits in the same file (similar to Google Docs) are also supported.
Note: When multiple developers are typing simultaneously in the same file, language features like content assist, validation, navigation, etc. will continue to work for each editor, but performance may be affected. We are continuing to improve the reliability of these features in such cases.
When in a room, typically, all members in the room share the same editing context—the same cursor position and the same selection, in the same file. If permissions were granted when the host started the session, any member in the room can drive the session by opening new files, making selections or editing code. Other members in the room will follow the driver. No special process is needed to switch drivers, just open a file or start coding yourself, and the others will now be following you.
Quick Investigations and Edits
If a member is actively typing in the room, but another member wants to make a small correction elsewhere or just take a quick look at another piece of code, they can do so without leaving the current room. They can just navigate to the point of interest, and even make edits if desired. After a short timeout, they will be brought back to the active coder’s location. Other members in the room, and most importantly, the active coder, will not be affected by this and they will continue to remain in the same location.
Joining a Room
When you join a session, you are automatically placed in a room of developers.* To change to a different room, double-click on the room in the Coding Rooms node in the CodeTogether view.
If coding alone, you have the following options to join a group in a room:
- In the browser, turn on the Shared Cursor toggle in the menu bar, or use the Ctrl + K C hotkey*
- In Eclipse and IntelliJ, an annotation in the bottom right of the editor will have a link to join the host.
- In VS Code, click the Editing alone status bar item to bring up the Join and code with others action.
* Participants join the room with the largest number of developers. If all rooms are the same size, they join the host’s room.
Coding alone is similar to coding in a regular IDE. The developer alone decides which files to browse or edit. Other members of the session are not disrupted, nor do they follow along as the developer opens new files and makes edits.
To code alone:
- In the browser, turn off the Shared Cursor toggle in the menu bar, or use the Ctrl + K C hotkey.
- In the CodeTogether view, double-click Go to a personal room in the Coding Rooms node, or click the Go to a Personal Room button.
- In Eclipse or IntelliJ, use the edit on your own link in the editor annotation at the bottom right.
- In VS Code, you click the Driving/Watching status bar item to bring up the Edit on your own action.
Editor Border and Annotations
CodeTogether displays an annotation indicating your current state in the session or coding room. In Eclipse and IntelliJ, it is displayed at the bottom right of the editor area. In VS Code, it is displayed in the Status bar area. In the browser, it is displayed next to the toggle in the menu bar.
Eclipse and IntelliJ use color codes in addition to the text to make the state more clear.
- Grey—Watching or waiting for others to join
- Light Blue—Coding alone
- Yellow—Browsing or editing with another active driver in the room
You can turn off the Editor border and annotations from the CodeTogether Preferences, clear the Show collaboration status in editor checkbox.
Using the CodeTogether View
To see an overview of your active pair programming session, take a look at the CodeTogether view in the IDE or the browser. In the IDE, if signed in to a Teams account, you also get an overview of other team members online and sessions they are currently running. Several team specific actions are also available.
In the IDE
Open the CodeTogether view in the IDE as follows:
- Eclipse—Select Window > Show View > Others > CodeTogether > CodeTogether.
- IntelliJ—Select View > Tool Windows > CodeTogether.
- VS Code—Select View > Open View > CodeTogether.
In the Browser
The CodeTogether View defaults to the right sidebar in the browser.
Tip: You can click the CodeTogether icon to quickly show/hide the view.
Shown in Firefox
The tree in the view has multiple sections as described below. Most tree nodes have actions that can be accessed by hovering over the node.
Whether coding in rooms or alone, all members in the session are listed under this node. The file being actively edited by them is also displayed alongside. Double-click on any room to join it, or click the Join Room button. Alternatively, use the View Room Location button to open the file being edited without leaving your current room.
In IntelliJ and Eclipse, these actions are also available via a context menu.
Expands to a list of terminals shared by the host in the current session. Double-click a terminal to open the corresponding terminal in your IDE or browser, or click the Focus Terminal button. The host has a Stop Sharing button which closes the terminal for all participants and removes it from their CodeTogether view.
Note: Once the host stops sharing a terminal, while it remains listed in their Terminals node, it cannot be re-shared in the current session. We’ll be making terminal sharing more flexible in future releases.
On the host, servers that are detected automatically or added manually appear here. Hosts can choose to start or stop sharing a server anytime during the session. When a server is no longer shared, it disappears from the participant’s CodeTogether view and they can no longer interact with it.
On the participant side, servers that are shared by the host appear under this node. Use the Connect Server action or double click to make the server available locally. The node then displays the local address for the server. You can use the Disconnect Server action or double click to disconnect from the shared server, freeing up the local port being used.
Expands to a list of files that were recently modified in the current session. Double-click any file to open the file, or click the Open Modified File button.
CodeTogether Teams Section
This section is displayed if you are connected to a Teams account, or an on-premises installation.
Lists sessions your team members have running—you can join any session listed under this node without being explicitly invited to the session.
Expands to a list of teams and online members in each team. Use these nodes to invite team members to a session or ask them to host a session.
Navigating and Editing in a Session
Host-provided language smarts allow you to take advantage of a number of useful features when navigating and editing code in the session, regardless of whether you join the session from an IDE or browser. Refer to Participating in a Session for details.