{"id":547,"date":"2022-11-20T18:29:47","date_gmt":"2022-11-20T10:29:47","guid":{"rendered":"https:\/\/www.ccagml.com\/?p=547"},"modified":"2023-02-07T09:32:29","modified_gmt":"2023-02-07T01:32:29","slug":"%e8%b7%9f%e7%9d%80leetcode_extension%e5%ad%a6%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f-%e5%b7%a5%e5%8e%82%e6%a8%a1%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.ccagml.com\/?p=547","title":{"rendered":"\u8ddf\u7740vscode\u63d2\u4ef6\u5b66\u8bbe\u8ba1\u6a21\u5f0f-\u5de5\u5382\u6a21\u5f0f"},"content":{"rendered":"<h1>\u9879\u76ee\u5730\u5740<\/h1>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/ccagml\/leetcode_extension.git\" target=\"_blank\" rel=\"noopener\">github\u6e90\u7801\u5730\u5740<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ccagml.vscode-leetcode-problem-rating\" target=\"_blank\" rel=\"noopener\">visualstudio\u5e02\u573a\u53d1\u5e03\u5730\u5740<\/a><\/li>\n<\/ul>\n<h1>\u9879\u76ee\u80cc\u666f<\/h1>\n<p>leetcode_extension\u9879\u76ee\u662f\u4e00\u4e2aVisual Studio Code\u63d2\u4ef6,\u5728\u63d2\u4ef6\u5e02\u573a\u4e5f\u6709\u53d1\u5e03<\/p>\n<h1>\u5de5\u5382\u6a21\u5f0f\u76f8\u5173\u6982\u5ff5<\/h1>\n<ul>\n<li>\u521b\u5efa\u578b\u6a21\u5f0f<\/li>\n<li>\u4e3b\u8981\u89e3\u51b3\uff1a\u89e3\u51b3\u63a5\u53e3\u9009\u62e9\u95ee\u9898<\/li>\n<li>\u5982\u4f55\u89e3\u51b3\uff1a\u8ba9\u5176\u5b50\u7c7b\u5b9e\u73b0\u5de5\u5382\u63a5\u53e3\uff0c\u8fd4\u56de\u7684\u4e5f\u662f\u4e00\u4e2a\u62bd\u8c61\u7684\u4ea7\u54c1\u3002<\/li>\n<li>\u4f18\u70b9\uff1a\n<ol>\n<li>\u6839\u636e\u5b57\u7b26\u4e32\u540d\u79f0\u521b\u5efa\u5bf9\u8c61<\/li>\n<li>\u6269\u5c55\u6027\u9ad8\uff0c\u5982\u679c\u60f3\u589e\u52a0\u4e00\u4e2a\u5b50\u7c7b\u529f\u80fd\uff0c\u53ea\u8981\u6269\u5c55\u4e00\u4e2a\u5de5\u5382\u7c7b\u5c31\u53ef\u4ee5\u3002<\/li>\n<li>\u5c4f\u853d\u4ea7\u54c1\u7684\u5177\u4f53\u5b9e\u73b0\uff0c\u8c03\u7528\u8005\u53ea\u5173\u5fc3\u53ef\u4f7f\u7528\u7684\u63a5\u53e3\u3002<\/li>\n<\/ol>\n<\/li>\n<li>\u7f3a\u70b9\uff1a\n<ol>\n<li>\u6bcf\u589e\u52a0\u4e00\u4e2a\u529f\u80fd,\u90fd\u9700\u8981\u6539\u52a8\u589e\u52a0\u4e00\u4e2a\u5177\u4f53\u7684\u5b50\u7c7b\u548c\u5bf9\u8c61\u5b9e\u73b0\u5de5\u5382\u3002<\/li>\n<li>\u7c7b\u7684\u6570\u91cf\u53d8\u591a,\u590d\u6742\u5ea6\u4e0a\u5347,\u7cfb\u7edf\u5bf9\u5177\u4f53\u7c7b\u7684\u4f9d\u8d56<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<h1>\u9879\u76ee\u4e2d\u7684\u4ee3\u7801<\/h1>\n<ol>\n<li>\u8c03\u7528\u5165\u53e3\n<ul>\n<li>src\/rpc\/childMain.ts\n<pre><code class=\"line-numbers\">    let curApi: IApi | undefined = apiFactory.getApi(com_str);\n    curApi?.call(curApi?.callArg(process.argv));\n<\/code><\/pre>\n<\/li>\n<li>\u8fd9\u91cc\u6839\u636ecom_str\u4e00\u4e2a\u5b57\u7b26\u4e32\u540d\u79f0,\u4eceapiFactory\u4e2d\u83b7\u53d6\u5bf9\u5e94\u7684api\u5b50\u7c7b\u5bf9\u8c61,\u5e76\u6267\u884capi\u7684\u63a5\u53e3call<\/li>\n<\/ul>\n<\/li>\n<li>apiFactory\u7684\u5b9e\u73b0\n<ul>\n<li>src\/rpc\/factory\/apiFactory.ts\n<pre><code class=\"line-numbers\">import { cacheApi } from \".\/api\/cacheApi\";\nimport { pluginApi } from \".\/api\/pluginApi\";\n'''\n'''\nimport { IApi } from \".\/apiBase\";\n\nclass ApiFactory {\nconstructor() {}\ngetApi(api: string): IApi | undefined {\n    if (api == \"cache\") {\n    return cacheApi;\n    } else if (api == \"plugin\") {\n    return pluginApi;\n    }\n    }\n    return undefined;\n}\n}\nexport const apiFactory: ApiFactory = new ApiFactory();\n\n<\/code><\/pre>\n<ul>\n<li>\u6839\u636e\u5b57\u7b26\u4e32\u521b\u5efa\u5bf9\u5e94\u7684api\u529f\u80fd\u7c7b<\/li>\n<li>\u6240\u6709api\u529f\u80fd\u7c7b\u90fd\u7ee7\u627f\u81eaapiBase<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u6240\u6709api\u7684\u57fa\u7c7b\n<ul>\n<li>src\/rpc\/factory\/apiBase.ts\n<pre><code class=\"line-numbers\">export interface IApi {\n    callArg(arg);\n    call(arg): void;\n}\n\nexport class ApiBase implements IApi {\n    constructor() {}\n    callArg(arg: any) {\n        console.log(\"\u672a\u5b9e\u73b0callArg\", arg);\n    }\n    call(arg: any) {\n        console.log(\"\u672a\u5b9e\u73b0call\", arg);\n    }\n    api_argv() {\n        console.log(\"\u672a\u5b9e\u73b0api_argv\", arg);\n    }\n}\n\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u9879\u76ee\u5730\u5740 github\u6e90\u7801\u5730\u5740 visualstudio\u5e02\u573a\u53d1\u5e03\u5730\u5740 \u9879\u76ee\u80cc\u666f leetcode_extens<a href=\"https:\/\/www.ccagml.com\/?p=547\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u8ddf\u7740vscode\u63d2\u4ef6\u5b66\u8bbe\u8ba1\u6a21\u5f0f-\u5de5\u5382\u6a21\u5f0f<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/547"}],"collection":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=547"}],"version-history":[{"count":2,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/547\/revisions"}],"predecessor-version":[{"id":552,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/547\/revisions\/552"}],"wp:attachment":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}