2017-10-20 203 views
3

我使用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文件中的內容?

回答

0

自己的解決方案:

我是,我添加了擴展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