当前位置:网站首页>Talk about vscode configuration settings JSON knows why (with a large number of configurations)
Talk about vscode configuration settings JSON knows why (with a large number of configurations)
2022-06-12 07:00:00 【Chenai】
Preface
vscode Configuration of settings.json It's a platitude , As time goes by, we may change him very frequently , But we should try to avoid a problem :
️ With a certain item but I don't know its function ️
It's really just a Know why The problem of .
Based on this topic , This article will analyze my settings.json , Hope to bring some help to readers .
Text
Some of the following plug-ins are configured from :
The plug-ins mentioned in .
Save automatically
{
// Save automatically
"files.autoSave": "afterDelay",
}
Use vscode It is strongly recommended to enable autosave , Because lightning coding can't be done manually save , At the same time, you should have the ability to succeed once code style .
typeface
{
// Font size
"editor.fontSize": 13,
// typeface chinese Japanese language にほんご
"editor.fontFamily": "'JetBrains Mono NL',' Isoline '",
}
For font size , Generally, the screen is recommended to use 13 code , It's not particularly big , The amount of information presented is also sufficient .
Font recommendation , English is recommended JB The official of the family barrel JetBrains Mono Series of non contiguous Fonts , That is to say JetBrains Mono NL , You can jetbrains mono Download and install the font in its entirety , You can use it now . For isolated development scenarios against the sky , Please refer to the following to configure the font :
It is recommended to use in Chinese Isoline , This font is for in / Japan Text can provide a very smooth body feeling , There will be no edges and corners .
settings sync
{
// sync git Sync
"sync.gist": "......",
"sync.autoUpload": false,
"sync.autoDownload": false,
}
In the early vscode Of settings Recommended Settings Sync The plug-in is synchronized to github gist On , Although later ms Acquisition github Later, I had financial support vscode Internal synchronization , But it is not very easy to use , Secondly, try not to do single point disaster recovery .
In order to ensure adequate safety , I still use Settings Sync Do manual sync Disaster tolerant ( As shown above , Automatic uploading and downloading are turned off , All manual use cmd + shift + p choice Sync: to update / Upload the configuration Command for manual synchronization ).
If you want to use , After installing the plug-in , Agree to authorize according to the prompt github gist Just visit .
Code hinting
{
// code snippet
"editor.suggestSelection": "recentlyUsedByPrefix",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
}
I won't elaborate here , Our strategy is :
recentlyUsedByPrefix: Press used prefix Prefix first match , It is convenient to select our preferred items .automaticallyOverrodeDefaultValue: Automatically override the priority defaults for prompts , It's also to keep the preference .
New window
{
// New window
"workbench.startupEditor": "newUntitledFile",
"workbench.editor.enablePreview": false,
}
vscode The default strategy is The new window overwrites the current window by default + The default preview state opens the file , This makes it inconvenient to switch between multiple files , Use double click to open problems that do not conform to customary habits .
So we went through newUntitledFile Keeping new files open must be an independent new window , collocation enablePreview: false Cancel preview mode , Ensure that the editing mode is stable .
Icon series
{
// Turn on material icons
"workbench.iconTheme": "material-icon-theme",
}
I like to use file / Folder icons The icon is Material Icon Theme , This plug-in has a large number of built-in icons , And it covers a lot of tools ( Such as commitlint / lerna etc. ) Configuration file for icon, It is very comfortable to use .
Document hierarchy
{
// Folder compact display
"explorer.compactFolders": false,
}
By default ,vscode and github bring into correspondence with , That is, when there is only one folder under a folder , Will skip the folder in the middle , The display will be abbreviated to one line ( This is in java And other object-oriented file hierarchies ), But for the FE scene , It is not necessary to omit , The abbreviation will affect the layout of the project architecture , Therefore, it is recommended to close the folder abbreviation .
End of file
{
// Default lf ending
"files.eol": "\n",
}
This is an old classic question , First, let's make two points clear :
linux/mac/winThe end of the file on is differentGit For different endings , Inconsistencies may arise on different platforms
Usually , We will use the workspace format .editorconfig collocation EditorConfig for VS Code The plug-in solves this problem , Uniformly specify it as linux Terminator lf :
# .editorconfig
root = true
[*]
end_of_line = lf
But for not configured .editorconfig There is nothing we can do in our work area , So we should fundamentally solve this problem , The best way is from vscode Lock it up lf ending .
Git scm
{
// git
"git.enableSmartCommit": true,
}
Turn on intelligence commit, This is useful for scm gui Panels help a lot , Can help us in add When you get to the staging area , Use cmd + enter It's automatic add and commit all change .
notes : If you're not vscode visualization Git gui Users , There is no need to configure this item , But it is recommended to use for simple operations vscode Native gui, This is in check change It's very convenient , And it can be very flexible to deal with most basic scenarios ( push / merge etc. )
vscode update
{
// vscode update tips
"update.mode": "none",
}
close vscode Automatic update prompt , We can upgrade manually on a regular basis , Pay attention to a comprehensive understanding of changelog For instant access to new features .
Delete confirmation
{
// delete confirm
"explorer.confirmDelete": false,
}
Flexible development does not require the deletion of secondary confirmations , Because we want the smooth and seamless operation , You can also use cmd + z Undo the deletion .
Terminal behavior
{
// Internal terminal
"code-runner.runInTerminal": true,
"code-runner.fileDirectoryAsCwd": true,
}
adopt code runner Plug in to make every time you open the terminal in the currently selected folder , This requires some configuration , See :
vscode extension
{
// vscode Suggested expansion
"extensions.ignoreRecommendations": false,
// extension update
"extensions.autoUpdate": "onlyEnabledExtensions",
}
about vscode Plug in behavior , We make several configurations :
close vscode Recommended plug-in behavior . As a mature developer, you should understand what you are doing , Know what you need 、 It doesn't need anything , So we don't need “ primary ” A hint of .
Only enabled plug-ins can turn on automatic update Update features , Prevent the disabled plug-ins from wasting resources while updating in the background .
Translation plug-ins
{
// Google Translate plugin configuration
"googleTranslateExt.replaceText": true,
"commentTranslate.targetLanguage": "zh-CN",
// translation
"varTranslation.translationEngine": "google",
}
Selection of translation plug-ins , It is recommended to use three models at the same time , See :
meanwhile , We configure it as follows :
googleTranslateExt.replaceText: Open translation replacement , bring Google Translate The plug-in can overwrite our Chinese selection with English .( Of course , I would recommend deepl Translation )commentTranslate.targetLanguage: Appoint Comment Translate The translation language object of the plug-in is Chinese , For our convenience hover View the Chinese translation of the notes .varTranslation.translationEngine: Appoint Hump translation assistant Translation api go google , According to your network , It is recommended to choose the best translation source on your own network ( Of course, the quality of translation is also very different ).
File format
{
// Default Formatting , Uniform for prettier
"editor.defaultFormatter": "esbenp.prettier-vscode",
// prettier global config
"prettier.semi": false,
"prettier.printWidth": 80,
"prettier.singleQuote": true,
}
A hundred flowers bloom in the early stage , We also need Beautify / Beautify css And other plug-ins configure different formatters according to different files , But now prettier Has developed very mature ,prettier The supported file formats are prettier Format best practices , So we configure the Default Formatting behavior to use prettier that will do , This can save us a lot of formatting configuration for different files .
It should be noted that ,prettier Not all default configurations are best practices , It is recommended to configure the global default behavior , In this way, you can enjoy the best formatting behavior in any file .
eslint
{
// eslint config
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
},
// eslint Automatically identify workspaces
"eslint.workingDirectories": [{
"mode": "auto" }],
}
about eslint All configurations need to be installed eslint Plug in for ( ESLint ), And then cmd + s Save auto repair open ( source.fixAll.eslint ), It is convenient for us to format the code manually at any time .
At the same time monorepo scene ,eslint Plug ins tend to look at the top eslintrc The configuration file , Single... Is ignored project Folder eslint To configure , So we need to open auto Automatic pattern recognition , To better cope with monorepo scene .
Vue
{
// prevent vetur Report errors
"vetur.validation.template": false,
// "vetur.validation.script": false,
}
stay vue 2 At the time of development , Use vetur Be supported , In order to prevent template Parse error , We need to turn off the corresponding verification behavior , This is also an old saying .
According to the circumstances , You may also need to turn it off script The verification behavior of the zone .
svg
{
// svg preview config
"svg.preview.mode": "svg",
}
preview svg View the source code directly , Instead of previewing the image , This is convenient for us to modify the color and other behaviors .
In preview , It is recommended that you use a plug-in to support svg preview .
live-server
{
// liveserver Turn off the service prompt
"liveServer.settings.donotShowInfoMsg": true,
}
It is often necessary to start locally server when , It often uses Live Server plug-in unit , The plug-in is starting server Then there will be a startup port A hint of , You need to turn it off manually every time , For developers who often use the plug-in , You can omit this step from wasting time .
code diff
{
// diff
"diffEditor.ignoreTrimWhitespace": false,
}
vscode Of diff Behavior ignores trailing empty characters by default , In order to control the end of the file more accurately , We need to be more sensitive , So turn off ignore behavior .
Color brackets / Guide
{
// Original reproduction Color brackets
"workbench.colorCustomizations": {
"editorBracketHighlight.foreground1": "#ffd700",
"editorBracketPairGuide.activeBackground1": "#ffd7007f",
"editorBracketHighlight.foreground2": "#da70d6",
"editorBracketPairGuide.activeBackground2": "#da70d67f",
"editorBracketHighlight.foreground3": "#87cefa",
"editorBracketPairGuide.activeBackground3": "#87cefa7f",
"editorBracketHighlight.foreground4": "#ffd700",
"editorBracketPairGuide.activeBackground4": "#ffd7007f",
"editorBracketHighlight.foreground5": "#da70d6",
"editorBracketPairGuide.activeBackground5": "#da70d67f",
"editorBracketHighlight.foreground6": "#87cefa",
"editorBracketPairGuide.activeBackground6": "#87cefa7f",
"editorBracketHighlight.unexpectedBracket.foreground": "#ff0000",
},
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
}
because vscode since v1.60 Start native support for colored brackets and guides , And excellent performance , We from Bracket-Pair-Colorizer Plug in migration , See :
The theme
{
// theme
"workbench.colorTheme": "Dracula",
}
I like it very much No red Dark theme Dracula Official .
jsx attr auto brackets
{
// jsx auto complete
"typescript.preferences.jsxAttributeCompletionStyle": "auto",
"javascript.preferences.jsxAttributeCompletionStyle": "auto",
}
vscode v1.63 Yes jsx The automatic completion of parentheses for attributes is more intelligent , See JSX attribute completions .
inline complete
{
// inline complete
"editor.inlineSuggest.enabled": true,
}
Use Tabnine or github copilot And other automatic completion plug-ins .
other
{
// svg formatter
"[svg]": {
"editor.defaultFormatter": "jock.svg"
},
// python format
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
// python language server engine
"python.languageServer": "Pylance",
}
Postscript
In order to really do “ Know why ” , Instead of simply copying and pasting , This article will not give a complete set of configurations , Plus the difference in habits , Please choose what you need .
边栏推荐
- Redis supports data structure types
- SQL injection read / write file
- d的扩大@nogc
- Zhang Chi: is process a panacea?
- 数据库语法相关问题,求解一个正确语法
- JDE 对象管理工作平台介绍及 From 的使用
- Torch models trained in higher versions report errors in lower versions
- It only takes 10 minutes to understand the underlying principle of NiO
- Install MySQL tutorial
- Category 7
猜你喜欢

JDE 对象管理工作平台介绍及 From 的使用
![Leetcode: Sword finger offer 67 Convert string to integer [simulation + segmentation + discussion]](/img/32/16751c0a783cc3121eddfe265e2f4f.png)
Leetcode: Sword finger offer 67 Convert string to integer [simulation + segmentation + discussion]
![[image denoising] image denoising based on nonlocal Euclidean median (nlem) with matlab code](/img/1e/386cf601f8f60197adbc853f321472.png)
[image denoising] image denoising based on nonlocal Euclidean median (nlem) with matlab code

Upload file (post form submission form data)

How to build your own website (using the pagoda panel)
![[image detection] SAR image change detection based on depth difference and pcanet with matlab code](/img/c7/05bfa88ef1a4a38394b81755966e46.png)
[image detection] SAR image change detection based on depth difference and pcanet with matlab code
![Leetcode: Sword finger offer 63 Maximum profit of stock [record prefix minimum and or no brain segment tree]](/img/3a/3bba4fc11469b4cf31c38e35a81ac1.png)
Leetcode: Sword finger offer 63 Maximum profit of stock [record prefix minimum and or no brain segment tree]

初中学历,从不到3K,到月薪30K+,不设限的人生有多精彩

Bid farewell to the charged xshell, and the free function of tabby is more powerful

丢掉丑陋的 toast,会动的 toast 更有趣
随机推荐
Lambda function perfect use guide
android studio 利用数据库实现登录注册界面功能
Summary from November 29 to December 5
应届生苦恼:是去华为拿1万多低薪,还是去互联网拿2万多高薪
libprint2
The seventh day of June training - hash table
Solution: unsatisfieddependencyexception: error creating bean with name 'authaspect':
Beginners can't tell the difference between framework and class library
PowerDesigner connects to entity database to generate physical model in reverse
"I was laid off by a big factory"
【图像去噪】基于偏微分方程(PDE)实现图像去噪附matlab代码
Apache POI import export excel file
五月集训(第28天)——动态规划
[image denoising] image denoising based on partial differential equation (PDE) with matlab code
Process when solving vagrant up_ builder. rb:43:in `join‘: incompatible character encodings: GBK and UTF-8
descheduler 二次调度让 Kubernetes 负载更均衡
(14) The software version number is displayed in the flash window of blender source code analysis
SQL injection read / write file
Solution: content type 'application/x-www-form-urlencoded; charset=UTF-8‘ not supported
Android studio uses database to realize login and registration interface function