插件下载
在项目中引入以下文件夹 即可 ctrl + s自动格式化代码
- ①将以下代码保存为 settings.json文件,并放到.vscode文件夹中,并将.vscode文件夹保存到vue项目根目录即可
- ②文件夹目录图示
{
"files.autoSaveDelay": 1000,
"editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace",
"editor.tabSize": 2,
"editor.renderWhitespace": "all",
"editor.cursorStyle": "line",
"editor.multiCursorModifier": "ctrlCmd",
"editor.insertSpaces": true,
"editor.wordWrap": "on",
"editor.wordWrapColumn": 120,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
},
"files.associations": { "*.vue": "vue" },
"editor.autoClosingBrackets": "always",
"editor.autoClosingQuotes": "always",
"editor.autoIndent": true,
"editor.autoSurround": "languageDefined",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": false
},
"editor.codeActionsOnSaveTimeout": 10000,
"editor.codeLens": true,
"editor.colorDecorators": true,
"editor.copyWithSyntaxHighlighting": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.detectIndentation": false,
"editor.dragAndDrop": false,
"editor.emptySelectionClipboard": true,
"editor.folding": true,
"editor.foldingStrategy": "auto",
"editor.glyphMargin": true,
"editor.highlightActiveIndentGuide": true,
"editor.hover.delay": 300,
"editor.hover.enabled": true,
"editor.hover.sticky": true,
"editor.largeFileOptimizations": true,
"editor.letterSpacing": 0,
"editor.lightbulb.enabled": true,
"editor.lineHeight": 0,
"editor.lineNumbers": "on",
"editor.links": true,
"editor.matchBrackets": true,
"editor.maxTokenizationLineLength": 20000,
"editor.multiCursorMergeOverlapping": true,
"editor.parameterHints.enabled": true,
"editor.renderControlCharacters": true,
"editor.renderFinalNewline": true,
"editor.renderIndentGuides": true,
"editor.renderLineHighlight": "line",
"editor.selectionHighlight": true,
"editor.showFoldingControls": "mouseover",
"editor.showUnused": true,
"editor.tabCompletion": "onlySnippets",
"editor.tokenColorCustomizations": {},
"editor.trimAutoWhitespace": true,
"editor.useTabStops": true,
"editor.wrappingIndent": "same",
"editor.fontLigatures": false,
"editor.fontWeight": "normal",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnSaveTimeout": 10000,
"editor.formatOnType": true,
"editor.acceptSuggestionOnCommitCharacter": true,
"editor.acceptSuggestionOnEnter": "on",
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
},
"editor.snippetSuggestions": "top",
"editor.suggest.filteredTypes": {
"keyword": true
},
"editor.suggest.filterGraceful": true,
"editor.suggest.localityBonus": false,
"editor.suggest.maxVisibleSuggestions": 12,
"editor.suggest.shareSuggestSelections": false,
"editor.suggest.showIcons": true,
"editor.suggest.snippetsPreventQuickSuggestions": true,
"editor.suggestFontSize": 0,
"editor.suggestLineHeight": 0,
"editor.suggestOnTriggerCharacters": true,
"editor.suggestSelection": "first",
"editor.wordBasedSuggestions": true,
"files.autoGuessEncoding": false,
"files.defaultLanguage": "",
"files.enableTrash": true,
"files.encoding": "utf8",
"files.eol": "auto",
"files.insertFinalNewline": true,
"files.maxMemoryForLargeFilesMB": 4096,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
},
"workbench.tree.indent": 12,
"workbench.editor.tabSizing": "fit",
"window.title": "${activeEditorShort}${separator}${rootName}",
"problems.autoReveal": true,
"problems.decorations.enabled": true,
"auto-close-tag.activationOnLanguage": [
"xml",
"php",
"blade",
"ejs",
"jinja",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"plaintext",
"markdown",
"vue",
"liquid",
"erb",
"lang-cfml",
"cfml",
"HTML (Eex)"
],
"auto-close-tag.enableAutoCloseSelfClosingTag": true,
"auto-close-tag.enableAutoCloseTag": true,
"auto-close-tag.excludedTags": [
"area",
"base",
"br",
"col",
"command",
"embed",
"hr",
"img",
"input",
"keygen",
"link",
"meta",
"param",
"source",
"track",
"wbr"
],
"auto-close-tag.fullMode": false,
"auto-close-tag.SublimeText3Mode": false,
"auto-rename-tag.activationOnLanguage": ["*"],
"emmet.excludeLanguages": ["markdown"],
"emmet.extensionsPath": "",
"emmet.includeLanguages": {},
"emmet.optimizeStylesheetParsing": true,
"emmet.preferences": {},
"emmet.showAbbreviationSuggestions": true,
"emmet.showExpandedAbbreviation": "always",
"emmet.showSuggestionsAsSnippets": false,
"emmet.syntaxProfiles": {},
"emmet.triggerExpansionOnTab": false,
"emmet.variables": {},
"eslint.alwaysShowStatus": true,
"eslint.autoFixOnSave": false,
"eslint.codeAction.disableRuleComment": {
"enable": true,
"location": "separateLine"
},
"eslint.codeAction.showDocumentation": {
"enable": true
},
"eslint.enable": true,
"eslint.nodePath": null,
"eslint.options": {
"extensions": [".js", ".vue"]
},
"eslint.packageManager": "npm",
"eslint.provideLintTask": false,
"eslint.quiet": false,
"eslint.run": "onType",
"eslint.runtime": null,
"eslint.trace.server": "off",
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "vue", "autoFix": true },
{ "language": "html", "autoFix": true }
],
"eslint.workingDirectories": [],
"indenticator.color.dark": "#888",
"indenticator.color.light": "#999",
"indenticator.hover.peekBack": 1,
"indenticator.hover.peekBlockPlaceholder": "...",
"indenticator.hover.peekForward": 0,
"indenticator.hover.trimLinesShorterThan": 2,
"indenticator.inner.color.dark": "",
"indenticator.inner.color.light": "#999",
"indenticator.inner.hover.peekBack": 1,
"indenticator.inner.hover.peekBlockPlaceholder": "...",
"indenticator.inner.hover.peekForward": 0,
"indenticator.inner.hover.trimLinesShorterThan": 2,
"indenticator.inner.showHighlight": false,
"indenticator.inner.showHover": false,
"indenticator.inner.style": "inset",
"indenticator.inner.width": 1,
"indenticator.languageSpecific": {},
"indenticator.showCurrentDepthInStatusBar": true,
"indenticator.showHighlight": true,
"indenticator.showHover": false,
"indenticator.style": "inset",
"indenticator.width": 1,
"html-css-class-completion.enableEmmetSupport": false,
"html-css-class-completion.excludeGlobPattern": "",
"html-css-class-completion.includeGlobPattern": "**/*.{css,html}",
"node-module-intellisense.autoStripExtensions": [
".js",
".jsx",
".ts",
".d.ts",
".tsx"
],
"node-module-intellisense.modulePaths": [],
"node-module-intellisense.scanBuiltinModules": true,
"node-module-intellisense.scanDevDependencies": true,
"node-module-intellisense.scanFileModules": true,
"npm-intellisense.importDeclarationType": "const",
"npm-intellisense.importES6": true,
"npm-intellisense.importLinebreak": ";\r\n",
"npm-intellisense.importQuotes": "'",
"npm-intellisense.packageSubfoldersIntellisense": false,
"npm-intellisense.recursivePackageJsonLookup": true,
"npm-intellisense.scanDevDependencies": false,
"npm-intellisense.showBuildInLibs": false,
"path-intellisense.absolutePathToWorkspace": true,
"path-intellisense.autoSlashAfterDirectory": false,
"path-intellisense.extensionOnImport": false,
"path-intellisense.mappings": {},
"path-intellisense.showHiddenFiles": false,
"vetur.completion.autoImport": true,
"vetur.completion.tagCasing": "kebab",
"vetur.completion.useScaffoldSnippets": true,
"vetur.dev.logLevel": "INFO",
"vetur.dev.vlsPort": -1,
"vetur.experimental.templateInterpolationService": false,
"vetur.format.defaultFormatter.css": "prettier",
"vetur.format.defaultFormatter.html": "prettyhtml",
"vetur.format.defaultFormatter.js": "vscode-typescript",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
"vetur.format.defaultFormatter.less": "prettier",
"vetur.format.defaultFormatter.postcss": "prettier",
"vetur.format.defaultFormatter.scss": "prettier",
"vetur.format.defaultFormatter.stylus": "stylus-supremacy",
"vetur.format.defaultFormatter.ts": "prettier",
"vetur.format.defaultFormatterOptions": {
"prettyhtml": {
"printWidth": 80,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
},
"vetur.format.enable": true,
"vetur.format.options.tabSize": 2,
"vetur.format.options.useTabs": false,
"vetur.format.scriptInitialIndent": false,
"vetur.format.styleInitialIndent": false,
"vetur.grammar.customBlocks": {
"docs": "md",
"i18n": "json"
},
"vetur.trace.server": "off",
"vetur.validation.script": true,
"vetur.validation.style": true,
"vetur.validation.template": true
}