


How to configure vue in VSCode and use Vetur language recognition engine!
How to configure vue in VSCode? Identify vue syntax? The following article will introduce to you how to use Vetur as a language recognition engine. Let us create the best VSCode for vuers!
After downloading vscode from the official website, the installation opens and you are prompted to install a Chinese language pack. Follow the prompts to install and restart, and the interface becomes a Chinese interface. [Recommended learning: "vscode tutorial"]
uses Materia Theme
as the interface theme. The interface style is very clean, the colors are eye-friendly, and I feel good when writing code. Follow the refreshing~
icon display uses Material Icon Theme
, the file icon is very complete, and it looks very good with Materia Theme
because I The vue technology stack is used, so it is necessary to identify the vue syntax. It is recommended to follow Vetur
as the language recognition engine to provide syntax recognition, formatting, and related tips.
Configuration formatting
vetur comes with its own formatting tool and uses the prettier
formatting scheme. For details, please see the configuration and use ctrl/command,
Open settings
You can see that the js formatting engine uses prettier
by default, but it is recommended to use eslint
unification for general projects Source code format, so vuter
needs to be adapted to eslint
Install eslint and prettier extensions
Follow eslint Extension tip, to use eslint normally, you must also format it globally according to eslint
npm install -g eslint
. The following is my vscode custom settings
{ "workbench.iconTheme": "eq-material-theme-icons", "workbench.colorTheme": "Material Theme", "materialTheme.fixIconsRunning": false, "editor.fontSize": 16, // 字体大小 // 以下是代码格式化配置 "editor.formatOnSave": true, // 每次保存的时候自动格式化 "editor.tabSize": 2, // 代码缩进修改成2个空格 "eslint.autoFixOnSave": false, // 每次保存的时候将代码按eslint格式进行修复 "prettier.eslintIntegration": true, // 让prettier使用eslint的代码格式进行校验 "prettier.semi": false, // 去掉代码结尾的分号 "prettier.singleQuote": true, // 使用带引号替代双引号 "javascript.format.insertSpaceBeforeFunctionParenthesis": true, // 让函数(名)和后面的括号之间加个空格 "vetur.format.defaultFormatter.html": "js-beautify-html", //格式化.vue中html "vetur.format.defaultFormatter.js": "vscode-typescript", //让vue中的js按编辑器自带的ts格式进行格式化 "vetur.format.defaultFormatterOptions": { "js-beautify-html": { "wrap_attributes": "force-aligned" //属性强制折行对齐 } }, "eslint.validate": [ //开启对.vue文件中错误的检查 "javascript", "javascriptreact", { "language": "html", "autoFix": true }, { "language": "vue", "autoFix": true } ] }
Every time I save Formatting, liberating labor, the effect is as follows
Commonly used plug-ins
Auto Rename Tag
When changing the tag name, automatically change the name of the closed tagBookmarks
Bookmark plug-in, record key points of the code, easier to get the corresponding points during reviewBracket Pair Colorizer
Bracket coloring, for multiple embedded The set of brackets corresponds to accurate identificationChange Case
When declaring code variables, you can switch existing variables to camel case, constant, or other stylesCodelf
I get angry when I talk about code naming. Half of the programming time is spent thinking about how to name it more appropriately and appropriately. With this artifact, although it cannot solve the difficult problem of naming, it at least provides a solution. Suggestion, can solve it faster and avoid imagining thingscssrem
A VSCode plug-in for converting CSS values to REM
html The font I designed here is to use 14px, so when transferring, the corresponding relationship should be 1rem = 14px, so it needs to be configured in the user settings
// 第三方插件cssrem配置 "cssrem.rootFontSize": 14
Vue Peek
Right-click to open or preview the referenced componentfilesize
Calculate the source file size and display it in the lower left cornerGitLens
git history viewing, submission record viewing, history comparison, version rollback, artifact Not parsingImport Cost
Calculate the file size introduced by importIntelliSense for CSS class names in HTML
class is based on the definition found in the workspace or Provides CSS class name completion for HTML attributes via external files referenced by the link element.
Because we use vue language to develop, we also need to configure css prompts for vue
"html-css-class-completion.includeGlobPattern": "**/*.{css,html,vue}"
Live Server
Provides support for Real-time service preview of HTML, instant refresh of code changesPath Intellisense
Path introduction of intelligent sensingnpm -intellisense
npm module introduces intelligent sensingRegExp Preview and Editor
Regular expression preview and editingSettings Sync
Synchronize your vscode settings, including plug-ins, themes and all user dataSVG Viewer
Preview SVGTodo Tree
Display the TODO list in your code##translate
Translate
Tslint
ts code format detection tool
Version Lens
npm version detection
vscode-fileheader
Generate document comment header
JavaScript (ES6) code snippets
es code snippets
Copy Relative Path
Copy relative path
Programming Video! !
The above is the detailed content of How to configure vue in VSCode and use Vetur language recognition engine!. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

Netflix uses React as its front-end framework. 1) React's componentized development model and strong ecosystem are the main reasons why Netflix chose it. 2) Through componentization, Netflix splits complex interfaces into manageable chunks such as video players, recommendation lists and user comments. 3) React's virtual DOM and component life cycle optimizes rendering efficiency and user interaction management.

How to solve the problem that Chinese comments in Visual Studio Code become question marks: Check the file encoding and make sure it is "UTF-8 without BOM". Change the font to a font that supports Chinese characters, such as "Song Style" or "Microsoft Yahei". Reinstall the font. Enable Unicode support. Upgrade VSCode, restart the computer, and recreate the source file.

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

Common commands for VS Code terminals include: Clear the terminal screen (clear), list the current directory file (ls), change the current working directory (cd), print the current working directory path (pwd), create a new directory (mkdir), delete empty directory (rmdir), create a new file (touch) delete a file or directory (rm), copy a file or directory (cp), move or rename a file or directory (mv) display file content (cat) view file content and scroll (less) view file content only scroll down (more) display the first few lines of the file (head)

Causes and solutions for the VS Code terminal commands not available: The necessary tools are not installed (Windows: WSL; macOS: Xcode command line tools) Path configuration is wrong (add executable files to PATH environment variables) Permission issues (run VS Code as administrator) Firewall or proxy restrictions (check settings, unrestrictions) Terminal settings are incorrect (enable use of external terminals) VS Code installation is corrupt (reinstall or update) Terminal configuration is incompatible (try different terminal types or commands) Specific environment variables are missing (set necessary environment variables)
