Partilhar via


Pin a work item query in VS Code

A couple weeks ago the VSTS Extension for VS Code was released. This extension adds command and status bar integration for Visual Studio Team Services. When using this extension I loved seeing the number of pull requests and the build state in the status bar but I wished I could see the count of bugs assigned to me. About a week ago I forked the project to see how hard it would be to add this feature. To my surprise it was very simple. Jeff Young did a great job with the extension, it is well structured and easy to jump into. After a few hours I built the Pinned Query feature.

A pinned query is a work item query that runs in the status bar and shows you a count of how many items it returns (see the cute little bug icon). When you click on the icon it will run the query and give you the results.

image

By default it is set to a built in query showing all the work items assigned to you but you can easily customize the pinned query in your user settings file. You can configure using a path to an existing query or by providing WIQL:

Using Query Text

 
 "team.pinnedQueries": [
        {
            "account": "your-account-name",
            "queryText": "SELECT * FROM WorkItems WHERE [System.AssignedTo] = @me AND [System.ChangedDate] > @Today - 14"
        }
    ]

Using Query Path

 
    "team.pinnedQueries": [
        {
            "account": "your-account-name",
            "queryPath": "Shared Queries/My Folder/My Query"
        }
    ]

You can also create a global pinned query which will be the default if you have not configured one for your account by replacing your-account-name with global in the previous examples.

Source: MatthewManela.com