{"id":10008223,"date":"2023-09-04T11:59:36","date_gmt":"2023-09-04T03:59:36","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008223"},"modified":"2023-09-04T11:59:36","modified_gmt":"2023-09-04T03:59:36","slug":"%e4%bb%8e%e5%b0%8f%e7%99%bd%e5%88%b0%e5%a4%a7%e7%99%bd-%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91-vscode-%e6%8f%92%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008223","title":{"rendered":"\u4ece\u5c0f\u767d\u5230\u5927\u767d \u2014 \u5982\u4f55\u5f00\u53d1 VSCode \u63d2\u4ef6"},"content":{"rendered":"<h2>\u524d\u8a00<\/h2>\n<blockquote><p><strong>\u6b22\u8fce\u5173\u6ce8\u540c\u540d\u516c\u4f17\u53f7\u300a<code>\u718a\u7684\u732b<\/code>\u300b\uff0c\u6587\u7ae0\u4f1a\u540c\u6b65\u66f4\u65b0\uff0c\u4e5f\u53ef\u5feb\u901f\u52a0\u5165\u524d\u7aef\u4ea4\u6d41\u7fa4\uff01<\/strong><\/p><\/blockquote>\n<p>\u7531\u4e8e\u4e4b\u524d\u7684\u56fd\u9645\u5316\u7684\u9879\u76ee\u4e2d\u603b\u662f\u8981\u7edf\u8ba1\u8001\u9879\u76ee\u4e2d\u5f85\u7ffb\u8bd1\u7684\u5185\u5bb9\uff0c\u7136\u540e\u518d\u4ea4\u7531\u4e1a\u52a1\u8fdb\u884c\u7ffb\u8bd1\uff0c\u5982\u679c\u603b\u662f\u4eba\u4e3a\u7edf\u8ba1\u4e0d\u4ec5\u76f8\u5f53\u8017\u8d39\u7cbe\u529b\u548c\u65f6\u95f4\uff0c\u800c\u4e14\u8fd8\u4e0d\u80fd\u4fdd\u8bc1\u662f\u5426\u6709\u9057\u6f0f\uff0c\u56e0\u6b64\u60f3\u901a\u8fc7\u7f16\u5199\u4e00\u4e2a <strong>i18n-helper<\/strong> \u63d2\u4ef6\u6765\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044178508\" alt=\"61CAEA6A.jpg\" title=\"61CAEA6A.jpg\"><\/p>\n<p>\u7136\u800c\uff0c\u5927\u5bb6\u7684\u9700\u6c42\u603b\u662f\u51fa\u5947\u7684\u76f8\u4f3c\uff08<del><strong><code>\u56e0\u4e3a\u5df2\u7ecf\u6709\u5f88\u591a\u7c7b\u4f3c\u7684\u63d2\u4ef6\u5b58\u5728\u4e86<\/code><\/strong><\/del>\uff09\uff0c\u56e0\u6b64\u6ca1\u5fc5\u8981\u91cd\u590d\u9020\u8f6e\u5b50\u4e86\uff0c\u4f46\u662f <strong>\u5982\u4f55\u5f00\u53d1 vscode \u63d2\u4ef6<\/strong> \u7684\u8fc7\u7a0b\u53ef\u4ee5\u8bb0\u5f55\u4e0b\u6765\uff0c\u5206\u4eab\u7ed9\u5927\u5bb6\uff01<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044178509\" alt=\"61D26DD1.png\" title=\"61D26DD1.png\" loading=\"lazy\"><\/p>\n<p><strong>\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\uff01\uff01<\/strong><\/p>\n<h2>\u8dd1\u901a\u5b98\u65b9\u63d2\u4ef6\u793a\u4f8b<\/h2>\n<p>\u597d\u4e86\uff0c\u8bdd\u4e0d\u591a\u8bf4\uff0c\u6211\u4eec\u5148\u6309\u7740 <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=ehDrabDEW9gaKmbpHmdLNQ%3D%3D.T%2FdFQimk2poOmbsV9aDebXouNgcrGd1d3asoZMktnmDIeeqWUZf8Tslb6PQyy4CZD3U7upe%2FfGqKPfuF0J3W2ymK1XShk5KLvnEf0tuV%2BI8%3D\" rel=\"noopener noreferrer\"><strong>\u5b98\u65b9\u6587\u6863<\/strong><\/a> \u8dd1\u4e00\u4e0b\u5b83\u7684\u63d2\u4ef6\u7528\u4f8b\u5427\uff01<\/p>\n<h3>\u751f\u6210\u63d2\u4ef6\u76ee\u5f55<\/h3>\n<h4>\u5b89\u88c5\u811a\u624b\u67b6<\/h4>\n<p><strong><code>npm install -g yo generator-code<\/code><\/strong><\/p>\n<h4>\u521d\u59cb\u5316\u63d2\u4ef6\u76ee\u5f55<\/h4>\n<p>\u7ec8\u7aef\u8fd0\u884c <strong><code>yo code<\/code><\/strong>\uff0c\u6309\u7167\u63d0\u793a\u751f\u6210\u76ee\u5f55\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"688\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wYX\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>\u8c03\u8bd5\u63d2\u4ef6<\/h3>\n<p>\u7531\u4e8e\u5b98\u65b9\u6587\u6863\u7f3a\u5c11\u4e00\u4e9b\u7ec6\u8282\uff0c\u5f88\u5bb9\u6613\u5bfc\u81f4\u5c0f\u767d\u8c03\u8bd5\u63d2\u4ef6\u5931\u8d25\uff0c\u518d\u5e38\u89c1\u7684\u6709\u5982\u4e0b\u60c5\u51b5\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044178510\" alt=\"65A8CB59.gif\" title=\"65A8CB59.gif\" loading=\"lazy\"><\/p>\n<h4>\u627e\u4e0d\u5230 Hello World \u547d\u4ee4<\/h4>\n<p>\u8fdb\u5165\u5bf9\u5e94\u9879\u76ee\u76ee\u5f55\u540e\uff0c\u6309\u7167\u5b98\u65b9\u6587\u6863\u7684\u6307\u793a\u53ef\u901a\u8fc7\u5982\u4e0b\u4e24\u79cd\u65b9\u5f0f\u8fdb\u884c\u8c03\u8bd5\uff1a<\/p>\n<ul>\n<li><strong>\u6309\u5feb\u6377\u952e F5<\/strong><\/li>\n<li>\n<p><strong>\u70b9\u51fb\u7f16\u8f91\u5668\u5de6\u4e0b\u65b9\u7684 <code>Run Extension<\/code><\/strong><\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"223\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wYY\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<\/li>\n<\/ul>\n<p>\u63a5\u7740\u6309\u4e0b <strong>Ctrl + Shift + P<\/strong>\uff0c\u5e76\u8f93\u5165 <strong><code>Hello World<\/code><\/strong> \u547d\u4ee4\uff0c\u53d1\u73b0\u65e0\u6cd5\u627e\u5230\u5bf9\u5e94\u7684\u547d\u4ee4\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"82\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wY4\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h5>\u8fd9\u4e2a\u539f\u56e0\u4e3b\u8981\u662f\u56e0\u4e3a vscode \u7248\u672c\u4e0d\u4e00\u81f4\u9020\u6210\u7684\uff1a<\/h5>\n<ul>\n<li>\n<p><strong>package.json<\/strong> \u6587\u4ef6\u4e2d\u6307\u5b9a\u7684 <strong>vscode<\/strong> \u7248\u672c\u53f7<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"624\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wY5\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<\/li>\n<li>\n<p>\u5f53\u524d\u5b9e\u9645\u7684 <strong>vscode<\/strong> \u7248\u672c\u53f7\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"464\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZa\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h5>\u89e3\u51b3\u65b9\u6848\u81ea\u7136\u5c31\u662f\u4fdd\u6301\u7248\u672c\u7684\u4e00\u81f4\u6027<\/h5>\n<\/li>\n<li>\n<p>\u5347\u7ea7 <strong>vscode<\/strong> \u7248\u672c<\/p>\n<ul>\n<li>\u9002\u7528\u4e8e\u5f53\u524d\u7248\u672c\u53f7\u4f4e\u4e8e <strong>package.json<\/strong> \u6587\u4ef6\u4e2d\u6307\u5b9a\u7684\u7248\u672c\u53f7<\/li>\n<li>\n<p><strong><code>\u3010\u6ce8\u610f\u3011<\/code><\/strong> \u73b0\u5728 <strong>vscode<\/strong> \u7248\u672c\u7684\u66f4\u65b0\u6a21\u578b\u5df2\u7ecf\u8c03\u6574\u4e3a <strong>\u201c\u9ed8\u8ba4\u201d<\/strong> \u6a21\u5f0f\uff0c\u6240\u4ee5\u73b0\u5728\u4e0d\u4f1a\u6536\u5230 <strong>vscode<\/strong> \u9700\u8981\u66f4\u65b0\u7684\u4fe1\u606f\uff0c\u4e5f\u65e0\u6cd5\u8fdb\u884c\u901a\u8fc7 <strong>\u201c\u68c0\u67e5\u66f4\u65b0\u201d<\/strong> \u6309\u94ae\u6765\u8fdb\u884c\u66f4\u65b0<\/p>\n<p>!<img decoding=\"async\" width=\"723\" height=\"189\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZd\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4fee\u6539 <strong>package.json<\/strong> \u6587\u4ef6\u4e2d\u7684 <strong>vscode<\/strong> \u5bf9\u5e94\u7248\u672c\u53f7<\/p>\n<ul>\n<li>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u8f83\u7b80\u5355\u76f4\u63a5\uff0c\u5c31\u662f\u4fee\u6539\u4e3a\u548c\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u7684 <strong>vscode<\/strong> \u7248\u672c\u4fdd\u6301\u4e00\u81f4\u5373\u53ef\uff0c\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"459\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZe\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>Hello World \u547d\u4ee4\u62a5\u9519<\/h4>\n<p>\u7ecf\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\u540e\uff0c\u91cd\u65b0\u542f\u52a8\u8c03\u8bd5\uff0c\u6309\u4e0b <strong>Ctrl + Shift + P<\/strong>\uff0c\u5e76\u8f93\u5165 <strong><code>Hello World<\/code><\/strong> \u547d\u4ee4\uff0c\u5c31\u53ef\u4ee5\u627e\u5230\u5bf9\u5e94\u7684\u547d\u4ee4\u4e86\uff0c\u4f46\u662f\u6267\u884c\u8be5\u547d\u4ee4\u65f6\u62a5\u9519\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"327\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZh\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u539f\u56e0\u5c31\u5728\u4e8e\u6211\u4eec\u6ca1\u6709\u7f16\u8bd1\u6587\u4ef6\uff0c\u6b64\u65f6\u6ce8\u610f\u67e5\u770b <strong><code>package.json<\/code><\/strong> \u6587\u4ef6\u4e2d\u7684 <strong><code>main<\/code><\/strong> \u5b57\u6bb5\u4f1a\u53d1\u73b0\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"455\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZi\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u5f88\u660e\u663e\uff0c\u6211\u4eec\u6ca1\u6709\u7f16\u8bd1\u6e90\u6587\u4ef6\u751f\u6210\u76ee\u6807\u6587\u4ef6\uff0c\u6b64\u65f6\u6211\u4eec\u53ea\u9700\u8981\u901a\u8fc7 <strong><code>npm run watch<\/code><\/strong> \u542f\u7528\u76d1\u542c\u6a21\u5f0f\uff0c\u8ba9\u5176\u8fdb\u884c\u7f16\u8bd1\u5373\u53ef\uff1a<\/p>\n<p><img decoding=\"async\" width=\"552\" height=\"419\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZq\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u6b64\u65f6\u5728\u6267\u884c\u547d\u4ee4\uff0c\u5c31\u4f1a\u53d1\u73b0\u6210\u529f\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"110\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZr\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u3010\u5b9e\u6218\u3011\u7f16\u5199 VSCode \u63d2\u4ef6<\/h2>\n<h3>\u63d2\u4ef6\u7684\u4e09\u4e2a\u6982\u5ff5<\/h3>\n<ul>\n<li>\n<p><strong>\u6fc0\u6d3b\u4e8b\u4ef6<\/strong>\uff08\u9488\u5bf9 <strong>V1.74.0<\/strong> \u4e4b\u524d\u7684 <strong>VSCode<\/strong> \u7248\u672c\uff09<\/p>\n<ul>\n<li>\u5373\u63d2\u4ef6\u6fc0\u6d3b\u7684\u65f6\u673a\uff0c\u76ee\u7684\u662f\u652f\u6301\u7528\u6237\u5728\u8f93\u5165 <strong><code>Hello World<\/code><\/strong> \u547d\u4ee4\u540e\u80fd\u591f\u6fc0\u6d3b\u63d2\u4ef6<\/li>\n<li>\u4f8b\u5982\uff0c\u4f7f\u7528 <strong><code>onCommand<\/code><\/strong> \u8fdb\u884c\u6ce8\u518c <strong><code>onCommand:extension.helloWorld<\/code><\/strong><br \/>  <img decoding=\"async\" width=\"723\" height=\"157\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZH\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u53d1\u5e03\u5185\u5bb9\u914d\u7f6e<\/strong><\/p>\n<ul>\n<li><strong>VS Code<\/strong> \u901a\u8fc7\u00a0<strong><code>package.json<\/code><\/strong>\u00a0\u8fdb\u884c\u6269\u5c55\uff0c\u901a\u8fc7\u914d\u7f6e <strong>\u63d2\u4ef6\u6e05\u5355\u5b57\u6bb5<\/strong> \u4fbf\u4e8e\u5f00\u53d1\u63d2\u4ef6<\/li>\n<li>\u4f8b\u5982\uff0c\u4f7f\u7528 <strong><code>contributes.commands<\/code><\/strong> \u7ed1\u5b9a\u4e00\u4e2a <strong>\u547d\u4ee4 ID\u00a0<code>extension.helloWorld<\/code><\/strong>\uff0c\u76ee\u7684\u662f\u8ba9\u00a0<strong><code>Hello World<\/code><\/strong> \u547d\u4ee4\u5c31\u53ef\u4ee5\u5728\u547d\u4ee4\u9762\u677f\u4e2d\u5339\u914d\u5230\u7b49<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>VS Code API<\/strong><\/p>\n<ul>\n<li>\u63d2\u4ef6\u4ee3\u7801\u4e2d\u9700\u8981\u8c03\u7528\u7684\u4e00\u7cfb\u5217 <strong>JavaScript API<\/strong> \u4f7f\u7528 <strong>VS Code<\/strong> \u7684\u4e00\u4e9b\u529f\u80fd\u7279\u6027<\/li>\n<li>\u4f8b\u5982\uff0c\u901a\u8fc7 <strong><code>vscode.commands.registerCommand<\/code><\/strong> \u5c06\u4e00\u4e2a\u51fd\u6570\u7ed1\u5b9a\u5230\u5bf9\u5e94\u7684 <strong>\u547d\u4ee4 ID <code>extension.helloWorld<\/code><\/strong> \u4e0a\uff0c\u6fc0\u6d3b\u547d\u4ee4\u65f6\u6267\u884c\u7684\u5c31\u662f\u8be5\u51fd\u6570\u7b49<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u76ee\u5f55\u7ed3\u6784\u6bd4\u8f83\u7b80\u5355\u5c31\u4e0d\u8fc7\u591a\u4ecb\u7ecd\u4e86\u3002<\/p>\n<h3>\u5728 VSCode \u4e2d\u9884\u89c8 SVG \u6587\u4ef6 \u2014 <strong><code>&lt;img \/&gt;<\/code> \u6807\u7b7e\u9884\u89c8<\/strong><\/h3>\n<p>\u5f53\u7136\u76f8\u5173\u7684 <strong>svg<\/strong> \u63d2\u4ef6\u5df2\u7ecf\u6709\u4e0d\u5c11\u4e86\uff0c\u8fd9\u91cc\u53ea\u662f\u7528\u8fd9\u4e2a\u7b80\u5355\u7684\u9700\u6c42\u6765\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u65b9\u4fbf\u8ba9\u5927\u5bb6\u66f4\u5bb9\u6613\u7406\u89e3\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044178511\" alt=\"6BFE0B63.gif\" title=\"6BFE0B63.gif\" loading=\"lazy\"><\/p>\n<h4>SVG \u6587\u4ef6\u5728 VSCode \u4e2d\u7684\u539f\u59cb\u5c55\u793a\u6548\u679c<\/h4>\n<p><img decoding=\"async\" width=\"723\" height=\"150\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZU\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>\u53d1\u5e03\u5185\u5bb9\u914d\u7f6e \u2014 package.json \u6587\u4ef6<\/h4>\n<h5>\u9762\u5411\u7528\u6237\u7684\u547d\u4ee4<\/h5>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u8981\u6ce8\u518c\u547d\u4ee4\uff0c\u8ba9\u7528\u6237\u80fd\u591f\u4f7f\u7528\u6211\u4eec\u7684\u63d2\u4ef6\uff0c\u8fd9\u91cc\u6211\u4eec\u5c31\u7b80\u5355\u652f\u6301\u5982\u4e0b\u4e24\u79cd\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li>\n<p><strong>Ctrl + Shift + P \u5339\u914d\u547d\u4ee4<\/strong><\/p>\n<ul>\n<li>\n<p>\u53ea\u9700\u8981\u5728 <strong>package.json<\/strong> \u4e2d\u7684 <strong><code>contributes.commands<\/code><\/strong> \u8fdb\u884c\u5982\u4e0b\u914d\u7f6e\u5373\u53ef\uff0c\u8be6\u60c5\u53ef\u89c1 <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=NJzDHeAbHXKRrV0BO6RAIA%3D%3D.DUY9Az%2B0XNIwrtbLuqU3pp8Ieh%2B878BiO4bnf9%2BkIGXUm5hkf27vw86xM%2BciZgyLGZMgTeYjLJ6kMnc2GBVMxgrVE1QVXmYC8YIcrjHoB%2FYpl9OKDSKhlvcSQrR%2BzAu3\" rel=\"noopener noreferrer\"><strong>contributes.commands<\/strong><\/a><\/p>\n<pre><code class=\"js\">&quot;contributes&quot;: {\n    &quot;commands&quot;: [\n          {\n            &quot;command&quot;: &quot;svg-viewer.previewsvg&quot;,\n            &quot;title&quot;: &quot;Preview SVG&quot;\n          }\n     ]\n}<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9f20\u6807\u53f3\u952e\u83dc\u5355\u9009\u62e9\u547d\u4ee4<\/strong><\/p>\n<ul>\n<li>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u76f8\u5bf9\u4e8e\u4e0a\u9762\u7684\u65b9\u5f0f\u6765\u8bb2\u66f4\u7b80\u4fbf\uff0c\u53ea\u9700\u8981\u5728 <strong>package.json<\/strong> \u4e2d\u7684 <strong><code>contributes.menus<\/code><\/strong> \u8fdb\u884c\u5982\u4e0b\u914d\u7f6e\u5373\u53ef\uff0c\u8be6\u60c5\u53ef\u89c1 <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=yrzpBx32izdWtIboQ8KWaA%3D%3D.9mOU%2Bc3ix3MBrEtVf1TQdVaIW0d9li3PC%2BEM5iZmK0Dd%2Fo%2BLiSnRJ3LjTfkPd5WuWgriM%2Bo4n%2FyTLWweBH9pNgbsJnjZoa4uFad0Pmpq0QmGVH7kk9wbp0S3NhgRlqvA\" rel=\"noopener noreferrer\"><strong>contributes.menus<\/strong><\/a><\/p>\n<pre><code class=\"js\">&quot;contributes&quot;: {\n    &quot;menus&quot;: {\n      &quot;editor\/context&quot;: [\n        {\n          &quot;command&quot;: &quot;svg-viewer.previewsvg&quot;\n        }\n      ]\n}<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>\u4e0a\u8ff0 <strong>\u9f20\u6807\u53f3\u952e\u83dc\u5355\u9009\u62e9\u547d\u4ee4<\/strong> \u7684\u914d\u7f6e\u6709\u4e00\u70b9\u4e0d\u597d\uff0c\u90a3\u5c31\u662f\u5b89\u88c5\u6b64\u63d2\u4ef6\u540e\uff0c\u5728\u4efb\u4f55\u6587\u4ef6\u4e2d\u53f3\u952e\u90fd\u4f1a\u663e\u793a <strong>Preview SVG<\/strong> \u9009\u9879\uff0c\u6b64\u65f6 <strong>\u8c03\u8bd5\u6548\u679c\u5982\u4e0b\uff1a<\/strong><\/p>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" width=\"723\" height=\"574\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZY\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"915\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZ2\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u56e0\u4e3a\u6211\u4eec\u7684\u672c\u610f\u662f\u9884\u89c8 <strong>SVG<\/strong> \u6587\u4ef6\uff0c\u800c\u4e0d\u662f\u5176\u4ed6\u6587\u4ef6\uff0c\u56e0\u6b64\u5bf9\u4e8e\u4e0d\u7b26\u5408\u7684\u6587\u4ef6\u5c31\u6ca1\u6709\u5fc5\u8981\u5c55\u793a\u6b64\u9009\u9879\u4e86\uff0c\u6b64\u65f6\u53ef\u4ee5\u901a\u8fc7 <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=YT7JylTbdrpcgky6f1Bi%2BA%3D%3D.4%2FkRyyXC7uKJjEVgws62lvsogH1x6GTcWFEu6SATE2VGkPGk6p9sHM8YgugLWnA5XN9UzXgXMH3flaoqQu4PYXPZEVqwv8Me4i3qYH3JYK8%3D\" rel=\"noopener noreferrer\"><strong>when \u5b50\u53e5\u4e0a\u4e0b\u6587<\/strong><\/a> \u6765\u63a7\u5236\u663e\u793a\u9690\u85cf\u547d\u4ee4\u9009\u9879\uff0c\u6b64\u65f6\u914d\u7f6e\u66f4\u6539\u4e3a\uff1a<\/p>\n<pre><code class=\"js\">&quot;contributes&quot;: {\n    &quot;menus&quot;: {\n      &quot;editor\/context&quot;: [\n        {\n          &quot;command&quot;: &quot;svg-viewer.previewsvg&quot;,\n          &quot;when&quot;: &quot;resourceExtname == '.svg'&quot;\n        }\n      ]\n}<\/code><\/pre>\n<p><strong>\u8c03\u8bd5\u6548\u679c\u5982\u4e0b\uff1a<\/strong><\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"627\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZ5\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"796\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZ7\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4><strong>\u4f7f\u7528 VSCode API<\/strong><\/h4>\n<h5>\u6ce8\u518c\u547d\u4ee4<\/h5>\n<p>\u4e0a\u8ff0\u6211\u4eec\u914d\u7f6e\u597d\u4e86\u547d\u4ee4\uff0c\u73b0\u5728\u5c31\u9700\u8981\u6ce8\u518c\u547d\u4ee4\u4e86\uff0c\u4e5f\u5c31\u662f\u51b3\u5b9a\u5f53\u547d\u4ee4\u6fc0\u6d3b\u65f6\u9700\u8981\u505a\u4e9b\u4ec0\u4e48\u4e8b\u60c5\uff0c\u5373\u53ea\u9700\u8981\u5728 <strong>extension.ts<\/strong> \u6587\u4ef6\u7684 <strong>activate<\/strong> \u65b9\u6cd5\u4e2d\u505a\u5982\u4e0b\u4fee\u6539\u5373\u53ef\uff1a<\/p>\n<pre><code class=\"js\">\/\/ \u6267\u884c\u547d\u4ee4\u65f6\u88ab\u6fc0\u6d3b\nexport function activate(context: vscode.ExtensionContext) {\n  \/\/ \u4f7f\u7528\u63a7\u5236\u53f0\u8f93\u51fa\u8bca\u65ad\u4fe1\u606f(console.log)\u548c\u9519\u8bef(console.error)\n  \/\/ \u8fd9\u884c\u4ee3\u7801\u53ea\u4f1a\u5728\u4f60\u7684\u6269\u5c55\u88ab\u6fc0\u6d3b\u65f6\u6267\u884c\u4e00\u6b21\n  console.log('Congratulations, your extension &quot;svg-viewer&quot; is now active!');\n\n  \/\/ \u6ce8\u518c\u547d\u4ee4\uff0ccommandId \u53c2\u6570\u5fc5\u987b\u4e0e package.json \u4e2d\u7684 command \u5b57\u6bb5\u5339\u914d\n  let disposable = vscode.commands.registerCommand(\n    &quot;svg-viewer.previewsvg&quot;,\n    () =&gt; {\n      \/\/ \u5177\u4f53\u8981\u505a\u7684\u5185\u5bb9\n    }\n  );\n\n  context.subscriptions.push(disposable);\n}<\/code><\/pre>\n<h5>\u4f7f\u7528 Webview<\/h5>\n<p>\u5e73\u65f6\u6211\u4eec\u901a\u8fc7\u6d4f\u89c8\u5668\u4f7f\u7528 <strong><code>&lt;img&gt;<\/code><\/strong> \u6807\u7b7e\u53ef\u4ee5\u67e5\u770b <strong>svg<\/strong> \u6587\u4ef6\u7684\u6548\u679c\uff0c\u4f8b\u5982\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"891\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9wZ9\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u90a3\u4e48\u5728 <strong>VSCode<\/strong> \u4e2d\u53ef\u4e0d\u53ef\u4ee5\u4e5f\u4ee5\u8fd9\u6837\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u5462\uff1f<\/p>\n<p>\u90a3\u5f53\u7136\u662f\u53ef\u4ee5\u7684\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u4ee3\u7801\u7f16\u8f91\u5668\u4e2d\u521b\u5efa\u4e00\u4e2a <strong>Webview<\/strong> \uff0c\u7136\u540e\u5176\u4e2d\u7684 <strong>html<\/strong> \u9009\u9879\u5185\u5bb9\u5c31\u53ef\u4ee5\u7528\u6211\u4eec\u5e38\u89c1\u7684 <strong>html \u7ed3\u6784<\/strong> \u6765\u586b\u5145\uff0c\u5e76\u4f5c\u4e3a\u6700\u7ec8\u7ed3\u679c\u6765\u8fdb\u884c <strong>\u6e32\u67d3<\/strong>\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code class=\"js\">  \/\/ \u521b\u5efa\u5e76\u663e\u793a\u65b0\u7684 webview\n  const panel = vscode.window.createWebviewPanel(\n    &quot;SVGPreview&quot;, \/\/ \u53ea\u4f9b\u5185\u90e8\u4f7f\u7528\uff0c\u5373 webview \u7684\u6807\u8bc6\n    &quot;SVG Preview&quot;, \/\/ \u9762\u677f\u6807\u9898\n    vscode.ViewColumn.One, \/\/ \u7ed9\u65b0\u7684 webview \u9762\u677f\u4e00\u4e2a\u7f16\u8f91\u5668\u89c6\u56fe\n    {} \/\/ Webview \u9009\u9879\n  );\n\n  \/\/ \u8bbe\u7f6eHTML\u5185\u5bb9\n  panel.webview.html = `&lt;!DOCTYPE html&gt;\n    &lt;html lang=&quot;en&quot;&gt;\n      &lt;head&gt;\n        &lt;meta charset=&quot;UTF-8&quot; \/&gt;\n        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; \/&gt;\n        &lt;title&gt;SVG Preview&lt;\/title&gt;\n      &lt;\/head&gt;\n      &lt;body&gt;\n        &lt;img src=&quot;${\u76ee\u6807\u6587\u4ef6\u5730\u5740}&quot; \/&gt;\n      &lt;\/body&gt;\n    &lt;\/html&gt;\n    `;<\/code><\/pre>\n<h5>\u83b7\u53d6\u76ee\u6807\u6587\u4ef6\u7684 base64 \u683c\u5f0f<\/h5>\n<p>\u7531\u4e8e\u6211\u4eec\u6253\u5f00\u76f8\u5e94 <strong>svg<\/strong> \u6587\u4ef6\u540e\u53f3\u952e\u8fdb\u884c\u9884\u89c8\uff0c\u90a3\u4e48\u7b2c\u4e00\u6b65\u5c31\u5f97\u5148\u83b7\u53d6\u5f53\u524d\u8fd9\u4e2a\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u8fd9\u5c31\u53c8\u5f97\u9700\u8981\u4f7f\u7528\u7684 <strong>VSCode API<\/strong> \u4e86\uff0c\u5982\u4e0b<\/p>\n<pre><code class=\"js\"> const editor = vscode.window.activeTextEditor;\n let url = editor.document.fileName; \/\/ \u83b7\u53d6\u5230\u7684\u5c31\u662f\u5bf9\u5e94\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84<\/code><\/pre>\n<p><img decoding=\"async\" width=\"723\" height=\"128\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9w0c\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u4f46\u662f\u5982\u679c\u4f60\u76f4\u63a5\u628a\u8fd9\u4e2a\u8def\u5f84\u4f5c\u4e3a <strong><code>&lt;img&gt;<\/code><\/strong> \u6807\u7b7e\u7684 <strong>src<\/strong> \u5c5e\u6027\u662f\u6ca1\u6cd5\u6ca1\u6b63\u5e38\u6e32\u67d3\u7684\uff0c\u5927\u81f4\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" width=\"524\" height=\"234\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9w1q\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u65e2\u7136\u5982\u6b64\uff0c\u90a3\u4e48\u6211\u4eec\u53ef\u4ee5\u628a\u8fd9\u4e2a <strong>svg<\/strong> \u6587\u4ef6\u8bfb\u53d6\u5230\uff0c\u7136\u540e\u628a\u5b83\u8f6c\u6210 <strong>base64<\/strong> \u7684\u683c\u5f0f\uff0c\u518d\u4ea4\u7531 <strong><code>&lt;img&gt;<\/code><\/strong> \u6807\u7b7e\u4f7f\u7528\u5373\u53ef\uff0c\u6b64\u65f6\u6211\u4eec\u5c31\u9700\u8981\u4f7f\u7528\u5230 <strong>node<\/strong> \u5185\u7f6e\u7684 <strong>fs<\/strong> \u6a21\u5757\u4e86\uff0c\u5373\uff1a<\/p>\n<pre><code class=\"js\">  const fs = require(&quot;fs&quot;);\n  const content = fs.readFileSync(url);\n  return `data:image\/svg+xml;base64,${content.toString(&quot;base64&quot;)}`;<\/code><\/pre>\n<h4>\u6e90\u4ee3\u7801 &#038; \u6548\u679c\u5c55\u793a<\/h4>\n<p>\u9700\u8981\u67e5\u770b\u6e90\u7801\u7684\u53ef\u70b9\u6b64\u83b7\u53d6\uff1a<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=E37KsgyZs2KgMrdAB%2FpN9A%3D%3D.iP5SfLwMpMHL5x7jRBn7KD4enpdpteKWrU61eccvrgbrBXOfuGz%2BFFOfhENO8IEW\" rel=\"noopener noreferrer\"><strong>\u6e90\u4ee3\u7801<\/strong><\/a><\/p>\n<p>\u7ecf\u8fc7\u4e0a\u8ff0\u7684\u5904\u7406\u6211\u4eec\u5c31\u53ef\u4ee5\u5728 <strong>VSCode<\/strong> \u4e2d\u9884\u89c8 <strong>svg<\/strong> \u6587\u4ef6\u4e86\uff0c\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"539\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9w0r\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>\u5728 VSCode \u4e2d\u9884\u89c8 SVG \u6587\u4ef6 \u2014 <strong><code>&lt;svg&gt;<\/code> \u6807\u7b7e\u9884\u89c8<\/strong><\/h3>\n<p>\u4e0a\u8ff0\u65b9\u6848\u867d\u7136\u53ef\u4ee5\u5b9e\u73b0\u6211\u4eec\u9700\u8981\u7684\u529f\u80fd\uff0c\u4f46\u662f\u5bf9\u4e8e <strong>svg<\/strong> \u6587\u4ef6\u6765\u8bb2\u8fd8\u662f\u590d\u6742\u4e86\uff0c\u56e0\u4e3a\u5728\u6d4f\u89c8\u5176\u4e2d\u662f\u53ef\u4ee5\u76f4\u63a5\u6e32\u67d3 <code>&lt;svg&gt;<\/code> \u6807\u7b7e\u7684\uff0c\u800c <strong>svg<\/strong> \u6587\u4ef6\u7684\u5185\u5bb9\u4e0d\u5c31\u662f <code>&lt;svg&gt;<\/code> \u6807\u7b7e\u5417\uff0c\u90a3\u4e48\u6211\u4eec\u53ea\u9700\u8981\u628a\u6587\u4ef6\u5185\u5bb9\u8bfb\u53d6\u51fa\u6765\uff0c\u76f4\u63a5\u586b\u5145\u5230 <strong>webview.html<\/strong> \u4e2d\u5c31\u597d\u4e86\uff0c\u6839\u672c\u4e0d\u9700\u8981\u8f6c\u6210 <strong>base64<\/strong> \u683c\u5f0f\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044178513\" alt=\"6C15313B.gif\" title=\"6C15313B.gif\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u4e2a\u65b9\u6848\u6bd4\u8f83\u7b80\u5355\uff0c\u8fd9\u91cc\u76f4\u63a5\u8d34\u51fa <strong>extension.ts<\/strong> \u6587\u4ef6\u4e2d\u7684\u4ee3\u7801\u4e86\uff1a<\/p>\n<pre><code class=\"js\">import * as vscode from &quot;vscode&quot;;\n\n\/\/ \u6267\u884c\u547d\u4ee4\u65f6\u88ab\u6fc0\u6d3b\nexport function activate(context: vscode.ExtensionContext) {\n  const fs = require(&quot;fs&quot;);\n\n  \/\/ \u6ce8\u518c\u547d\u4ee4\uff0ccommandId \u53c2\u6570\u5fc5\u987b\u4e0e package.json \u4e2d\u7684 command \u5b57\u6bb5\u5339\u914d\n  let disposable = vscode.commands.registerCommand(\n    &quot;svg-viewer.previewsvg&quot;,\n    () =&gt; {\n      const url = getActiveTextUrl();\n      const content = fs.readFileSync(url, &quot;utf-8&quot;);\n      opedWebview(content);\n    }\n  );\n\n  context.subscriptions.push(disposable);\n}\n\n\/\/ \u83b7\u53d6\u5f53\u524d\u6587\u4ef6\u8def\u5f84\nexport function getActiveTextUrl(): string {\n  let url = &quot;&quot;;\n  const editor = vscode.window.activeTextEditor;\n\n  if (editor) {\n    url = editor.document.fileName;\n  }\n\n  return url;\n}\n\n\/\/ \u521b\u5efa\u5e76\u663e\u793a\u65b0\u7684 webview\nexport function opedWebview(content: string) {\n  const panel = vscode.window.createWebviewPanel(\n    &quot;SVGPreview&quot;, \/\/ \u53ea\u4f9b\u5185\u90e8\u4f7f\u7528\uff0c\u5373 webview \u7684\u6807\u8bc6\n    &quot;SVG Preview&quot;, \/\/ \u9762\u677f\u6807\u9898\n    vscode.ViewColumn.One, \/\/ \u7ed9\u65b0\u7684 webview \u9762\u677f\u4e00\u4e2a\u7f16\u8f91\u5668\u89c6\u56fe\n    {} \/\/ Webview \u9009\u9879\n  );\n\n  \/\/ \u8bbe\u7f6eHTML\u5185\u5bb9\n  panel.webview.html = getWebviewContent(content);\n}\n\n\/\/ \u6e32\u67d3\u6a21\u7248\nexport function getWebviewContent(content: string) {\n  return `&lt;!DOCTYPE html&gt;\n    &lt;html lang=&quot;en&quot;&gt;\n      &lt;head&gt;\n        &lt;meta charset=&quot;UTF-8&quot; \/&gt;\n        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; \/&gt;\n        &lt;title&gt;SVG Preview&lt;\/title&gt;\n        &lt;style&gt;\n          html,\n          body {\n            width: 100%;\n            height: 100%;\n          }\n          body {\n            display: flex;\n            justify-content: center;\n            align-items: center;\n          }\n          svg {\n            max-height: 90%;\n          }\n        &lt;\/style&gt;\n      &lt;\/head&gt;\n      &lt;body&gt;\n        ${content}\n      &lt;\/body&gt;\n    &lt;\/html&gt;\n    `;\n}\n\n\/\/ \u505c\u7528\u547d\u4ee4\u65f6\u6267\u884c\nexport function deactivate() {}<\/code><\/pre>\n<h2>\u53d1\u5e03<\/h2>\n<h3>\u53d1\u5e03\u5230\u5b98\u7f51\u5e94\u7528\u5e02\u573a<\/h3>\n<p>\u901a\u8fc7 <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=JbfjjcJ7xDS2Sm4e0sfYOg%3D%3D.hLnhsmlXXU%2BfdPkh2Fw%2FL%2BopS%2FRYyDQgg9jX3fMd0Qj%2FJJI6zuFxJXf0Uhj5XW4q\" rel=\"noopener noreferrer\"><strong>\u8fd9\u4e2a\u5730\u5740<\/strong><\/a> \u6ce8\u518c\u5f00\u53d1\u8005\u8d26\u53f7\uff0c\u7136\u540e\u6309\u63d0\u793a\u53d1\u5e03\u5230\u5b98\u7f51\u5e94\u7528\u5e02\u573a\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"118\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9w0B\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>\u4f7f\u7528 vsce \u6253\u6210 vsix \u63d2\u4ef6<\/h3>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5b9e\u73b0\u5373\u4f7f <strong>\u6ca1\u6709\u53d1\u5e03\u5230\u5e94\u7528\u5e02\u573a<\/strong>\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u5bf9\u5e94\u6587\u4ef6\u7684\u65b9\u5f0f\u8fdb\u884c\u63d2\u4ef6\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u3002<\/p>\n<h4>\u5b89\u88c5 vsce \u5de5\u5177<\/h4>\n<p>\u5b89\u88c5\u547d\u4ee4 <strong><code>npm i vsce -g<\/code><\/strong><\/p>\n<h4>\u6253\u5305\u751f\u6210 .vsix \u6587\u4ef6<\/h4>\n<p>\u76f4\u63a5\u4f7f\u7528 <strong><code>vsce package<\/code><\/strong> \u547d\u4ee4\u8fdb\u884c\u6253\u5305\uff0c\u5b8c\u6210\u540e\u5c31\u4f1a\u751f\u6210\u4e00\u4e2a <strong><code>.vsix<\/code><\/strong> \u6587\u4ef6\uff0c\u8fd9\u4e2a\u4e5f\u5c31\u662f\u5728\u540e\u7eed\u5b89\u88c5\u63d2\u4ef6\u65f6\u8981\u4f7f\u7528\u7684\u6587\u4ef6\u3002<\/p>\n<blockquote><p><strong>\u3010<code>\u6ce8\u610f<\/code>\u3011<\/strong> \u5728\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u6253\u5305\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0 <strong>vsce<\/strong> \u6240\u9700\u8981\u652f\u6301\u7684 <strong>VSCode<\/strong> \u6700\u4f4e\u7248\u672c\u548c\u5f53\u524d\u4f7f\u7528\u7248\u672c\u4e4b\u95f4\u5b58\u5728\u51fa\u5165\uff0c<strong>\u5bfc\u81f4\u6253\u5305\u5931\u8d25<\/strong>\uff1a<br \/><img decoding=\"async\" width=\"723\" height=\"70\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9w0C\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><br \/>\u7279\u522b\u662f\u5982\u679c\u6309\u7167\u524d\u6587\u7684\u65b9\u5f0f\u76f4\u63a5\u4fee\u6539 <strong><code>package.json<\/code><\/strong> \u6587\u4ef6\u4e2d\u7684\u7248\u672c\u53f7\u65f6\uff0c\u6b64\u65f6\u6700\u597d\u8fd8\u662f\u5c06 <strong>VSCode<\/strong> \u7248\u672c\u8fdb\u884c\u5347\u7ea7\uff0c\u800c\u4e0d\u662f\u624b\u52a8\u4fee\u6539\u7248\u672c\u53f7\u3002<\/p><\/blockquote>\n<h4>\u5b89\u88c5 vsix \u63d2\u4ef6<\/h4>\n<p>\u6309\u7167\u5982\u4e0b\u65b9\u5f0f\u64cd\u4f5c\u5e76\u9009\u62e9\u5bf9\u5e94\u7684 <strong><code>.vsix<\/code><\/strong> \u6587\u4ef6\u5373\u53ef.<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"343\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc9w0G\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u6700\u540e<\/h2>\n<blockquote><p><strong>\u6b22\u8fce\u5173\u6ce8\u540c\u540d\u516c\u4f17\u53f7\u300a<code>\u718a\u7684\u732b<\/code>\u300b\uff0c\u6587\u7ae0\u4f1a\u540c\u6b65\u66f4\u65b0\uff0c\u4e5f\u53ef\u5feb\u901f\u52a0\u5165\u524d\u7aef\u4ea4\u6d41\u7fa4\uff01<\/strong><\/p><\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u6587\u4e2d\u6ca1\u6709\u8fc7\u591a\u4ecb\u7ecd\u90a3\u4e9b\u6ca1\u6709\u7528\u5230\u7684\u5185\u5bb9\uff08\u5982 <strong><code>package.json<\/code><\/strong> \u76f8\u5173\u914d\u7f6e\uff09\uff0c\u56e0\u4e3a\u5185\u5bb9\u592a\u591a\u4e86\uff0c\u6240\u4ee5\u5927\u5bb6\u591a\u67e5\u9605\u4e0b\u5b98\u65b9\u6587\u6863\u5373\u53ef\u3002<\/p>\n<p>\u901a\u8fc7\u672c\u7bc7\u6587\u7ae0\uff0c\u5e0c\u671b\u80fd\u8ba9\u4f60\u4ece\u4e00\u4e2a <strong>VSCode \u63d2\u4ef6\u5f00\u53d1<\/strong> \u7684\u5c0f\u767d\u53d8\u6210\u5927\u767d\uff0c\u80fd\u591f\u4e3a\u56e2\u961f\u8d4b\u80fd\uff0c\u6216\u8005\u4f5c\u4e3a\u81ea\u5df1\u7684\u4e00\u4e2a\u6280\u80fd\u4eae\u70b9\u3002<\/p>\n<p><strong>\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\uff01\uff01<\/strong><\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044178514\" alt=\"6F7A4E27.gif\" title=\"6F7A4E27.gif\" loading=\"lazy\"><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044178506\">https:\/\/segmentfault.com\/a\/1190000044178506<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u6b22\u8fce\u5173\u6ce8\u540c\u540d\u516c\u4f17\u53f7\u300a\u718a\u7684\u732b\u300b\uff0c\u6587\u7ae0\u4f1a\u540c\u6b65\u66f4\u65b0\uff0c\u4e5f\u53ef\u5feb\u901f\u52a0\u5165\u524d\u7aef\u4ea4\u6d41\u7fa4\uff01 \u7531\u4e8e\u4e4b\u524d\u7684\u56fd\u9645\u5316\u7684\u9879\u76ee\u4e2d\u603b\u662f\u8981\u7edf [&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-10008223","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\/10008223","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=10008223"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008223\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}