{"id":248869,"date":"2024-05-14T01:00:25","date_gmt":"2024-05-14T08:00:25","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=248869"},"modified":"2024-05-15T14:26:45","modified_gmt":"2024-05-15T21:26:45","slug":"mastering-slash-commands-with-github-copilot-in-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/mastering-slash-commands-with-github-copilot-in-visual-studio\/","title":{"rendered":"Mastering Slash Commands with GitHub Copilot in Visual Studio"},"content":{"rendered":"<p>GitHub Copilot, the AI-powered coding assistant, revolutionizes coding in Visual Studio with its advanced features. In this series, we delve into the efficiency and convenience offered by Slash Commands, elevating your coding workflow.<\/p>\n<h2><strong>Introducing Slash Commands<\/strong><\/h2>\n<p>Slash Commands are predefined actions within GitHub Copilot, accessible through the prompt interface. Bruno Capuano, in his latest video, elucidates these commands, accessible via the Slash button in the Copilot Chat window or by typing a forward slash in the message box.<\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/techcommunity.microsoft.com\/t5\/image\/serverpage\/image-id\/567954i470C29931AD979C5\/image-size\/medium?v=v2&amp;px=400\" alt=\"Slash Commands menu by clicking the Slash button in the Copilot Chat window\" width=\"400\" height=\"85\" \/><\/p>\n<p>Alternatively, you can also access the Slash Commands by typing a forward slash in the message box.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/05\/LBugnion_1-1712226760337.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-248964\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/05\/LBugnion_1-1712226760337-300x122.png\" alt=\"Image LBugnion 1 1712226760337\" width=\"300\" height=\"122\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/05\/LBugnion_1-1712226760337-300x122.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/05\/LBugnion_1-1712226760337.png 374w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Key commands include:<\/strong><\/p>\n<ul>\n<li><strong>doc<\/strong>: Insert a documentation comment in the current cursor position.<\/li>\n<li><strong>exp<\/strong>: Start a new conversation thread with a fresh context.<\/li>\n<li><strong>explain<\/strong>: Provide an explanation for the selected code.<\/li>\n<li><strong>fix<\/strong>: Suggest fixes for code errors and typos.<\/li>\n<li><strong>generate<\/strong>: Generate new code snippets based on your input.<\/li>\n<li><strong>optimize<\/strong>: Recommend code optimizations to improve performance.<\/li>\n<li><strong>tests<\/strong>: Create a unit test for the current code selection.<\/li>\n<li><strong>help<\/strong>: Access help and support for GitHub Copilot.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><strong>A Practical Example with \/fix<\/strong><\/h3>\n<p>Demonstrating the power of Slash Commands, the <strong>\/fix<\/strong> command automatically suggests corrections for typos and errors, enhancing code quality and efficiency.<\/p>\n<p>In the video, Bruno demonstrates how GitHub Copilot can automatically suggest corrections for typos and other issues. This command can be used in the main chat window, and it\u2019s also accessible in the inline chat by pressing <strong>Alt-Slash (Alt-\/)<\/strong> or through the right-click context menu.<\/p>\n<p><iframe title=\"Using Slash Commands in GitHub Copilot for Visual Studio #visualstudio #githubcopilot #slashcommands\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/vZSf9F-S_aA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>As you can see, these Slash Commands can significantly improve your productivity in Visual Studio. Learn <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/how-to-install-github-copilot-in-visual-studio\/\">how to Install GitHub Copilot in Visual Studio<\/a>.<\/p>\n<h3><strong>Additional Resources<\/strong><\/h3>\n<p>To learn more about GitHub Copilot and Slash Commands, <a href=\"https:\/\/learn.microsoft.com\/collections\/ng58uwrk6g53ox?WT.mc_id=academic-132376-lbugnion\">check out our resource collection here.<\/a> You can watch the <a href=\"https:\/\/youtu.be\/z1ycDvspv8U\">full video here<\/a>. For ongoing updates, stay tuned to this blog and consider <a href=\"https:\/\/www.youtube.com\/@VisualStudio\">subscribing to our YouTube channel<\/a> for more insights and tutorials.<\/p>\n<ul>\n<li><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/copilot-chat-slash-commands-and-context-variables\/\" target=\"_blank\" rel=\"noopener\">Code Faster and Better with GitHub Copilot\u2019s New Features: Slash Commands and Context Variables<\/a><\/li>\n<li><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/announcing-the-github-extension-for-visual-studio\/\" target=\"_blank\" rel=\"noopener\">Announcing the GitHub Extension for Visual Studio<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>GitHub Copilot, the AI-powered coding assistant, revolutionizes coding in Visual Studio with its advanced features. In this series, we delve into the efficiency and convenience offered by Slash Commands, elevating your coding workflow. Introducing Slash Commands Slash Commands are predefined actions within GitHub Copilot, accessible through the prompt interface. Bruno Capuano, in his latest video, [&hellip;]<\/p>\n","protected":false},"author":24687,"featured_media":248889,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[6887,6888,6941,1388,6904,155],"tags":[1055,6946,4381,6924,6906,6944,287,12],"class_list":["post-248869","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence","category-copilot","category-copilot-2024-series","category-extensibility","category-installation-and-updates","category-visual-studio","tag-ai","tag-cynthia-zanoni","tag-github","tag-github-copilot","tag-install","tag-laurent-bugnion","tag-tips-and-tricks","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>GitHub Copilot, the AI-powered coding assistant, revolutionizes coding in Visual Studio with its advanced features. In this series, we delve into the efficiency and convenience offered by Slash Commands, elevating your coding workflow. Introducing Slash Commands Slash Commands are predefined actions within GitHub Copilot, accessible through the prompt interface. Bruno Capuano, in his latest video, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/248869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/24687"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=248869"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/248869\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/248889"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=248869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=248869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=248869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}