EditorConfig for VS Code not working

问题描述:

我使用VS Code作为编辑器。我们有一个.editorconfig文件,其中包含格式配置。我们都在编辑器中使用Extenion EditorConfig来格式化我们的HTML和CSS常规。我已经安装了VS代码扩展EditorConfig从这里:https://github.com/editorconfig/editorconfig-vscodeEditorConfig for VS Code not working

我们.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文件中的内容?

自己的解决方案:

我是,我添加了扩展editorconfigvscode,但并没有为它安装npm package的问题。所以仅仅将扩展添加到您的vscode是不够的,您还需要安装该软件包,以便它可以运行。

我安装了npm package全球这样的:npm install -g editorconfig

之后,我加入了扩展并启用它。现在它运作完美。

这里是链接到所需的NPM包:https://www.npmjs.com/package/editorconfig

这里是链接到您的vscode所需extenion:https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig