Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html VS代码的编辑器配置不工作_Html_Css_Visual Studio Code_Editorconfig - Fatal编程技术网

Html VS代码的编辑器配置不工作

Html VS代码的编辑器配置不工作,html,css,visual-studio-code,editorconfig,Html,Css,Visual Studio Code,Editorconfig,我使用VS代码作为编辑器。我们有一个.editorconfig文件,其中的格式配置为。在我们的编辑器中,我们都使用Extension EditorConfig来格式化HTML和CSS。我已在此处安装了VS代码的扩展编辑器配置: 我们的.editorconfig文件如下所示: # This is the top-most .editorconfig file (do not search in parent directories) root = true ### All files [*] #

我使用VS代码作为编辑器。我们有一个
.editorconfig
文件,其中的格式配置为。在我们的编辑器中,我们都使用Extension EditorConfig来格式化HTML和CSS。我已在此处安装了VS代码的扩展编辑器配置:

我们的.editorconfig文件如下所示:

# This is the top-most .editorconfig file (do not search in parent directories)
root = true

### All files
[*]
# Force charset utf-8
charset = utf-8
# Indentation
indent_style = tab
indent_size = 4
# line breaks and whitespace
insert_final_newline = true
trim_trailing_whitespace = true
# end_of_line = lf

### Frontend files
[*.{css,scss,less,js,json,ts,sass,php,html,hbs,mustache,phtml,html.twig}]

### Markdown
[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

### YAML
[*.yml]
indent_style = space
indent_size = 2

### Specific files
[{package,bower}.json]
indent_style = space
indent_size = 2

我找不到任何键盘快捷键、设置或其他。如何让我的扩展名从
.editorconfig
文件中执行操作?

我自己的解决方案:

我遇到的问题是,我将扩展名
editorconfig
添加到了我的
vscode
,但没有为它安装
npm包。因此,仅仅在vscode中添加扩展是不够的,您还必须安装软件包,这样它才能运行

我像这样安装了
npm包
global:
npm安装-g editorconfig

之后,我添加了扩展并启用了它。现在它工作得很好

以下是所需npm包的链接:


以下是vscode所需扩展名的链接:

此外,我还需要打开“保存时编辑器格式”选项

{
   "editor.formatOnSave": true
}

这个解决方案也对我起了作用。这是疯狂的,扩展没有检查和警告你这一点@johey至少,我希望能在
vscode
扩展的描述中找到这些信息……我只是自己想出来,运气好:)它对我不起作用。我安装了node、editorconfig包和vscode扩展。有什么东西不见了吗?在vscode设置中,也许?@Nachokhan确保您没有处理样式的“竞争”插件,并且覆盖您的
editorconfig
设置。