{"id":5619,"date":"2019-09-30T12:16:04","date_gmt":"2019-09-30T17:16:04","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=5619"},"modified":"2019-10-04T11:24:18","modified_gmt":"2019-10-04T16:24:18","slug":"vs-code-keyboard-shortcut-commenting","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=5619","title":{"rendered":"VS Code Keyboard Shortcut: Commenting"},"content":{"rendered":"<p>We&#8217;ve been watching <a href=\"https:\/\/www.youtube.com\/playlist?list=PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft&#8217;s Python programming course series<\/a> &#8212; only the first couple so far, so it&#8217;s a lot of &#8220;yeah, knew that&#8221;. *But* there&#8217;s the occasional cool tip. You can comment line(s) of code with a keyboard shortcut:<\/p>\n<p>Ctrl k,c comment current line (or selection)<br \/>\nCtrl k,u uncomment current line (or selection)<\/p>\n<p>&nbsp;<\/p>\n<p>Highlight the section of code that you want to comment out.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=5635\" rel=\"attachment wp-att-5635\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5635\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/10\/word-image.png\" alt=\"\" width=\"774\" height=\"572\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/10\/word-image.png 774w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/10\/word-image-300x222.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/10\/word-image-768x568.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/a><\/p>\n<p>Hit ctrl-k and then ctrl-c \u2026 voila, a whole section of commented code. Denoting a comment is language specific, so this does <em>not<\/em> do anything if VS Code has not yet identified the language for your file.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=5636\" rel=\"attachment wp-att-5636\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5636\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/10\/word-image-1.png\" alt=\"\" width=\"706\" height=\"550\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/10\/word-image-1.png 706w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/10\/word-image-1-300x234.png 300w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/a><\/p>\n<p>To remove comments, use ctrl-k then ctrl-u. This works with code that already includes comments \u2013 you\u2019ll get an additional comment in front of the commented line, and that additional comment will be removed leaving a commented line.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve been watching Microsoft&#8217;s Python programming course series &#8212; only the first couple so far, so it&#8217;s a lot of &#8220;yeah, knew that&#8221;. *But* there&#8217;s the occasional cool tip. You can comment line(s) of code with a keyboard shortcut: Ctrl k,c comment current line (or selection) Ctrl k,u uncomment current line (or selection) &nbsp; Highlight &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[817],"class_list":["post-5619","post","type-post","status-publish","format-standard","hentry","category-coding","tag-vscode"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5619"}],"version-history":[{"count":3,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5619\/revisions"}],"predecessor-version":[{"id":5642,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5619\/revisions\/5642"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}