在VScode中键入一行代码并点击后在React中输入该行代码选项卡
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在VScode中键入一行代码并点击后在React中输入该行代码选项卡相关的知识,希望对你有一定的参考价值。
所以发生的事情就是说我有一个像这样的结构:
编辑:经过多一点麻烦后我注意到,如果我只是键入线路并不重要。如果我将光标放在一行的末尾并按Enter键,它会自动标记它。
(
<div>
<h2>Hello</h2>
<div>
)
我开始打字:
(
<div>
<h2>Hello</h2>
<p>hello</p>(cursor here at the end)
<div>
)
一旦我按下键盘上的Enter进入下一行,就会发生这种情况:
(
<div>
<h2>Hello</h2>
<p>hello</p>
(cursor here)
<div>
)
正如你所看到的那样,我刚输入的行被撞到了一个标签上,我不知道为什么会发生这种情况。任何线索?
这是我的User Settings
{
"editor.formatOnSave": true,
"prettier.singleQuote": true,
"editor.formatOnType": true,
"editor.detectIndentation": false,
"prettier.eslintIntegration": true,
"eslint.autoFixOnSave": true,
"window.zoomLevel": 0,
"workbench.iconTheme": "eq-material-theme-icons",
"workbench.colorTheme": "Material Theme",
"editor.fontSize": 15,
"editor.lineHeight": 24,
"materialTheme.cache.workbench.settings": {
"themeColours": "Palenight",
"accent": "Lime"
},
"workbench.colorCustomizations": {
"activityBarBadge.background": "#7CB342",
"list.activeSelectionForeground": "#7CB342",
"list.inactiveSelectionForeground": "#7CB342",
"list.highlightForeground": "#7CB342",
"scrollbarSlider.activeBackground": "#7CB34250",
"editorSuggestWidget.highlightForeground": "#7CB342",
"textLink.foreground": "#7CB342",
"progressBar.background": "#7CB342",
"pickerGroup.foreground": "#7CB342",
"tab.activeBorder": "#7CB342"
},
"emmet.triggerExpansionOnTab": true,
"emmet.showSuggestionsAsSnippets": true,
"editor.snippetSuggestions": "top",
"emmet.includeLanguages": {
"javascript": "javascriptreact",
},
}
答案
这一行是导致它的原因:
"editor.formatOnType": true
这需要设置为false。
"editor.formatOnType": false
以上是关于在VScode中键入一行代码并点击后在React中输入该行代码选项卡的主要内容,如果未能解决你的问题,请参考以下文章
怎么让VScode中的beautify插件不格式化react项目中的jsx代码