web*_*.ic 21 html css visual-studio-code editorconfig
我使用VS Code作为编辑器.我们有一个.editorconfig格式配置的文件.我们在编辑器中使用extenion EditorConfig来格式化我们的HTML和CSS一般.我从这里安装了VS Code的扩展EditorConfig:https://github.com/editorconfig/editorconfig-vscode
我们的.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
Run Code Online (Sandbox Code Playgroud)
我找不到任何键盘快捷键,设置或其他.如何让我的扩展程序从.editorconfig文件中执行操作?
web*_*.ic 29
我自己的解决方案:
我遇到的问题是,我将扩展名添加editorconfig到了我vscode,但没有安装npm package它.所以仅仅将扩展名添加到你的vscode是不够的,你还要安装包,这样它就可以运行了.
我npm package像这样安装了全局:npm install -g editorconfig
之后我添加了扩展并启用了它.现在它完美无缺.
以下是所需npm包的链接:https://www.npmjs.com/package/editorconfig
以下是vscode所需扩展的链接:https://marketplace.visualstudio.com/items ? itemName = EditConfig.EditorConfig
小智 8
此外,我还需要打开“保存时编辑器格式”选项。
{
"editor.formatOnSave": true
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6553 次 |
| 最近记录: |