How do I view GitHub issues from within Visual Studio 2022?
Asked Answered
S

3

6

How do I view and integrate with GitHub issues using Visual Studio 2022?

When connected to an Azure Repo, the VS Team Explorer window includes a "Work Items" view that shows open issues from Azure Boards. I can easily create a branch from one, link it automatically, and submit pull requests. The integration is great.

When I connect to a GitHub repository, that integration is lost. The Team Explorer window no longer contains a "Work Items" view. Since I can't view the issues, I can no longer automatically create branches that are linked to the issue. I have to now manually type in the issue number if I want to link a commit to the issue. And the "Create Pull Request" menu items simply launches the browser to the GitHub page; there's no integration there, either.

I have found a VS Code blog post that enables a lot of this functionality (and more) into VS Code, but I've yet to find anything for Visual Studio 2022. From that post, I am most interested in the "Working on issues" bit. As described above, this was functionality that worked with Azure Repos but is lost with GitHub integration. How might I regain that functionality with GitHub and Visual Studio 2022?

Spurry answered 10/1, 2023 at 23:0 Comment(0)
M
4

The "old" team explorer did a number of really nice things, but it was also very hard to integrate into for other tool vendors. With the new Git experience the Visual Studio team opted for a more agnostic approach.

The old Team Explorer was written in .NET 4 and was very much geared towards integrating with Azure DevOps. It stems from 2005 when Team Foundation Server first got released. Over time other vendors snuck their way into Team Explorer, but mostly through undocumented and unsupported ways. This has caused many interesting issues in the past. The concept of the Team Explorer window also wasn't ideal for hosting GitHub, Azure DevOps, BitBucket and every other tool-vendor that wanted to be listed and there was very little in the way of control for users to set the order of elements or hide certain tiles. As such it's a breeding ground for bugs and it needed to be ported to .NET Core and x64 and to support out-of-process extensibility to properly support Visual Studio 2022 anyway.

So Team Explorer and its old undocumented extensibility points were dropped and the new Git Window was born. This window is a pure git client and it's vendor agnostic. Vendors may add menu items to the top level menu, but they currently can't extend the new git window.

At the same time, Visual Studio 2022 dropped support for the built-in browser window, which was a memory hog, loads IE11 and also needed full retooling to support the x64 out-of-process loading that Visual Studio 2022 now demands.

All of this work now allows Visual Studio to use more memory, it's faster and by moving extensions out-of-process, it has greatly improved the performance and stability of the visual studio platform. Unfortunately this all happened at the expense of some features.

The new git experience is no longer constrained by the Team Explorer window, is a top-level citizen in Visual Studio and can finally use easier to remember keyboard shortcut keys. It's much faster too and the new architecture allowed the team to build interactive rebase, multi-repo support, submodule support and more. But their priorities have been in advanced git scenarios for a long while, not in building support for vendor specific issue integration. It looks like that may be changing though. Auto-completion of #... is now in Visual Studio 17.5 preview:

enter image description here

Some tool vendors may invest in native integration into Visual Studio in the future. Many old extensions are no longer available in VS2022 or the authors are still working on a new version that conforms to the new requirements.

On the other hand you have VS Code, which is used by GitHub itself internally, runs in a browser, powers github.dev and github codespaces and doesn't carry the legacy if Visual Studio 2022. It's not Microsoft, but GitHub who has extended vscode and they added the support for their platform through extensions and open source contribution to the editor directly. GitHub has a different stake in vscode, they have the engineering staff that knows how to extend atom-based applications (they basically built that technology) thus, their features have been added to vscode.

Is it fair? Do we want it in big VS as well? Sure, but unfortunately, that's currently not where the money is being spent.

There are a few ways to accomplish what you want. But none are exactly what you desire.

The web

The main way is to start working from the browser. On every issue there is a Development section from which you can create a branch or initiate a pull request from the associated branch:

enter image description here

You can then immediately check it out locally

enter image description here

Or navigate to the code panel for the branch and click the open in visual studio link. This will launch visual studio in the correct context using the repo you selected and will check out the branch locally for you to start working.

enter image description here

Any commits you make to this branch are automatically associated to the issue, so there's no need to pass in the #issuenumber every time.

The cli

An alternative to working from the browser is to use the CLI. If you have the GitHub CLI installed it will pick up the context of your repo from the list of remotes and you can perform quick commands straight from visual studio's built-in terminal.

gh pr create

to create a new PR.

gh issue list

to quickly list your open issues

gh issue develop #issuenumber

to create a branch on the remote, associate it to your issue and check out the branch locally.

It takes a bit of getting used to the commands, but if you like the CLI it's a quick way to work.

enter image description here

In Visual Studio

You can create pull requests from your current state, which will then bring you to the browser with most of the data pre-filled. Issue auto-completion also works in the browser from that point forward.

enter image description here

To get the other features you want, you must install extensions. Unfortunately, GitHub has stopped development on the old GitHub for Visual Studio extension since most of its features have now moved into visual studio. It's not easy to build and maintain an extension for multiple versions of Visual Studio, so I don't expect this will be brought back to life.

I rely on the Git Web links extension to quickly switch between web and visual studio from the context of my working files:

enter image description here

In the settings you can set the default behavior to not copy, but to open in browser.

Other functionality you're after is currently not available through a publicly listed extension. Most of there features have also been removed or deprecated for Azure DevOps itself, so I don't expect the Visual Studio team to be in a hurry to add first-class support for Issue tracking back in.

Milestone answered 7/2, 2023 at 11:44 Comment(2)
Thank you for this detailed and informative answer. I wish I had seen this two days ago when I could have awarded you the bounty. (Sorry about that.) I totally understand why stuff was changing. It was just SO disappointing to see features being removed without any mention of how to replicate them. I most appreciate your instructions on creating a usable workflow with other tools.Overbite
You're welcome. A bounty is nice, but this feedback is better.Milestone
H
1

It seems like the VS2022 will have this feature in future (it's in Preview now).

https://youtu.be/0NiHvdoMBO8?t=95 [VS2022 Preview Feature]

Humanoid answered 7/2, 2023 at 13:58 Comment(3)
I expect this to be added in the next Patch Tuesday, Feb 14th, 2023Trakas
Welcome to StackOverflow and thanks for the contribution! I recommend a couple screen shots of the feature location in Visual Studio. This will help better answer the OP and provide a safe way to ensure that the future viewers of this post don't have to rely on potentially broken links.Frye
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Frye
D
0

Unfortunately, the "Work Items" view and the related issue integration for GitHub Repos is not currently available in Visual Studio 2022 out of the box.

You might be able to find a Visual Studio extension that provides this functionality, but I'm not aware of any off the top of my head.

An alternative option would be to use the GitHub API to retrieve the issues, and create a custom extension to display the issues in Visual Studio 2022. However, this would require custom development work on your part.

Dichotomize answered 4/2, 2023 at 9:46 Comment(2)
I'm hesitant to mark this as an acceptable answer. You've said, "It's not there," after I said, "It's not there." Then you said, "Look for an extension," after I said, "I can't find anything." Does that mean the only option left is, like you say, "roll your own"? That is an answer, even though I don't like it. But it gives no insight into why MS would silently deprecate a feature in VS 2022 only to recreate it in VS Code.Overbite
@Jason'Bug'Fenter - I'm wondering the same thing. I can find multiple blog posts and videos about this feature, yet no sign of the feature in VS2022 17.5 (was supposed to be present in 17.1 or .2).. what the hell is going on here? Microsoft gib issue integration plz. Re: the roll your own advice is.. generally not useful, considering most of us don't have the time to build and maintain something like that..Wilk

© 2022 - 2024 — McMap. All rights reserved.