{"id":21612,"date":"2024-11-19T12:52:53","date_gmt":"2024-11-19T04:52:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21612\/"},"modified":"2024-11-19T12:52:53","modified_gmt":"2024-11-19T04:52:53","slug":"vscode%e5%a6%82%e4%bd%95%e8%87%aa%e5%8a%a8%e6%8e%92%e7%89%88","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21612\/","title":{"rendered":"vscode\u5982\u4f55\u81ea\u52a8\u6392\u7248"},"content":{"rendered":"<blockquote><p>\n  \u901a\u8fc7\u4f7f\u7528\u5feb\u6377\u952e\u6216\u914d\u7f6e\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5728 visual studio code \u4e2d\u5b9e\u73b0\u4ee3\u7801\u81ea\u52a8\u6392\u7248\uff1a\u5feb\u6377\u952e\u6392\u7248\uff1awindows\/linux\uff1actrl + k, ctrl + f\uff1bmacos\uff1acmd + k, cmd + f\u914d\u7f6e\u8bbe\u7f6e\u6392\u7248\uff1a\u641c\u7d22\u5e76\u542f\u7528\u201ceditor.formatontype\u201d\uff0c\u6bcf\u6b21\u952e\u5165\u5b57\u7b26\u65f6\u81ea\u52a8\u6392\u7248\u5f53\u524d\u884c\u9ad8\u7ea7\u6392\u7248\u9009\u9879\uff1a\u81ea\u5b9a\u4e49\u6392\u7248\u89c4\u5219\uff08\u4f8b\u5982\uff0c\u7f29\u8fdb\u5927\u5c0f\u3001\u884c\u957f\uff09\uff0c\u5e76\u9009\u62e9\u6240\u9700\u7684\u6392\u7248\u5668\uff08\u4f8b\u5982\uff0cprettier\u3001eslint\uff09\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/07\/2024060707092038093.jpg\" class=\"aligncenter\" title=\"vscode\u5982\u4f55\u81ea\u52a8\u6392\u7248\u63d2\u56fe\" alt=\"vscode\u5982\u4f55\u81ea\u52a8\u6392\u7248\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Visual Studio Code \u81ea\u52a8\u6392\u7248<\/strong><\/p>\n<p>\u5728 Visual Studio Code\uff08\u7b80\u79f0 VSCode\uff09\u4e2d\uff0c\u4f7f\u7528\u5feb\u6377\u952e\u6216\u914d\u7f6e\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u4ee3\u7801\u81ea\u52a8\u6392\u7248\u3002<\/p>\n<p><strong>\u5feb\u6377\u952e\u6392\u7248<\/strong><\/p>\n<ul>\n<li> <strong>Windows\/Linux\uff1a<\/strong> Ctrl + K, Ctrl + F<\/li>\n<li> <strong>macOS\uff1a<\/strong> Cmd + K, Cmd + F<\/li>\n<\/ul>\n<p>\u4f7f\u7528\u6b64\u5feb\u6377\u952e\u540e\uff0cVSCode \u5c06\u6839\u636e\u5176\u5185\u7f6e\u89c4\u5219\u81ea\u52a8\u5bf9\u5f53\u524d\u6d3b\u52a8\u6587\u6863\u8fdb\u884c\u6392\u7248\u3002<\/p>\n<p><strong>\u914d\u7f6e\u8bbe\u7f6e\u6392\u7248<\/strong><\/p>\n<p>\u9664\u4e86\u5feb\u6377\u952e\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u8bbe\u7f6e\u8fdb\u884c\u81ea\u52a8\u6392\u7248\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00 <strong>\u8bbe\u7f6e<\/strong>\uff08Ctrl + , \u6216 Cmd + ,\uff09<\/li>\n<li>\u641c\u7d22\u201ceditor.formatOnType\u201d<\/li>\n<li>\u5c06\u5176\u8bbe\u7f6e\u4e3a <strong>true<\/strong> <\/li>\n<\/ol>\n<p>\u542f\u7528\u6b64\u8bbe\u7f6e\u540e\uff0c\u6bcf\u6b21\u952e\u5165\u5b57\u7b26\u65f6\uff0cVSCode \u90fd\u4f1a\u81ea\u52a8\u5bf9\u5f53\u524d\u884c\u8fdb\u884c\u6392\u7248\u3002<\/p>\n<p><strong>\u9ad8\u7ea7\u6392\u7248\u9009\u9879<\/strong><\/p>\n<p>\u9664\u4e86\u57fa\u672c\u7684\u6392\u7248\u529f\u80fd\u5916\uff0cVSCode \u8fd8\u63d0\u4f9b\u9ad8\u7ea7\u6392\u7248\u9009\u9879\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li> <strong>\u786e\u5b9a\u6392\u7248\u89c4\u5219\uff1a<\/strong> \u5728 <strong>\u8bbe\u7f6e<\/strong> \u4e2d\u641c\u7d22\u201ceditor.defaultFormatter\u201d\uff0c\u7136\u540e\u9009\u62e9\u6240\u9700\u7684\u6392\u7248\u5668\uff08\u4f8b\u5982\uff0cPrettier\u3001ESLint\uff09<\/li>\n<li> <strong>\u81ea\u5b9a\u4e49\u6392\u7248\u8bbe\u7f6e\uff1a<\/strong> \u5728 <strong>\u8bbe\u7f6e<\/strong> \u4e2d\u641c\u7d22\u201c[\u6392\u7248\u5668\u540d\u79f0].formatOptions\u201d\uff0c\u5373\u53ef\u81ea\u5b9a\u4e49\u6392\u7248\u5668\u89c4\u5219\uff08\u4f8b\u5982\uff0c\u7f29\u8fdb\u5927\u5c0f\u3001\u884c\u957f\uff09<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u5229\u7528\u8fd9\u4e9b\u9009\u9879\uff0c\u60a8\u53ef\u4ee5\u5bf9 VSCode \u7684\u81ea\u52a8\u6392\u7248\u529f\u80fd\u8fdb\u884c\u5fae\u8c03\uff0c\u4ee5\u6ee1\u8db3\u60a8\u7684\u7279\u5b9a\u4ee3\u7801\u98ce\u683c\u8981\u6c42\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u81ea\u52a8\u6392\u7248\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7\u4f7f\u7528\u5feb\u6377\u952e\u6216\u914d\u7f6e\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5728 visual studio code \u4e2d\u5b9e\u73b0\u4ee3\u7801\u81ea\u52a8\u6392\u7248\uff1a\u5feb\u6377\u952e\u6392\u7248\uff1awindows\/linux\uff1actrl + k, ctrl + f\uff1bmacos\uff1acmd + k, cmd + f\u914d\u7f6e\u8bbe\u7f6e\u6392\u7248\uff1a\u641c\u7d22\u5e76\u542f\u7528\u201ceditor.formatontype\u201d\uff0c\u6bcf\u6b21\u952e\u5165\u5b57\u7b26\u65f6\u81ea\u52a8\u6392\u7248\u5f53\u524d\u884c\u9ad8\u7ea7\u6392\u7248\u9009\u9879\uff1a\u81ea\u5b9a\u4e49\u6392\u7248\u89c4\u5219\uff08\u4f8b\u5982\uff0c\u7f29\u8fdb\u5927\u5c0f\u3001\u884c\u957f\uff09\uff0c\u5e76\u9009\u62e9\u6240\u9700\u7684\u6392\u7248\u5668\uff08\u4f8b\u5982\uff0cprettier\u3001eslint\uff09 \u5982\u4f55\u4f7f\u7528 Visual Studio Code \u81ea\u52a8\u6392\u7248 \u5728 Visual Studio Code\uff08\u7b80\u79f0 VSCode\uff09\u4e2d\uff0c\u4f7f\u7528\u5feb\u6377\u952e\u6216\u914d\u7f6e\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u4ee3\u7801\u81ea\u52a8\u6392\u7248\u3002 \u5feb\u6377\u952e\u6392\u7248 Windows\/Linux\uff1a Ctrl + K, Ctrl + F macOS\uff1a Cmd + K, Cmd + F \u4f7f\u7528\u6b64\u5feb\u6377\u952e\u540e\uff0cVSCode \u5c06\u6839\u636e\u5176\u5185\u7f6e\u89c4\u5219\u81ea\u52a8\u5bf9\u5f53\u524d\u6d3b\u52a8\u6587\u6863\u8fdb\u884c\u6392\u7248\u3002 \u914d\u7f6e\u8bbe\u7f6e\u6392\u7248 \u9664\u4e86\u5feb\u6377\u952e\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u8bbe\u7f6e\u8fdb\u884c\u81ea\u52a8\u6392\u7248\uff1a \u6253\u5f00 \u8bbe\u7f6e\uff08Ctrl + , \u6216 Cmd + ,\uff09 \u641c\u7d22\u201ceditor.formatOnType\u201d \u5c06\u5176\u8bbe\u7f6e\u4e3a true [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-21612","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=21612"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21612\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}