{"id":10007003,"date":"2022-12-22T18:38:13","date_gmt":"2022-12-22T10:38:13","guid":{"rendered":"https:\/\/ityet.com\/?p=10007003"},"modified":"2022-12-22T18:38:13","modified_gmt":"2022-12-22T10:38:13","slug":"vs-code-%e4%b8%ad%e7%9a%84%e5%a2%9e%e5%bc%ba-code-cli","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10007003","title":{"rendered":"VS Code \u4e2d\u7684\u589e\u5f3a code CLI"},"content":{"rendered":"<p>Visual Studio Code \u7684\u6838\u5fc3\u662f\u4e00\u4e2a\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u5b83\u901a\u8fc7\u6211\u4eec\u7684\u8fdc\u7a0b\u5f00\u53d1\u7ecf\u9a8c\u4e0e\u5176\u4ed6\u73af\u5883\u96c6\u6210\uff0c\u53d8\u5f97\u66f4\u52a0\u5f3a\u5927\u548c\u7075\u6d3b\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043143365\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<p>\u4f60\u53ef\u80fd\u4e0d\u77e5\u9053\u7684\u662f\uff0cVS Code \u6709\u4e00\u4e2a\u5185\u7f6e\u7684\u547d\u4ee4\u884c\u754c\u9762(CLI)\uff0c\u53ef\u4ee5\u8ba9\u4f60\u63a7\u5236\u542f\u52a8\u548c\u7ba1\u7406\u7f16\u8f91\u5668\u7684\u65b9\u5f0f\u2014\u2014\u4f60\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879\u6253\u5f00\u6587\u4ef6\u3001\u5b89\u88c5\u6269\u5c55\u548c\u8f93\u51fa\u8bca\u65ad\u4fe1\u606f\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043143366\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<p>CLI \u5728\u4f7f\u7528 VS Code Desktop \u7684\u5de5\u4f5c\u6d41\u4e2d\u975e\u5e38\u6709\u7528\uff0c\u4f46\u5b58\u5728\u4e00\u4e2a\u7f3a\u9677\uff1a\u60a8\u65e0\u6cd5\u4f7f\u7528\u5b83\u542f\u52a8\u8fdc\u7a0b\u5b9e\u4f8b\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u5e0c\u671b\u901a\u8fc7\u5c06\u672c\u5730\u548c\u8fdc\u7a0b\u66f4\u7d27\u5bc6\u5730\u7ed3\u5408\u5728\u4e00\u8d77\u6765\u5f25\u8865\u8fd9\u4e00\u5dee\u8ddd\uff0c\u4ece\u800c\u4f7f CLI \u66f4\u52a0\u5f3a\u5927\u3002<\/p>\n<p>\u4eca\u5929\uff0c\u6211\u4eec\u5f88\u9ad8\u5174\u5206\u4eab\u6211\u4eec<strong>\u589e\u5f3a\u7684 code CLI<\/strong>\uff0c\u5b83\u53ef\u4ee5\u8ba9\u60a8<strong>\u542f\u52a8 VS Code \u5e76\u4ece VS Code Desktop \u6216 vscode.dev \u8fdc\u7a0b\u8fde\u63a5\u5230\u4e00\u53f0\u673a\u5668<\/strong>\u3002\u66f4\u65b0\u7684 CLI \u5185\u7f6e\u4e8e\u6700\u65b0\u7684 VS Code \u7248\u672c\u4e2d\uff0c\u4e5f\u53ef\u7528\u4e8e\u72ec\u7acb\u5b89\u88c5\uff0c\u56e0\u6b64\u60a8\u53ef\u4ee5\u521b\u5efa\u5230\u4efb\u4f55\u8ba1\u7b97\u673a\u7684\u5b89\u5168\u8fde\u63a5\u5e76\u8fdc\u7a0b\u8fde\u63a5\u5230\u5b83\uff0c\u5373\u4f7f\u60a8\u65e0\u6cd5\u5728\u5176\u4e0a\u5b89\u88c5 VS Code Desktop\u3002<\/p>\n<p>\u9664\u4e86\u65b0\u7684 CLI \u4e4b\u5916\uff0c\u6211\u4eec\u8fd8\u8fdb\u884c\u4e86\u4ee5\u4e0b\u66f4\u65b0\u6765\u6539\u8fdb\u8fdc\u7a0b\u5f00\u53d1\uff1a<\/p>\n<ul>\n<li>\u60a8\u53ef\u4ee5\u76f4\u63a5\u4ece VS Code UI \u542f\u7528\u96a7\u9053\u3002<\/li>\n<li>\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u521b\u5efa\u548c\u4f7f\u7528\u96a7\u9053\uff0c\u65e0\u9700\u6ce8\u518c\u3002<\/li>\n<li>\u6211\u4eec\u91cd\u547d\u540d\u4e86\u4e24\u4e2a\u8fdc\u7a0b\u6269\u5c55\uff0c\u4ee5\u4fbf\u60a8\u66f4\u6e05\u695a\u5730\u4e86\u89e3\u5b83\u4eec\u7684\u5de5\u4f5c\u65b9\u5f0f\u4ee5\u53ca\u5b83\u4eec\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u7684\u5730\u65b9\uff1a\u201cRemote &#8211; WSL\u201d\u6269\u5c55\u73b0\u5728\u7b80\u5355\u5730\u53eb\u4f5c\u201cWSL\u201d\u3002\u201cRemote &#8211; Containers\u201d\u6269\u5c55\u91cd\u547d\u540d\u4e3a Dev Containers \u4ee5\u53cd\u6620\u5176\u7528\u4e8e\u521b\u5efa\u5f00\u53d1\u73af\u5883\u7684\u7528\u9014\u3002<\/li>\n<\/ul>\n<h2>\u4ece\u4e00\u4e2a\u5de5\u5177\u5230\u4efb\u4f55\u5730\u65b9\u7684\u96a7\u9053<\/h2>\n<p>\u96a7\u9053\u5b89\u5168\u5730\u5c06\u6570\u636e\u4ece\u4e00\u4e2a\u7f51\u7edc\u4f20\u8f93\u5230\u53e6\u4e00\u4e2a\u7f51\u7edc\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b89\u5168\u96a7\u9053\u4ece VS Code desktop\u6216 Web \u5ba2\u6237\u7aef\u9488\u5bf9\u60a8\u9009\u62e9\u7684\u4efb\u4f55\u673a\u5668\u8fdb\u884c\u5f00\u53d1\uff0c\u800c\u65e0\u9700\u8bbe\u7f6e SSH \u6216 HTTPS\u3002<\/p>\n<p>\u4ece VS Code \u5230\u8fdc\u7a0b\u673a\u5668\u7684\u96a7\u9053\u6709\u4e24\u4e2a\u5f88\u597d\u7684\u9009\u62e9\uff1a\u4f7f\u7528\u65b0\u7684\u589e\u5f3a\u578b code CLI\u3001\u76f4\u63a5\u4ece VS Code UI \u542f\u7528\u96a7\u9053\u3002\u5177\u4f53\u64cd\u4f5c\u65b9\u6cd5\u53ef\u524d\u5f80<a href=\"https:\/\/link.segmentfault.com\/?enc=%2BoqrPn9MpnHEN1o%2FW1LXCw%3D%3D.WX89Rs5opcsWW3X1eCG5X6Ec3TVsGYN6saNGPfZyDy5NT5%2FU71PpBHA76z4jBVyG%2B10O4mclyjxbtoMs7VO4%2BmdP7wWGHyUMPa2FA4YKmKsiViHhRxTYPVnKCuGAI4fr\" rel=\"nofollow\">\u5b98\u65b9\u535a\u5ba2<\/a>\u4e86\u89e3\u3002<\/p>\n<h3>\u901a\u8fc7\u8fdc\u7a0b\u96a7\u9053\u8fde\u63a5<\/h3>\n<p>Remote &#8211; Tunnels \u6269\u5c55\u7ba1\u7406\u672c\u5730\u548c\u8fdc\u7a0b\u8ba1\u7b97\u673a\u4e4b\u95f4\u7684\u8fd9\u4e9b\u5b89\u5168\u96a7\u9053\u3002\u60a8\u901a\u8fc7 code CLI \u6216 VS Code UI \u6253\u5f00\u7684 vscode.dev \u5b9e\u4f8b\u9884\u88c5\u4e86\u8fdc\u7a0b\u96a7\u9053\u6269\u5c55\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5df2\u7ecf\u5728 VS Code \u5ba2\u6237\u7aef\uff08\u684c\u9762\u6216 Web\uff09\u4e2d\u5de5\u4f5c\u5e76\u4e14\u60f3\u8981\u8fde\u63a5\u5230\u8fdc\u7a0b\u96a7\u9053\uff0c\u5219\u53ef\u4ee5\u76f4\u63a5\u5b89\u88c5\u548c\u4f7f\u7528 Remote &#8211; Tunnels \u6269\u5c55\u3002\u5b89\u88c5\u6269\u5c55\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u9762\u677f (F1) \u5e76\u8fd0\u884c\u547d\u4ee4 Remote Tunnels: Connect to Tunnel\u3002\u60a8\u5c06\u80fd\u591f\u8fde\u63a5\u5230\u4efb\u4f55\u5177\u6709\u6d3b\u52a8\u96a7\u9053\u7684\u8fdc\u7a0b\u673a\u5668\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043143367\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u5728 Remote Explorer \u4e2d\u67e5\u770b\u60a8\u7684\u8fdc\u7a0b\u673a\u5668\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4 Remote Explorer: Focus on Remote View \u6253\u5f00\u5b83\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043143368\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<h2>\u8fdc\u7a0b\u5f00\u53d1\u6269\u5c55<\/h2>\n<p>\u968f\u7740\u5bf9\u96a7\u9053\u548c code CLI \u7684\u66f4\u65b0\uff0c\u6211\u4eec\u5bf9\u8fdc\u7a0b\u5f00\u53d1\u6269\u5c55\u8fdb\u884c\u4e86\u4e00\u4e9b\u66f4\u65b0\uff0c\u5141\u8bb8\u60a8\u4f7f\u7528\u5f00\u53d1\u5bb9\u5668\u3001\u8fdc\u7a0b\u8ba1\u7b97\u673a\u6216 WSL \u4f5c\u4e3a\u529f\u80fd\u9f50\u5168\u7684\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<h3>WSL \u548c\u5f00\u53d1\u5bb9\u5668<\/h3>\n<p>\u6211\u4eec\u8ba1\u5212\u8ba9 Remote \u8868\u660e\u60a8\u6b63\u5728\u201c\u8fdc\u7a0b\u201d\u6216\u201c\u5355\u72ec\u201d\u7684 WSL \u53d1\u884c\u7248\u6216\u5f00\u53d1\u5bb9\u5668\u4e2d\u8fdb\u884c\u5f00\u53d1\uff0c\u800c\u4e0d\u662f\u4f20\u7edf\u7684\u672c\u5730\u5f00\u53d1\u3002\u7136\u800c\uff0c\u8fd9\u662f\u4e0e\u8bb8\u591a\u4eba\u4f7f\u7528\u7684\u201c\u8fdc\u7a0b\u201d\u4e0d\u540c\u7684\u7528\u6cd5\uff0c\u5b83\u53ef\u80fd\u4f1a\u5f15\u8d77\u6df7\u6dc6\u3002\u4f8b\u5982\uff0cDev Container \u5728\u6211\u7684\u672c\u5730\u673a\u5668\u4e0a\u5417\uff1f<\/p>\n<p>\u6211\u4eec\u66f4\u65b0\u4e86\u8fd9\u4e9b\u6269\u5c55\u4e2d\u7684\u547d\u540d\u548c\u4ea7\u54c1\u5185\u547d\u4ee4\uff0c\u4f7f\u5176\u66f4\u6e05\u6670\uff0c\u5c06\u5b83\u4eec\u91cd\u547d\u540d\u4e3a WSL \u548c Dev Containers\u3002Marketplace \u548c\u6587\u6863\u4e2d\u7684\u6269\u5c55\u6807\u8bc6\u7b26\u7b49\u94fe\u63a5\u4fdd\u6301\u4e0d\u53d8\uff0c\u56e0\u6b64\u60a8\u5f53\u524d\u5bf9\u8fd9\u4e24\u4e2a\u6269\u5c55\u7684\u4f7f\u7528\u5e94\u8be5\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043143369\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043143370\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<h3>\u8fdc\u7a0b\u96a7\u9053<\/h3>\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 Remote &#8211; Tunnels \u6269\u5c55\u901a\u8fc7\u5b89\u5168\u96a7\u9053\u8fde\u63a5\u5230\u8fdc\u7a0b\u8ba1\u7b97\u673a\uff0c\u800c\u65e0\u9700 SSH\u3002\u6211\u4eec\u5df2\u5c06\u6269\u5c55\u4ece\u201c\u8fdc\u7a0b\u670d\u52a1\u5668\u201d\u91cd\u547d\u540d\u4e3a\u201c\u8fdc\u7a0b &#8211; \u96a7\u9053\u201d\uff0c\u56e0\u4e3a\u6211\u4eec\u76f8\u4fe1\u8fd9\u66f4\u6e05\u695a\u5730\u8868\u660e\u4e86\u5b83\u7684\u884c\u4e3a\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043143371\" alt=\"\u56fe\u7247\" title=\"\u56fe\u7247\" loading=\"lazy\"><\/p>\n<p>\u591a\u5e74\u6765\uff0c\u6211\u4eec\u5df2\u7ecf\u542c\u5230\u4e86\u60a8\u5bf9\u6211\u4eec\u7684\u8fdc\u7a0b\u4f53\u9a8c\u4ee5\u53ca\u6700\u8fd1\u5bf9 VS Code Server \u7684\u53cd\u9988\uff0c\u975e\u5e38\u611f\u8c22\u60a8\u5206\u4eab\u7ee7\u7eed\u5851\u9020\u6211\u4eec\u4ea7\u54c1\u4f53\u9a8c\u7684\u60f3\u6cd5\u3002<\/p>\n<p>\u5982\u679c\u60a8\u60f3\u66f4\u6df1\u5165\u5730\u4e86\u89e3\u6b64\u535a\u5ba2\u4e2d\u63cf\u8ff0\u7684\u5de5\u5177\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u5173\u4e8e Remote &#8211; Tunnels \u6269\u5c55\u7684<a href=\"https:\/\/link.segmentfault.com\/?enc=4Ma8kqVpSxhfmeRksPqFOA%3D%3D.u%2F0mLqCCp8Tt%2FuFwRnCTH9SsCrzmvWSG%2B745OCFtjGrhwcAyoBJ4ULP8WNW1kfEMOdik%2Fdhquh0AqDjUZkXQtkkjOHrEN4ZI8x4jVWIaNYo%3D\" rel=\"nofollow\">\u4e3b\u9898<\/a>\uff0c\u540c\u65f6\u66f4\u65b0\u4e86 <a href=\"https:\/\/link.segmentfault.com\/?enc=nhPJTyYqzDtGuWhGM8SruQ%3D%3D.AmTbvPUbgYgo6iG%2BWfOrHRX4NkAM5d3ahcn01XHrHR2goKHu4CwUyETTA3IJ8e3kIq99rMXMWbA%2FhKS1uT4D%2Fm4%2B1QuZHMk8rw2FYiZG6PI%3D\" rel=\"nofollow\">VS Code Server<\/a> \u548c code <a href=\"https:\/\/link.segmentfault.com\/?enc=Ta9%2BM6z912VaNDI2duIzMw%3D%3D.6%2BtvtyziZs7J%2B4ybQnk5ZDngnsEgKW7g4idJYn%2FYfICAc5XDRToK2NKiGlPqSoa4FLwi48OyzF79P1iQvIaIz3PKmKOBgkwPf9H2uNiKa2U%3D\" rel=\"nofollow\">CLI<\/a> \u6587\u6863\u4ee5\u53cd\u6620\u6700\u65b0\u7684\u53d8\u5316\u3002<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=qol5zBlxClWr6UCNGDcYrA%3D%3D.0pZKHm8TvocShpZaS73bMsX%2FPS3xxPO6RSWjg3qpDSoaMvotkS75CwuCPik3h4r0KyNwJrrGgWRB3oHK9ctuZZ6hRU%2FuQ7pwl3wwvX8eLNB1UlFmbeuIQcbKqB6f33io\" rel=\"nofollow\">\u6b22\u8fce\u524d\u5f80\u5b98\u65b9\u535a\u5ba2\uff0c\u83b7\u53d6\u5b8c\u6574\u5185\u5bb9\u4ecb\u7ecd\uff01<\/a><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043143363\">https:\/\/segmentfault.com\/a\/1190000043143363<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visual Studio Code \u7684\u6838\u5fc3\u662f\u4e00\u4e2a\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u5b83\u901a\u8fc7\u6211\u4eec\u7684\u8fdc\u7a0b\u5f00\u53d1\u7ecf\u9a8c\u4e0e\u5176\u4ed6\u73af\u5883\u96c6\u6210\uff0c\u53d8\u5f97\u66f4\u52a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10007003","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10007003"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007003\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10007003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10007003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10007003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}