Jira work items in VS Code
Atlassian for VS Code is published as an Atlassian Labs project. Although you may find unique and highly useful functionality in the Atlassian Labs apps, Atlassian takes no responsibility for your use of these apps.
Create Jira work items in VS Code
Here are several ways to create Jira work items from the Atlassian for VS Code extension.
Using in-code links
The extension provides in-code links to create work items which are triggered from configurable keywords. By default, the extension ships with the following keywords configured: TODO
, BUG
, FIXME
, and WORK ITEMS
.
Here's how you do it
Select the line where you want to add your in-code link.
Add your in-code link and provide some context. For example,
// TODO: this needs to be fixed.
The message you provide after the in-line code becomes the Jira work item's subject line.The extension will prompt you to create a Jira work item. Select Create Jira work item which appears above the line you just added in Step 2.
Fill in or update any fields on the Create Work item form.
Select Submit.
Once the work item is created, the comment will be replaced to show information about the work item.
These triggers can be configured on the Atlassian Settings screen.
Create a work item from context in VS Code
Another way to create a Jira work item is by using the right-click context menu from anywhere in your code. Not only will this bring up the create work item screen, but it will also drop a link to the source code in Bitbucket with the exact line that was clicked into your work item’s description field. If you highlight multiple lines, the link will contain the range of lines selected.
Here's how you do it
Right-click on the line or highlight multiple lines and right-click on the range of lines you selected to open the right-click context menu.
Select Create New Jira work item from the list of menu items. The line or lines that you selected will be displayed in the Description field of the new Jira work item.
Fill in or update any fields on the Create Work item form.
Select Submit.
If you are not using Bitbucket but another source control system (for example GitHub), a relative path with the line number range will be dropped into the description field.
Create a work item manually from VS Code
You can also create a work item without associating it with a line of code.
Here's how you do it
From the command palette
Open the command palette by executing the following Atlassian: Open Settings command: Command + Shift + P (on Mac) or Ctrl + Shift + P (on PC) and search for Create New Jira Work item.
From the command palette: choose the Create New Jira Work item command.
Fill in or update any fields on the Create Work item form.
Select Submit.
From the Jira work item tree
Select the Atlassian logo on the leftmost navigation bar.
Select the JIRA Work item heading on the Atlassian status bar.
Select the + to open the a new Create Work item form.
Fill in or update any fields on the Create Work item form.
Select Submit.
Create Work item screen in VS Code
Atlassian for VS Code supports many common Jira fields. Unfortunately, it’s not always possible to render complex custom fields contributed by various Jira plugins within the confines of VS Code.
In cases where a work item type contains a field that cannot be rendered, one of two things will happen:
If the field is not required, the field will simply not be shown.
If the field is required, the work item type is removed as an option entirely.
Created with Sketch.
After the work item is created, the summary and description fields will be reset to blank with all other fields remaining with the previously selected options. This allows you to create multiple work items in rapid succession just like the “create another” option within Jira itself.
This is useful if you're doing a planning session and need to create a lot of work items with similar field values.
View and modify Jira work items
Learn the multiple ways within VS Code to open and update the details of a Jira work item.
Here's how you do it
Select a work item in a work item tree
If you’re looking through the list of work items in a work item tree, simply selecting a work item will bring up the work item’s details screen.
Use the Command Palette
If you know the work item key you want to open, you can quickly open the details screen from the command palette:
Open the command palette by executing the following Atlassian: Open Settings command: Command + Shift + P (on Mac) or Ctrl + Shift + P (on PC).
Search for 'open Jira work item' and select Atlassian: Open Jira Work item
An input box is displayed where you can type in your work item key and hit enter to open the details.
Work Item Hovers
The extension includes support for Work Item Hovers.
Hover over a work item key anywhere in your code (usually in code comments) and you’ll get a quick view modal for the work item.
Within the modal, click the Open Work Item View link to open the full work item details screen.
Work item hovers can be disabled/enabled in the Atlassian Settings screen.
Start work with Jira work items
The Start work on work item feature performs all the steps required in Jira and Bitbucket so you can start coding.
Before you begin using this feature:
Assign the work item to yourself
Create a new branch for the work item, containing the work item key and branch name
Checkout the new branch locally and link it to the remote repository branch
Transition the work item to 'In progress'
To use the feature:
Double-click an open work item you would like to start working on from the Open Work Items list on the Atlassian status bar.
Click the Start work on a work item button to access the work item.
Once you select the Start work on a work item button, the following occurs:
the work item is assigned to you
the work item is transitioned to whatever state you selected
a branch is created with the work item key in it's name
a branch is checked out locally
a branch has its upstream set to the remote branch
When you put a work item key in your branch name you can see and interact with work items similar to the way you would in Jira within the Bitbucket Cloud interface. Learn more
Including work item keys in every commit message is also a good idea. Not only do these get automatically linked in the Bitbucket interface, but it also helps the VS Code extension find work items related to commits and pull requests.
Never forget a work item key again
We’ve made it super simple to include your Jira work item keys in your commit messages without ever having to type one in or even remember what the key is. When you create a branch with the work item key in its name, you can use a git prepare-commit script to automatically add the work item key from the branch name into every commit comment.
Don’t know how to write a prepare-commit script? No worries, we’ve got you covered:
bitbucket.org/snippets/atlassian/qedp7d/...
Was this helpful?