{"id":75687,"date":"2026-02-12T23:05:21","date_gmt":"2026-02-12T15:05:21","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/75687.html"},"modified":"2026-02-12T23:05:21","modified_gmt":"2026-02-12T15:05:21","slug":"%e6%8f%92%e4%bb%b6%e7%b3%bb%e7%bb%9f%e5%bc%80%e5%8f%91%e6%b5%81%e7%a8%8b%e7%9a%84%e6%a0%b8%e5%bf%83%e6%ad%a5%e9%aa%a4-package-json%e5%a3%b0%e6%98%8e","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/75687.html","title":{"rendered":"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e"},"content":{"rendered":"<p>\u8be6\u7ec6\u6df1\u5165\u9610\u8ff0\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4&#xff0c;\u7279\u522b\u5173\u6ce8package.json\u58f0\u660e\u90e8\u5206&#xff1a;\u5b9a\u4e49\u63d2\u4ef6\u80fd\u505a\u4ec0\u4e48&#xff0c;\u5728contributes\u4e2d\u58f0\u660e\u6240\u6709\u529f\u80fd&#xff0c;\u5b9a\u4e49activationEvents\u63a7\u5236\u6fc0\u6d3b\u65f6\u673a&#xff0c;\u914d\u7f6ecommands\u3001views\u3001menus\u7b49\u3002\u5e76\u8981\u6c42\u7528UML\u5efa\u6a21\u5e76\u63d0\u4f9b\u5177\u4f53\u8be6\u5c3d\u6df1\u5165\u7684\u65b9\u6848\u3002<\/p>\n<p>\u9700\u8981\u751f\u6210\u4e00\u4e2a\u8be6\u7ec6\u3001\u6df1\u5165\u7684\u7b54\u6848&#xff0c;\u5305\u62ec\u5bf9\u6bcf\u4e2a\u65b9\u9762\u7684\u9610\u8ff0&#xff0c;\u5e76\u63d0\u4f9bUML\u5efa\u6a21\u3002UML\u53ef\u4ee5\u5305\u62ec\u7c7b\u56fe\u3001\u6d3b\u52a8\u56fe\u3001\u65f6\u5e8f\u56fe\u7b49&#xff0c;\u7528\u4e8e\u63cf\u8ff0\u63d2\u4ef6\u7cfb\u7edf\u7684\u67b6\u6784\u3001\u63d2\u4ef6\u6ce8\u518c\u3001\u6fc0\u6d3b\u3001\u8d21\u732e\u70b9\u7b49\u3002<\/p>\n<p>\u9700\u8981\u89c4\u5212\u56de\u7b54\u7ed3\u6784&#xff1a;<\/p>\n<li>\n<p>\u5f15\u8a00&#xff1a;\u6982\u8ff0\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4&#xff0c;\u5f3a\u8c03package.json\u58f0\u660e\u7684\u91cd\u8981\u6027\u3002<\/p>\n<\/li>\n<li>\n<p>\u8be6\u7ec6\u9610\u8ff0\u6bcf\u4e2a\u7ec6\u8282&#xff1a;<br \/>\na. package.json\u58f0\u660e&#xff1a;\u6574\u4f53\u7ed3\u6784&#xff0c;\u63d2\u4ef6\u7684\u5143\u6570\u636e\u3002<br \/>\nb. contributes&#xff1a;\u8d21\u732e\u70b9\u7684\u6982\u5ff5&#xff0c;\u5e38\u89c1\u7684\u8d21\u732e\u70b9\u7c7b\u578b&#xff08;commands, views, menus, etc.&#xff09;&#xff0c;\u5982\u4f55\u58f0\u660e&#xff0c;\u4f5c\u7528&#xff0c;\u80cc\u540e\u7684\u5904\u7406\u673a\u5236\u3002<br \/>\nc. activationEvents&#xff1a;\u63a7\u5236\u6fc0\u6d3b\u65f6\u673a&#xff0c;\u5b9a\u4e49\u5728\u4f55\u79cd\u6761\u4ef6\u4e0b\u6fc0\u6d3b\u63d2\u4ef6&#xff0c;\u5e38\u89c1\u7684activationEvent\u7c7b\u578b&#xff08;onCommand, onView, onLanguage, etc.&#xff09;&#xff0c;\u5982\u4f55\u58f0\u660e&#xff0c;\u61d2\u52a0\u8f7d\u673a\u5236\u3002<br \/>\nd. commands&#xff1a;\u5b9a\u4e49\u547d\u4ee4&#xff0c;\u5305\u62ecid, title, category\u7b49&#xff0c;\u5982\u4f55\u6ce8\u518c\u5904\u7406\u51fd\u6570\u3002<br \/>\ne. views&#xff1a;\u5b9a\u4e49\u89c6\u56fe&#xff0c;\u5982\u4fa7\u8fb9\u680f\u89c6\u56fe&#xff0c;\u5305\u62ecid, name, location\u7b49\u3002<br \/>\nf. menus&#xff1a;\u5b9a\u4e49\u83dc\u5355\u9879&#xff0c;\u5c06\u547d\u4ee4\u5173\u8054\u5230\u83dc\u5355&#xff0c;\u5982\u7f16\u8f91\u5668\u4e0a\u4e0b\u6587\u83dc\u5355\u3001\u6807\u9898\u83dc\u5355\u7b49\u3002<\/p>\n<\/li>\n<li>\n<p>UML\u5efa\u6a21&#xff1a;\u63d0\u4f9b\u63d2\u4ef6\u7cfb\u7edf\u76f8\u5173\u90e8\u5206\u7684UML\u56fe\u3002\u6211\u4eec\u53ef\u4ee5\u8bbe\u8ba1\u4e00\u4e2a\u63d2\u4ef6\u7cfb\u7edf\u6838\u5fc3\u7ec4\u4ef6\u7684\u7c7b\u56fe&#xff0c;\u63cf\u8ff0\u63d2\u4ef6\u3001\u8d21\u732e\u70b9\u3001\u6fc0\u6d3b\u4e8b\u4ef6\u3001\u547d\u4ee4\u6ce8\u518c\u7b49\u3002\u4e5f\u53ef\u4ee5\u8bbe\u8ba1\u65f6\u5e8f\u56fe\u5c55\u793a\u63d2\u4ef6\u6fc0\u6d3b\u6d41\u7a0b&#xff0c;\u6216\u6d3b\u52a8\u56fe\u5c55\u793a\u63d2\u4ef6\u52a0\u8f7d\u8fc7\u7a0b\u3002\u6211\u4eec\u9700\u8981\u63d0\u4f9b\u5177\u4f53\u8be6\u5c3d\u6df1\u5165\u7684\u65b9\u6848\u3002<\/p>\n<\/li>\n<li>\n<p>\u603b\u7ed3&#xff1a;\u5bf9\u6d41\u7a0b\u7684\u6574\u4f53\u7406\u89e3\u3002<\/p>\n<\/li>\n<p>\u786e\u4fdd\u56de\u7b54\u4e13\u4e1a\u3001\u8be6\u5c3d&#xff0c;\u8986\u76d6\u7528\u6237\u8981\u6c42\u7684\u201c\u6bcf\u4e2a\u7ec6\u8282\u201d\u3002\u8fd8\u9700\u8981\u63d0\u4f9b\u5177\u4f53\u7684JSON\u793a\u4f8b&#xff0c;\u8bf4\u660epackage.json\u4e2d\u7684\u914d\u7f6e\u3002\u4e5f\u53ef\u4ee5\u7ed3\u5408\u7c7b\u4f3cVS Code\u63d2\u4ef6\u7cfb\u7edf\u7684\u673a\u5236&#xff0c;\u4f46\u53ef\u4ee5\u901a\u7528\u5316\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;\u7528\u6237\u6307\u5b9a\u4e86\u201c\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4\u201d&#xff0c;\u5e76\u5217\u4e3e\u4e86\u5177\u4f53\u8981\u9610\u8ff0\u7684\u5185\u5bb9\u3002\u6240\u4ee5\u56de\u7b54\u5e94\u5f53\u56f4\u7ed5\u8fd9\u4e9b\u70b9\u3002<\/p>\n<p>\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\u5c55\u5f00&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u63d2\u4ef6\u58f0\u660e\u4e0e\u8d21\u732e\u70b9\u7cfb\u7edf&#xff1a;\u63d2\u4ef6\u7684package.json\u662f\u63d2\u4ef6\u7684\u6e05\u5355\u6587\u4ef6&#xff0c;\u58f0\u660e\u63d2\u4ef6\u7684\u8eab\u4efd\u3001\u80fd\u529b\u3001\u4f9d\u8d56\u3001\u6fc0\u6d3b\u6761\u4ef6\u3001\u8d21\u732e\u70b9\u7b49\u3002<\/p>\n<\/li>\n<li>\n<p>\u8d21\u732e\u70b9&#xff08;contributes&#xff09;&#xff1a;\u63d2\u4ef6\u5411\u5bbf\u4e3b\u5e94\u7528\u63d0\u4f9b\u7684\u529f\u80fd\u6269\u5c55\u70b9\u3002\u6bcf\u79cd\u8d21\u732e\u70b9\u6709\u7279\u5b9a\u7684JSON\u7ed3\u6784&#xff0c;\u5bbf\u4e3b\u5e94\u7528\u4f1a\u5728\u5408\u9002\u7684\u65f6\u673a\u52a0\u8f7d\u548c\u6ce8\u518c\u8fd9\u4e9b\u8d21\u732e\u3002<\/p>\n<\/li>\n<li>\n<p>\u6fc0\u6d3b\u4e8b\u4ef6&#xff08;activationEvents&#xff09;&#xff1a;\u5b9a\u4e49\u63d2\u4ef6\u4f55\u65f6\u88ab\u6fc0\u6d3b&#xff08;\u52a0\u8f7d\u5e76\u6267\u884c\u4ee3\u7801&#xff09;\u3002\u8fd9\u662f\u5b9e\u73b0\u6309\u9700\u52a0\u8f7d\u7684\u5173\u952e\u3002<\/p>\n<\/li>\n<li>\n<p>\u547d\u4ee4&#xff08;commands&#xff09;&#xff1a;\u6700\u57fa\u7840\u7684\u8d21\u732e\u70b9&#xff0c;\u5b9a\u4e49\u4e00\u4e2a\u53ef\u6267\u884c\u52a8\u4f5c&#xff0c;\u7ed1\u5b9a\u5230\u5feb\u6377\u952e\u3001\u83dc\u5355\u7b49\u3002<\/p>\n<\/li>\n<li>\n<p>\u89c6\u56fe&#xff08;views&#xff09;&#xff1a;\u81ea\u5b9a\u4e49UI\u5bb9\u5668&#xff0c;\u5982\u4fa7\u8fb9\u680f\u89c6\u56fe\u5bb9\u5668\u3001\u89c6\u56fe\u3002<\/p>\n<\/li>\n<li>\n<p>\u83dc\u5355&#xff08;menus&#xff09;&#xff1a;\u5c06\u547d\u4ee4\u6216\u89c6\u56fe\u653e\u7f6e\u5230\u83dc\u5355\u680f\u3001\u4e0a\u4e0b\u6587\u83dc\u5355\u7b49\u4f4d\u7f6e\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u9700\u8981\u6df1\u5165\u9610\u8ff0\u6bcf\u4e2a\u7ec6\u8282&#xff0c;\u4f8b\u5982&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u547d\u4ee4\u7684\u5b9a\u4e49&#xff1a;id\u3001title\u3001icon\u3001category\u7b49&#xff0c;\u4ee5\u53ca\u547d\u4ee4\u5982\u4f55\u4e0e\u4ee3\u7801\u5173\u8054&#xff08;\u901a\u8fc7\u63d2\u4ef6\u6fc0\u6d3b\u65f6\u6ce8\u518c\u547d\u4ee4\u5904\u7406\u51fd\u6570&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u89c6\u56fe\u7684\u5b9a\u4e49&#xff1a;containerId\u3001viewId\u3001name\u7b49&#xff0c;\u4ee5\u53ca\u89c6\u56fe\u5185\u5bb9\u7684\u5448\u73b0\u65b9\u5f0f&#xff08;\u901a\u8fc7Webview\u6216\u81ea\u5b9a\u4e49\u6e32\u67d3\u5668&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u83dc\u5355\u7684\u5b9a\u4e49&#xff1a;command\u3001when\u6761\u4ef6\u3001group\u3001alt\u7b49&#xff0c;\u63a7\u5236\u83dc\u5355\u9879\u7684\u53ef\u89c1\u6027\u548c\u6392\u5e8f\u3002<\/p>\n<\/li>\n<li>\n<p>\u6fc0\u6d3b\u4e8b\u4ef6\u7684\u5b9a\u4e49&#xff1a;\u591a\u4e2a\u6fc0\u6d3b\u4e8b\u4ef6\u7684\u7ec4\u5408&#xff0c;\u4ee5\u53ca\u5982\u4f55\u901a\u8fc7activationEvents\u544a\u8bc9\u5bbf\u4e3b\u5e94\u7528\u54ea\u4e9b\u4e8b\u4ef6\u4f1a\u89e6\u53d1\u63d2\u4ef6\u6fc0\u6d3b\u3002<\/p>\n<\/li>\n<\/ul>\n<p>UML\u5efa\u6a21&#xff1a;\u53ef\u4ee5\u7ed9\u51fa\u7c7b\u56fe&#xff0c;\u8868\u793aPlugin\u3001Contribution\u3001ActivationEvent\u3001Command\u3001View\u3001Menu\u7b49\u7c7b\u7684\u7ed3\u6784&#xff0c;\u4ee5\u53ca\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u8fd8\u53ef\u4ee5\u7528\u65f6\u5e8f\u56fe\u5c55\u793a\u63d2\u4ef6\u52a0\u8f7d\u6d41\u7a0b\u3002<\/p>\n<p>\u73b0\u5728&#xff0c;\u5f00\u59cb\u6784\u5efa\u8be6\u7ec6\u7b54\u6848\u3002<\/p>\n<h3>\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u6838\u5fc3\u6b65\u9aa4\u6df1\u5165\u89e3\u6790<\/h3>\n<p>\u63d2\u4ef6\u7cfb\u7edf\u662f\u73b0\u4ee3\u53ef\u6269\u5c55\u5e94\u7528&#xff08;\u5982VS Code\u3001Eclipse\u3001Chrome&#xff09;\u7684\u57fa\u77f3\u3002\u5176\u6838\u5fc3\u5f00\u53d1\u6d41\u7a0b\u56f4\u7ed5**\u63d2\u4ef6\u6e05\u5355&#xff08;package.json&#xff09;**\u5c55\u5f00&#xff0c;\u901a\u8fc7\u58f0\u660e\u5f0f\u914d\u7f6e\u5b9a\u4e49\u63d2\u4ef6\u7684\u80fd\u529b\u3001\u6fc0\u6d3b\u6761\u4ef6\u4e0e\u8d44\u6e90\u8d21\u732e\u3002\u4ee5\u4e0b\u5c06\u9010\u70b9\u6df1\u5165\u5256\u6790\u6bcf\u4e2a\u7ec6\u8282&#xff0c;\u5e76\u7ed3\u5408UML\u6a21\u578b\u63d0\u4f9b\u5b8c\u6574\u7684\u65b9\u6848\u8bbe\u8ba1\u3002<\/p>\n<hr \/>\n<h4>1. package.json \u58f0\u660e&#xff1a;\u63d2\u4ef6\u7684\u5143\u6570\u636e\u4e0e\u5951\u7ea6<\/h4>\n<p>package.json\u4e0d\u4ec5\u662fnpm\u5305\u7684\u63cf\u8ff0\u6587\u4ef6&#xff0c;\u66f4\u662f\u63d2\u4ef6\u7684\u552f\u4e00\u8eab\u4efd\u4e0e\u884c\u4e3a\u58f0\u660e\u3002\u5bbf\u4e3b\u5e94\u7528\u901a\u8fc7\u89e3\u6790\u8be5\u6587\u4ef6\u4e86\u89e3\u63d2\u4ef6\u7684\u57fa\u672c\u4fe1\u606f\u53ca\u5176\u6269\u5c55\u610f\u56fe\u3002<\/p>\n<h5>1.1 \u5fc5\u9700\u5b57\u6bb5<\/h5>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;version&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;1.0.0&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;main&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;.\/out\/extension.js&#034;<\/span><span class=\"token punctuation\">,<\/span>   <span class=\"token comment\">\/\/ \u63d2\u4ef6\u5165\u53e3&#xff0c;\u6fc0\u6d3b\u65f6\u52a0\u8f7d<\/span><br \/>\n  <span class=\"token string-property property\">&#034;contributes&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span>              <span class=\"token comment\">\/\/ \u8d21\u732e\u70b9\u58f0\u660e<\/span><br \/>\n  <span class=\"token string-property property\">&#034;activationEvents&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span>         <span class=\"token comment\">\/\/ \u6fc0\u6d3b\u4e8b\u4ef6\u58f0\u660e<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>main&#xff1a;\u63d2\u4ef6\u6fc0\u6d3b\u65f6\u5b9e\u9645\u6267\u884c\u7684\u4ee3\u7801\u5165\u53e3\u3002\u82e5\u4e0d\u63d0\u4f9b&#xff0c;\u5219\u89c6\u4e3a\u7eaf\u8d21\u732e\u578b\u63d2\u4ef6&#xff08;\u65e0\u9700\u6fc0\u6d3b\u5373\u53ef\u4f7f\u7528\u58f0\u660e\u5185\u5bb9&#xff09;\u3002<\/li>\n<li>engines&#xff1a;\u6307\u5b9a\u5bbf\u4e3b\u5e94\u7528\u517c\u5bb9\u7248\u672c&#xff0c;\u5982 &#034;vscode&#034;: &#034;^1.60.0&#034;\u3002<\/li>\n<\/ul>\n<h5>1.2 \u6269\u5c55\u5b57\u6bb5<\/h5>\n<ul>\n<li>icon&#xff1a;\u63d2\u4ef6\u56fe\u6807\u3002<\/li>\n<li>categories&#xff1a;\u63d2\u4ef6\u5206\u7c7b&#xff08;\u5982&#034;Programming Languages&#034;, &#034;Snippets&#034;&#xff09;\u3002<\/li>\n<li>keywords&#xff1a;\u641c\u7d22\u5173\u952e\u8bcd\u3002<\/li>\n<\/ul>\n<hr \/>\n<h4>2. contributes&#xff1a;\u63d2\u4ef6\u80fd\u529b\u7684\u8d21\u732e\u70b9\u7cfb\u7edf<\/h4>\n<p>\u8d21\u732e\u70b9\u662f\u63d2\u4ef6\u5411\u5bbf\u4e3b\u5e94\u7528\u63d0\u4f9b\u529f\u80fd\u7684\u201c\u94a9\u5b50\u201d\u3002\u6bcf\u4e2a\u8d21\u732e\u70b9\u90fd\u9075\u5faa\u9884\u5b9a\u4e49\u7684JSON Schema&#xff0c;\u5bbf\u4e3b\u5e94\u7528\u5728\u542f\u52a8\u6216\u8fd0\u884c\u65f6\u5408\u5e76\u6240\u6709\u63d2\u4ef6\u7684\u8d21\u732e&#xff0c;\u5e76\u6784\u5efa\u76f8\u5e94\u7684UI\u4e0e\u884c\u4e3a\u3002<\/p>\n<h5>2.1 \u5e38\u89c1\u8d21\u732e\u70b9\u7c7b\u578b<\/h5>\n<table>\n<tr>\u8d21\u732e\u70b9\u7c7b\u578b\u529f\u80fd\u63cf\u8ff0\u5178\u578b\u7ed3\u6784\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>commands<\/td>\n<td>\u5b9a\u4e49\u53ef\u6267\u884c\u7684\u547d\u4ee4<\/td>\n<td>{&#034;command&#034;: &#034;my.command&#034;, &#034;title&#034;: &#034;Do Something&#034;}<\/td>\n<\/tr>\n<tr>\n<td>menus<\/td>\n<td>\u5c06\u547d\u4ee4\u6216\u89c6\u56fe\u6dfb\u52a0\u5230\u83dc\u5355<\/td>\n<td>{&#034;command&#034;: &#034;my.command&#034;, &#034;group&#034;: &#034;navigation&#034;}<\/td>\n<\/tr>\n<tr>\n<td>viewsContainers<\/td>\n<td>\u81ea\u5b9a\u4e49\u4fa7\u8fb9\u680f\u89c6\u56fe\u5bb9\u5668<\/td>\n<td>{&#034;activitybar&#034;: [{&#034;id&#034;: &#034;my&#034;, &#034;title&#034;: &#034;My&#034;}]}<\/td>\n<\/tr>\n<tr>\n<td>views<\/td>\n<td>\u5b9a\u4e49\u89c6\u56fe&#xff08;\u6811\u3001Webview\u7b49&#xff09;<\/td>\n<td>{&#034;explorer&#034;: [{&#034;id&#034;: &#034;myView&#034;, &#034;name&#034;: &#034;My View&#034;}]}<\/td>\n<\/tr>\n<tr>\n<td>keybindings<\/td>\n<td>\u81ea\u5b9a\u4e49\u5feb\u6377\u952e<\/td>\n<td>{&#034;command&#034;: &#034;my.command&#034;, &#034;key&#034;: &#034;ctrl&#043;f10&#034;}<\/td>\n<\/tr>\n<tr>\n<td>languages<\/td>\n<td>\u58f0\u660e\u8bed\u8a00\u652f\u6301<\/td>\n<td>{&#034;id&#034;: &#034;myLang&#034;, &#034;extensions&#034;: [&#034;.mylang&#034;]}<\/td>\n<\/tr>\n<tr>\n<td>grammars<\/td>\n<td>\u8bed\u6cd5\u7740\u8272\u89c4\u5219<\/td>\n<td>{&#034;language&#034;: &#034;myLang&#034;, &#034;scopeName&#034;: &#034;source.my&#034;}<\/td>\n<\/tr>\n<tr>\n<td>themes<\/td>\n<td>\u4e3b\u9898\u5b9a\u4e49<\/td>\n<td>{&#034;label&#034;: &#034;Dark&#034;, &#034;uiTheme&#034;: &#034;vs-dark&#034;}<\/td>\n<\/tr>\n<tr>\n<td>snippets<\/td>\n<td>\u4ee3\u7801\u7247\u6bb5<\/td>\n<td>{&#034;language&#034;: &#034;myLang&#034;, &#034;path&#034;: &#034;.\/snippets.json&#034;}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>2.2 contributes \u5904\u7406\u673a\u5236<\/h5>\n<ul>\n<li>\u9759\u6001\u6536\u96c6&#xff1a;\u5bbf\u4e3b\u5e94\u7528\u5728\u626b\u63cf\u63d2\u4ef6\u65f6&#xff0c;\u5c06\u6240\u6709\u63d2\u4ef6\u7684 contributes \u5185\u5bb9\u5408\u5e76&#xff0c;\u751f\u6210\u5168\u5c40\u8d21\u732e\u70b9\u6ce8\u518c\u8868\u3002<\/li>\n<li>\u52a8\u6001\u52a0\u8f7d&#xff1a;\u5bf9\u4e8e\u89c6\u56fe\u3001\u83dc\u5355\u7b49UI\u5143\u7d20&#xff0c;\u5bbf\u4e3b\u5e94\u7528\u6839\u636e\u6ce8\u518c\u8868\u6784\u5efa\u754c\u9762&#xff0c;\u4f46\u63d2\u4ef6\u4ee3\u7801\u4ec5\u5728\u6fc0\u6d3b\u4e8b\u4ef6\u89e6\u53d1\u540e\u624d\u52a0\u8f7d\u6267\u884c\u3002<\/li>\n<\/ul>\n<h5>2.3 \u6df1\u5165\u793a\u4f8b&#xff1a;\u58f0\u660e\u4e00\u4e2a\u5b8c\u6574\u7684\u547d\u4ee4&#043;\u83dc\u5355&#043;\u89c6\u56fe<\/h5>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;contributes&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;commands&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n      <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token string-property property\">&#034;command&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.hello&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token string-property property\">&#034;title&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;Say Hello&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token string-property property\">&#034;category&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;My Plugin&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token string-property property\">&#034;icon&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n          <span class=\"token string-property property\">&#034;light&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;.\/icons\/light\/hello.svg&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;dark&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;.\/icons\/dark\/hello.svg&#034;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string-property property\">&#034;menus&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;editor\/context&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n        <span class=\"token punctuation\">{<\/span><br \/>\n          <span class=\"token string-property property\">&#034;command&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.hello&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;group&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;1_modification&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;when&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;editorLangId &#061;&#061; javascript&#034;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n      <span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string-property property\">&#034;viewsContainers&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;activitybar&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n        <span class=\"token punctuation\">{<\/span><br \/>\n          <span class=\"token string-property property\">&#034;id&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin-container&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;title&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;My Tools&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;icon&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;.\/icons\/tools.svg&#034;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n      <span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string-property property\">&#034;views&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;my-plugin-container&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n        <span class=\"token punctuation\">{<\/span><br \/>\n          <span class=\"token string-property property\">&#034;id&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.helloView&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;Hello View&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;type&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;tree&#034;<\/span>   <span class=\"token comment\">\/\/ \u6216 webview<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n      <span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>3. activationEvents&#xff1a;\u7cbe\u51c6\u63a7\u5236\u63d2\u4ef6\u6fc0\u6d3b\u65f6\u673a<\/h4>\n<p>\u4e3a\u4e86\u4f18\u5316\u542f\u52a8\u6027\u80fd&#xff0c;\u63d2\u4ef6\u9ed8\u8ba4\u61d2\u52a0\u8f7d\u2014\u2014\u53ea\u6709\u5728\u7528\u6237\u771f\u6b63\u9700\u8981\u5176\u529f\u80fd\u65f6\u624d\u52a0\u8f7d\u5e76\u6267\u884cmain\u5165\u53e3\u3002activationEvents\u6570\u7ec4\u58f0\u660e\u4e86\u54ea\u4e9b\u4e8b\u4ef6\u4f1a\u89e6\u53d1\u6fc0\u6d3b\u3002<\/p>\n<h5>3.1 \u5e38\u7528\u6fc0\u6d3b\u4e8b\u4ef6\u6a21\u5f0f<\/h5>\n<table>\n<tr>\u4e8b\u4ef6\u6a21\u5f0f\u89e6\u53d1\u6761\u4ef6<\/tr>\n<tbody>\n<tr>\n<td>&#034;onCommand:my.command&#034;<\/td>\n<td>\u7528\u6237\u6267\u884c\u6307\u5b9a\u547d\u4ee4\u65f6&#xff08;\u5305\u62ec\u83dc\u5355\u70b9\u51fb\/\u5feb\u6377\u952e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&#034;onView:myView&#034;<\/td>\n<td>\u89c6\u56fe\u9996\u6b21\u663e\u793a\u65f6<\/td>\n<\/tr>\n<tr>\n<td>&#034;onLanguage:javascript&#034;<\/td>\n<td>\u6253\u5f00JS\u6587\u4ef6\u65f6<\/td>\n<\/tr>\n<tr>\n<td>&#034;onDebug&#034;<\/td>\n<td>\u8c03\u8bd5\u4f1a\u8bdd\u542f\u52a8\u65f6<\/td>\n<\/tr>\n<tr>\n<td>&#034;*&#034;<\/td>\n<td>\u5e94\u7528\u542f\u52a8\u65f6\u5373\u6fc0\u6d3b&#xff08;\u4e0d\u63a8\u8350&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&#034;workspaceContains:**\/config&#034;<\/td>\n<td>\u5de5\u4f5c\u533a\u5305\u542b\u5339\u914d\u6587\u4ef6\u65f6<\/td>\n<\/tr>\n<tr>\n<td>&#034;onFileSystem:myFs&#034;<\/td>\n<td>\u8bbf\u95ee\u6307\u5b9a\u6587\u4ef6\u7cfb\u7edf\u534f\u8bae\u65f6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>3.2 \u7ec4\u5408\u6fc0\u6d3b\u6761\u4ef6<\/h5>\n<p><span class=\"token string-property property\">&#034;activationEvents&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n  <span class=\"token string\">&#034;onCommand:my-plugin.hello&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string\">&#034;onView:my-plugin.helloView&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string\">&#034;onLanguage:typescript&#034;<\/span><br \/>\n<span class=\"token punctuation\">]<\/span><\/p>\n<p>\u5f53\u4efb\u4e00\u6761\u4ef6\u6ee1\u8db3\u65f6&#xff0c;\u63d2\u4ef6\u5373\u88ab\u6fc0\u6d3b\u3002\u5bbf\u4e3b\u5e94\u7528\u4f1a\u76d1\u542c\u6240\u6709\u5df2\u58f0\u660e\u7684\u6fc0\u6d3b\u4e8b\u4ef6&#xff0c;\u4e00\u65e6\u53d1\u751f\u5219\u89e6\u53d1\u63d2\u4ef6\u52a0\u8f7d\u3002<\/p>\n<h5>3.3 \u6fc0\u6d3b\u6d41\u7a0b<\/h5>\n<li>\u7528\u6237\u64cd\u4f5c&#xff08;\u5982\u70b9\u51fb\u547d\u4ee4&#xff09;\u2192 \u4e8b\u4ef6\u6d3e\u53d1\u3002<\/li>\n<li>\u5bbf\u4e3b\u5e94\u7528\u68c0\u67e5\u662f\u5426\u6709\u63d2\u4ef6\u6ce8\u518c\u4e86\u8be5\u4e8b\u4ef6\u7684\u76d1\u542c&#xff08;\u901a\u8fc7activationEvents&#xff09;\u3002<\/li>\n<li>\u82e5\u63d2\u4ef6\u672a\u6fc0\u6d3b&#xff0c;\u5219\u6267\u884c&#xff1a;\n<ul>\n<li>\u52a0\u8f7dmain\u6307\u5b9a\u7684JS\u6587\u4ef6\u3002<\/li>\n<li>\u8c03\u7528\u63d2\u4ef6\u7684activate\u5bfc\u51fa\u51fd\u6570&#xff08;\u6216\u6839\u636e\u6846\u67b6\u7ea6\u5b9a&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u63d2\u4ef6\u5728activate\u4e2d\u52a8\u6001\u6ce8\u518c\u547d\u4ee4\u3001\u89c6\u56fe\u7b49\u8d21\u732e\u70b9\u7684\u5177\u4f53\u5b9e\u73b0\u3002<\/li>\n<li>\u4e4b\u540e&#xff0c;\u6240\u6709\u5df2\u6ce8\u518c\u7684\u547d\u4ee4\u3001\u89c6\u56fe\u7b49\u5747\u53ef\u6b63\u5e38\u4f7f\u7528\u3002<\/li>\n<hr \/>\n<h4>4. commands&#xff1a;\u547d\u4ee4\u7684\u5b9a\u4e49\u4e0e\u5b9e\u73b0<\/h4>\n<p>\u547d\u4ee4\u662f\u63d2\u4ef6\u529f\u80fd\u7684\u6700\u5c0f\u53ef\u6267\u884c\u5355\u5143&#xff0c;\u901a\u5e38\u4e0e\u83dc\u5355\u3001\u5feb\u6377\u952e\u3001\u72b6\u6001\u680f\u7b49UI\u5143\u7d20\u7ed1\u5b9a\u3002<\/p>\n<h5>4.1 \u58f0\u660e\u5c42&#xff08;package.json&#xff09;<\/h5>\n<ul>\n<li>command&#xff1a;\u552f\u4e00\u6807\u8bc6&#xff0c;\u547d\u540d\u7a7a\u95f4${publisher}.${pluginName}.${id}\u3002<\/li>\n<li>title&#xff1a;UI\u4e0a\u663e\u793a\u7684\u6587\u672c\u3002<\/li>\n<li>category&#xff1a;\u5206\u7c7b&#xff0c;\u7528\u4e8e\u547d\u4ee4\u9762\u677f\u5206\u7ec4\u3002<\/li>\n<li>icon&#xff1a;\u53ef\u9009\u7684\u56fe\u6807\u8def\u5f84\u3002<\/li>\n<li>enablement&#xff1a;\u542f\u7528\u6761\u4ef6\u8868\u8fbe\u5f0f&#xff08;\u5982&#034;editorLangId &#061;&#061; json&#034;&#xff09;\u3002<\/li>\n<\/ul>\n<h5>4.2 \u5b9e\u73b0\u5c42&#xff08;\u4ee3\u7801&#xff09;<\/h5>\n<p><span class=\"token comment\">\/\/ extension.js<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">activate<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">context<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> disposable <span class=\"token operator\">&#061;<\/span> vscode<span class=\"token punctuation\">.<\/span>commands<span class=\"token punctuation\">.<\/span><span class=\"token function\">registerCommand<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;my-plugin.hello&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token parameter\">args<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    vscode<span class=\"token punctuation\">.<\/span>window<span class=\"token punctuation\">.<\/span><span class=\"token function\">showInformationMessage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;Hello!&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  context<span class=\"token punctuation\">.<\/span>subscriptions<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>disposable<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>\u5fc5\u987b\u5728activate\u4e2d\u8c03\u7528\u6ce8\u518cAPI&#xff0c;\u5426\u5219\u547d\u4ee4\u65e0\u5b9e\u9645\u529f\u80fd\u3002<\/li>\n<li>\u8fd4\u56de\u503cdisposable\u7528\u4e8e\u5378\u8f7d\u65f6\u91ca\u653e\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<h5>4.3 \u547d\u4ee4\u7684\u6267\u884c\u4e0a\u4e0b\u6587<\/h5>\n<p>\u547d\u4ee4\u53ef\u4ee5\u63a5\u6536\u53c2\u6570&#xff0c;\u4f8b\u5982\u901a\u8fc7\u83dc\u5355\u4f20\u9012\u5f53\u524d\u9009\u4e2d\u7684\u8d44\u6e90\u3002<\/p>\n<hr \/>\n<h4>5. views&#xff1a;\u81ea\u5b9a\u4e49\u89c6\u56fe\u7684\u6784\u5efa\u4e0e\u4ea4\u4e92<\/h4>\n<p>\u89c6\u56fe\u662f\u63d2\u4ef6\u5728UI\u4fa7\u8fb9\u680f\u3001\u9762\u677f\u7b49\u4f4d\u7f6e\u63d0\u4f9b\u7684\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u3002\u901a\u5e38\u5206\u4e3a\u4e24\u7c7b&#xff1a;<\/p>\n<ul>\n<li>\u6811\u89c6\u56fe&#xff08;TreeView&#xff09;&#xff1a;\u663e\u793a\u5c42\u7ea7\u6570\u636e&#xff0c;\u652f\u6301\u9009\u62e9\u3001\u62d6\u62fd\u7b49\u3002<\/li>\n<li>Webview\u89c6\u56fe&#xff1a;\u901a\u8fc7HTML\/CSS\/JS\u5b8c\u5168\u81ea\u5b9a\u4e49UI\u3002<\/li>\n<\/ul>\n<h5>5.1 \u89c6\u56fe\u58f0\u660e<\/h5>\n<p><span class=\"token string-property property\">&#034;views&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;my-plugin-container&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;id&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.treeView&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n      <span class=\"token string-property property\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;File Explorer&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n      <span class=\"token string-property property\">&#034;when&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;config.myPlugin.enable&#034;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;id&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.webView&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n      <span class=\"token string-property property\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;Preview&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n      <span class=\"token string-property property\">&#034;type&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;webview&#034;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>id&#xff1a;\u89c6\u56fe\u552f\u4e00\u6807\u8bc6&#xff0c;\u4e5f\u4f5c\u4e3a\u6fc0\u6d3b\u4e8b\u4ef6onView:my-plugin.treeView\u4f7f\u7528\u3002<\/li>\n<li>name&#xff1a;\u89c6\u56fe\u6807\u9898\u3002<\/li>\n<li>when&#xff1a;\u6761\u4ef6\u8868\u8fbe\u5f0f\u63a7\u5236\u89c6\u56fe\u53ef\u89c1\u6027\u3002<\/li>\n<li>type&#xff1a;tree&#xff08;\u9ed8\u8ba4&#xff09;\u6216webview\u3002<\/li>\n<\/ul>\n<h5>5.2 \u89c6\u56fe\u5b9e\u73b0<\/h5>\n<p>\u6811\u89c6\u56fe&#xff1a;\u9700\u8981\u63d0\u4f9b\u4e00\u4e2aTreeDataProvider&#xff0c;\u7531\u63d2\u4ef6\u5728\u6fc0\u6d3b\u65f6\u6ce8\u518c\u3002<\/p>\n<p><span class=\"token keyword\">const<\/span> treeProvider <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MyTreeDataProvider<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nvscode<span class=\"token punctuation\">.<\/span>window<span class=\"token punctuation\">.<\/span><span class=\"token function\">registerTreeDataProvider<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;my-plugin.treeView&#039;<\/span><span class=\"token punctuation\">,<\/span> treeProvider<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>Webview\u89c6\u56fe&#xff1a;\u4f7f\u7528createWebviewPanel\u6216\u901a\u8fc7WebviewViewProvider\u3002<\/p>\n<p><span class=\"token keyword\">const<\/span> provider <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MyWebviewViewProvider<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nvscode<span class=\"token punctuation\">.<\/span>window<span class=\"token punctuation\">.<\/span><span class=\"token function\">registerWebviewViewProvider<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;my-plugin.webView&#039;<\/span><span class=\"token punctuation\">,<\/span> provider<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<hr \/>\n<h4>6. menus&#xff1a;\u83dc\u5355\u9879\u7684\u52a8\u6001\u7ec4\u7ec7<\/h4>\n<p>\u83dc\u5355\u8d21\u732e\u70b9\u5141\u8bb8\u5c06\u547d\u4ee4\u6216\u5b50\u83dc\u5355\u653e\u7f6e\u5230\u5bbf\u4e3b\u5e94\u7528\u7684\u5404\u79cd\u83dc\u5355\u680f\u4e2d&#xff0c;\u5e76\u5229\u7528group\u548cwhen\u5b9e\u73b0\u7cbe\u7ec6\u5316\u63a7\u5236\u3002<\/p>\n<h5>6.1 \u83dc\u5355\u4f4d\u7f6e<\/h5>\n<ul>\n<li>commandPalette&#xff1a;\u547d\u4ee4\u9762\u677f\u3002<\/li>\n<li>editor\/context&#xff1a;\u7f16\u8f91\u5668\u53f3\u952e\u83dc\u5355\u3002<\/li>\n<li>editor\/title&#xff1a;\u7f16\u8f91\u5668\u6807\u9898\u680f\u3002<\/li>\n<li>explorer\/context&#xff1a;\u6587\u4ef6\u8d44\u6e90\u7ba1\u7406\u5668\u53f3\u952e\u83dc\u5355\u3002<\/li>\n<li>view\/title&#xff1a;\u89c6\u56fe\u6807\u9898\u680f\u3002<\/li>\n<li>view\/item\/context&#xff1a;\u89c6\u56fe\u9879\u53f3\u952e\u83dc\u5355\u3002<\/li>\n<\/ul>\n<h5>6.2 \u5206\u7ec4\u4e0e\u6392\u5e8f<\/h5>\n<p>\u6bcf\u4e2a\u83dc\u5355\u4f4d\u7f6e\u9884\u5b9a\u4e49\u591a\u4e2agroup&#xff0c;\u5982navigation\u30011_modification\u30012_copy\u3001z_commands\u7b49&#xff0c;\u6309\u5b57\u6bcd\u987a\u5e8f\/\u6570\u5b57\u987a\u5e8f\u6392\u5217\u3002\u540c\u4e00\u7ec4\u5185\u6309order\u5b57\u6bb5\u6392\u5e8f\u3002<\/p>\n<p><span class=\"token string-property property\">&#034;menus&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;editor\/context&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;command&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.hello&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n      <span class=\"token string-property property\">&#034;group&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;navigation&#064;1&#034;<\/span><span class=\"token punctuation\">,<\/span>   <span class=\"token comment\">\/\/ \u653e\u5728navigation\u7ec4\u7684\u7b2c\u4e00\u4e2a<\/span><br \/>\n      <span class=\"token string-property property\">&#034;when&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;!inDebugMode&#034;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>6.3 \u5b50\u83dc\u5355<\/h5>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;command&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.submenu&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;title&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;My Submenu&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;submenu&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.submenuId&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token string-property property\">&#034;menus&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;my-plugin.submenuId&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;command&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.action1&#034;<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;command&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;my-plugin.action2&#034;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>7. \u63d2\u4ef6\u7cfb\u7edfUML\u5efa\u6a21<\/h4>\n<p>\u4e3a\u6df1\u5165\u7406\u89e3\u4e0a\u8ff0\u8981\u7d20\u7684\u534f\u4f5c\u5173\u7cfb&#xff0c;\u6211\u4eec\u6784\u5efa\u4ee5\u4e0bUML\u6a21\u578b\u3002<\/p>\n<h5>7.1 \u6838\u5fc3\u7c7b\u56fe<\/h5>\n<p>&#064;startuml<br \/>\npackage &#034;\u5bbf\u4e3b\u5e94\u7528&#034; {<br \/>\n  class PluginManager {<br \/>\n    &#8211; plugins: Plugin[]<br \/>\n    &#043; loadPlugin(manifest): Plugin<br \/>\n    &#043; activatePlugin(id)<br \/>\n    &#043; getContribution(type): Contribution[]<br \/>\n  }<\/p>\n<p>  class ContributionRegistry {<br \/>\n    &#8211; commands: Map&lt;string, Command&gt;<br \/>\n    &#8211; views: Map&lt;string, View&gt;<br \/>\n    &#8211; menus: MenuContribution[]<br \/>\n    &#043; registerCommand(cmd: Command)<br \/>\n    &#043; registerView(view: View)<br \/>\n    &#043; getContributions(type)<br \/>\n  }<\/p>\n<p>  class ActivationEventBus {<br \/>\n    &#043; onCommand(commandId, handler)<br \/>\n    &#043; onView(viewId, handler)<br \/>\n    &#043; fire(event)<br \/>\n  }<br \/>\n}<\/p>\n<p>package &#034;\u63d2\u4ef6&#034; {<br \/>\n  class Plugin {<br \/>\n    &#8211; id: string<br \/>\n    &#8211; main: string<br \/>\n    &#8211; activationEvents: string[]<br \/>\n    &#8211; contributes: Contribution[]<br \/>\n    &#043; activate(context: ExtensionContext)<br \/>\n    &#043; deactivate()<br \/>\n  }<\/p>\n<p>  abstract class Contribution {<br \/>\n    &lt;&lt;abstract&gt;&gt;<br \/>\n    &#043; type: string<br \/>\n  }<\/p>\n<p>  class CommandContribution extends Contribution {<br \/>\n    &#043; commandId: string<br \/>\n    &#043; title: string<br \/>\n    &#043; category: string<br \/>\n    &#043; handler: Function<br \/>\n  }<\/p>\n<p>  class ViewContribution extends Contribution {<br \/>\n    &#043; viewId: string<br \/>\n    &#043; name: string<br \/>\n    &#043; type: string<br \/>\n    &#043; provider: TreeDataProvider | WebviewViewProvider<br \/>\n  }<\/p>\n<p>  class MenuContribution extends Contribution {<br \/>\n    &#043; location: string<br \/>\n    &#043; commandId: string<br \/>\n    &#043; group: string<br \/>\n    &#043; when: string<br \/>\n  }<\/p>\n<p>  class ExtensionContext {<br \/>\n    &#043; subscriptions: Disposable[]<br \/>\n    &#043; workspaceState: Memento<br \/>\n    &#043; globalState: Memento<br \/>\n  }<\/p>\n<p>  interface Disposable {<br \/>\n    &#043; dispose()<br \/>\n  }<br \/>\n}<\/p>\n<p>PluginManager &#8211;&gt; Plugin : \u7ba1\u7406<br \/>\nPluginManager &#8211;&gt; ContributionRegistry : \u805a\u5408<br \/>\nPluginManager &#8211;&gt; ActivationEventBus : \u4f7f\u7528<br \/>\nPlugin &#8211;&gt; Contribution : \u58f0\u660e\u4e0e\u5b9e\u73b0<br \/>\nContributionRegistry &#8211;&gt; Contribution : \u6ce8\u518c\u4e0e\u67e5\u8be2<br \/>\nPlugin ..&gt; ExtensionContext : \u63a5\u6536<br \/>\nCommandContribution ..&gt; Disposable : \u5b9e\u73b0<br \/>\n&#064;enduml<\/p>\n<p>\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>PluginManager\u8d1f\u8d23\u626b\u63cf\u3001\u52a0\u8f7d\u63d2\u4ef6&#xff0c;\u5e76\u6839\u636eactivationEvents\u76d1\u542c\u4e8b\u4ef6\u3002<\/li>\n<li>ContributionRegistry\u96c6\u4e2d\u7ba1\u7406\u6240\u6709\u63d2\u4ef6\u7684\u8d21\u732e&#xff0c;\u63d0\u4f9b\u6309\u7c7b\u578b\u67e5\u8be2\u7684\u80fd\u529b\u3002<\/li>\n<li>\u63d2\u4ef6\u5b9e\u4f8b\u5728activate\u65b9\u6cd5\u4e2d\u52a8\u6001\u521b\u5efa\u5177\u4f53\u7684CommandContribution\u7b49\u5bf9\u8c61&#xff0c;\u5e76\u901a\u8fc7ExtensionContext.subscriptions\u7ba1\u7406\u751f\u547d\u5468\u671f\u3002<\/li>\n<\/ul>\n<h5>7.2 \u63d2\u4ef6\u6fc0\u6d3b\u65f6\u5e8f\u56fe<\/h5>\n<p>\u4ee5\u7528\u6237\u6267\u884c\u547d\u4ee4my-plugin.hello\u4e3a\u4f8b&#xff1a;<\/p>\n<p>&#064;startuml<br \/>\nactor User<br \/>\nparticipant &#034;UI (\u547d\u4ee4\u9762\u677f)&#034; as UI<br \/>\nparticipant &#034;ActivationEventBus&#034; as Bus<br \/>\nparticipant &#034;PluginManager&#034; as PM<br \/>\nparticipant &#034;Plugin (my-plugin)&#034; as Plugin<br \/>\nparticipant &#034;ContributionRegistry&#034; as Registry<\/p>\n<p>User -&gt; UI: \u6267\u884c\u547d\u4ee4 &#034;my-plugin.hello&#034;<br \/>\nUI -&gt; Bus: \u6d3e\u53d1 onCommand \u4e8b\u4ef6<br \/>\nBus -&gt; PM: \u67e5\u8be2\u54ea\u4e9b\u63d2\u4ef6\u76d1\u542c\u8be5\u547d\u4ee4<br \/>\nPM -&gt; PM: \u68c0\u67e5\u63d2\u4ef6 my-plugin \u7684activationEvents<br \/>\nPM -&gt; Plugin: \u82e5\u672a\u6fc0\u6d3b&#xff0c;\u8c03\u7528activate()<br \/>\nPlugin -&gt; Registry: registerCommand(&#039;my-plugin.hello&#039;, handler)<br \/>\nRegistry &#8211;&gt; Plugin: \u8fd4\u56deDisposable<br \/>\nPlugin &#8211;&gt; PM: \u6fc0\u6d3b\u5b8c\u6210<br \/>\nPM &#8211;&gt; Bus: \u547d\u4ee4\u5df2\u5c31\u7eea<br \/>\nBus -&gt; Registry: \u83b7\u53d6\u547d\u4ee4\u5904\u7406\u5668<br \/>\nRegistry -&gt; Registry: \u67e5\u627eCommandContribution<br \/>\nRegistry &#8211;&gt; UI: \u8fd4\u56dehandler<br \/>\nUI -&gt; UI: \u6267\u884chandler<br \/>\n&#064;enduml<\/p>\n<h5>7.3 \u8d21\u732e\u70b9\u5408\u5e76\u6d3b\u52a8\u56fe<\/h5>\n<p>&#064;startuml<br \/>\nstart<br \/>\n:\u542f\u52a8\u5bbf\u4e3b\u5e94\u7528;<br \/>\n:\u626b\u63cf\u63d2\u4ef6\u76ee\u5f55;<br \/>\n:\u8bfb\u53d6\u6bcf\u4e2a\u63d2\u4ef6\u7684package.json;<br \/>\nfork<br \/>\n  -[#Aqua]-&gt;<br \/>\n  :\u89e3\u6790contributes;<br \/>\n  :\u5408\u5e76\u81f3\u8d21\u732e\u70b9\u6ce8\u518c\u8868;<br \/>\nfork again<br \/>\n  -[#Green]-&gt;<br \/>\n  :\u89e3\u6790activationEvents;<br \/>\n  :\u6ce8\u518c\u4e8b\u4ef6\u76d1\u542c;<br \/>\nend fork<br \/>\n:\u6784\u5efaUI\u83dc\u5355\/\u89c6\u56fe\u6846\u67b6;<br \/>\n:\u76d1\u542c\u6fc0\u6d3b\u4e8b\u4ef6;<br \/>\n:\u5e94\u7528\u542f\u52a8\u5b8c\u6210;<br \/>\nstop<br \/>\n&#064;enduml<\/p>\n<hr \/>\n<h4>8. \u65b9\u6848\u603b\u7ed3\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h4>\n<li>\u58f0\u660e\u4e0e\u5b9e\u73b0\u5206\u79bb&#xff1a;package.json\u53ea\u505a\u9759\u6001\u58f0\u660e&#xff0c;\u5177\u4f53\u5b9e\u73b0\u5728activate\u4e2d\u52a8\u6001\u6ce8\u518c&#xff0c;\u4fdd\u8bc1\u6027\u80fd\u3002<\/li>\n<li>\u7ec6\u7c92\u5ea6\u6fc0\u6d3b&#xff1a;\u5c3d\u91cf\u4f7f\u7528\u7cbe\u786e\u7684activationEvents&#xff08;\u5982onCommand\u3001onView&#xff09;&#xff0c;\u907f\u514d\u4f7f\u7528*\u3002<\/li>\n<li>\u547d\u4ee4ID\u547d\u540d\u7a7a\u95f4&#xff1a;\u4f7f\u7528${publisher}.${plugin-name}.${command-id}\u683c\u5f0f&#xff0c;\u907f\u514d\u51b2\u7a81\u3002<\/li>\n<li>\u6761\u4ef6\u8868\u8fbe\u5f0f&#xff08;when&#xff09;&#xff1a;\u7075\u6d3b\u63a7\u5236UI\u5143\u7d20\u7684\u53ef\u89c1\u6027&#xff0c;\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u5c55\u793a\u3002<\/li>\n<li>\u8d44\u6e90\u91ca\u653e&#xff1a;\u6240\u6709\u6ce8\u518c\u7684Disposable\u5bf9\u8c61\u5e94\u52a0\u5165context.subscriptions&#xff0c;\u786e\u4fdd\u63d2\u4ef6\u7981\u7528\u65f6\u6b63\u786e\u6e05\u7406\u3002<\/li>\n<p>\u8be5\u63d2\u4ef6\u7cfb\u7edf\u8bbe\u8ba1\u65b9\u6848\u5df2\u5728VS Code\u3001Eclipse Theia\u7b49\u6210\u719f\u4ea7\u54c1\u4e2d\u9a8c\u8bc1&#xff0c;\u901a\u8fc7\u4e25\u683c\u7684\u58f0\u660e\u5f0f\u5951\u7ea6\u4e0e\u4e8b\u4ef6\u9a71\u52a8\u7684\u6fc0\u6d3b\u673a\u5236&#xff0c;\u5b9e\u73b0\u4e86\u9ad8\u5ea6\u53ef\u6269\u5c55\u4e14\u6027\u80fd\u53cb\u597d\u7684\u63d2\u4ef6\u751f\u6001\u3002\u5f00\u53d1\u8005\u53ea\u9700\u9075\u5faa\u4e0a\u8ff0\u6838\u5fc3\u6b65\u9aa4&#xff0c;\u5373\u53ef\u5feb\u901f\u6784\u5efa\u529f\u80fd\u5f3a\u5927\u3001\u6613\u4e8e\u7ef4\u62a4\u7684\u63d2\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8be6\u7ec6\u6df1\u5165\u9610\u8ff0\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4&#xff0c;\u7279\u522b\u5173\u6ce8package.json\u58f0\u660e\u90e8\u5206&#xff1a;\u5b9a\u4e49\u63d2\u4ef6\u80fd\u505a\u4ec0\u4e48&#xff0c;\u5728contributes\u4e2d\u58f0\u660e\u6240\u6709\u529f\u80fd&#xff0c;\u5b9a\u4e49activationEvents\u63a7\u5236\u6fc0\u6d3b\u65f6\u673a&#xff0c;\u914d\u7f6ecommands\u3001views\u3001menus\u7b49\u3002\u5e76\u8981\u6c42\u7528UML\u5efa\u6a21\u5e76\u63d0\u4f9b\u5177\u4f53\u8be6\u5c3d\u6df1\u5165\u7684\u65b9\u6848\u3002<br \/>\n\u9700\u8981\u751f\u6210\u4e00\u4e2a\u8be6\u7ec6\u3001\u6df1\u5165\u7684\u7b54\u6848&#xff0c;\u5305\u62ec\u5bf9\u6bcf\u4e2a\u65b9\u9762\u7684\u9610\u8ff0&#xff0c;\u5e76\u63d0\u4f9bUML\u5efa\u6a21\u3002UML\u53ef\u4ee5\u5305\u62ec\u7c7b\u56fe\u3001\u6d3b\u52a8\u56fe\u3001<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8077,8076,93],"topic":[],"class_list":["post-75687","post","type-post","status-publish","format-standard","hentry","category-server","tag-8077","tag-8076","tag-json"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/75687.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u8be6\u7ec6\u6df1\u5165\u9610\u8ff0\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4&#xff0c;\u7279\u522b\u5173\u6ce8package.json\u58f0\u660e\u90e8\u5206&#xff1a;\u5b9a\u4e49\u63d2\u4ef6\u80fd\u505a\u4ec0\u4e48&#xff0c;\u5728contributes\u4e2d\u58f0\u660e\u6240\u6709\u529f\u80fd&#xff0c;\u5b9a\u4e49activationEvents\u63a7\u5236\u6fc0\u6d3b\u65f6\u673a&#xff0c;\u914d\u7f6ecommands\u3001views\u3001menus\u7b49\u3002\u5e76\u8981\u6c42\u7528UML\u5efa\u6a21\u5e76\u63d0\u4f9b\u5177\u4f53\u8be6\u5c3d\u6df1\u5165\u7684\u65b9\u6848\u3002 \u9700\u8981\u751f\u6210\u4e00\u4e2a\u8be6\u7ec6\u3001\u6df1\u5165\u7684\u7b54\u6848&#xff0c;\u5305\u62ec\u5bf9\u6bcf\u4e2a\u65b9\u9762\u7684\u9610\u8ff0&#xff0c;\u5e76\u63d0\u4f9bUML\u5efa\u6a21\u3002UML\u53ef\u4ee5\u5305\u62ec\u7c7b\u56fe\u3001\u6d3b\u52a8\u56fe\u3001\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/75687.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-12T15:05:21+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75687.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/75687.html\",\"name\":\"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-12T15:05:21+00:00\",\"dateModified\":\"2026-02-12T15:05:21+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/75687.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/75687.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75687.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/75687.html","og_locale":"zh_CN","og_type":"article","og_title":"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u8be6\u7ec6\u6df1\u5165\u9610\u8ff0\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4&#xff0c;\u7279\u522b\u5173\u6ce8package.json\u58f0\u660e\u90e8\u5206&#xff1a;\u5b9a\u4e49\u63d2\u4ef6\u80fd\u505a\u4ec0\u4e48&#xff0c;\u5728contributes\u4e2d\u58f0\u660e\u6240\u6709\u529f\u80fd&#xff0c;\u5b9a\u4e49activationEvents\u63a7\u5236\u6fc0\u6d3b\u65f6\u673a&#xff0c;\u914d\u7f6ecommands\u3001views\u3001menus\u7b49\u3002\u5e76\u8981\u6c42\u7528UML\u5efa\u6a21\u5e76\u63d0\u4f9b\u5177\u4f53\u8be6\u5c3d\u6df1\u5165\u7684\u65b9\u6848\u3002 \u9700\u8981\u751f\u6210\u4e00\u4e2a\u8be6\u7ec6\u3001\u6df1\u5165\u7684\u7b54\u6848&#xff0c;\u5305\u62ec\u5bf9\u6bcf\u4e2a\u65b9\u9762\u7684\u9610\u8ff0&#xff0c;\u5e76\u63d0\u4f9bUML\u5efa\u6a21\u3002UML\u53ef\u4ee5\u5305\u62ec\u7c7b\u56fe\u3001\u6d3b\u52a8\u56fe\u3001","og_url":"https:\/\/www.wsisp.com\/helps\/75687.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-12T15:05:21+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/75687.html","url":"https:\/\/www.wsisp.com\/helps\/75687.html","name":"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-12T15:05:21+00:00","dateModified":"2026-02-12T15:05:21+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/75687.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/75687.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/75687.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u63d2\u4ef6\u7cfb\u7edf\u5f00\u53d1\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4 - package.json\u58f0\u660e"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=75687"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75687\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=75687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=75687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=75687"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=75687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}