dc_zhaojjiang
dc_zhaojjiang
  • 发布:2023-03-21 19:08
  • 更新:2023-12-16 12:02
  • 阅读:1822

【报Bug】EditorConfig 不起作用

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows 11 22H2

HBuilderX版本号: 3.7.3

操作步骤:
  • 新建任意项目
  • 新建 .editorconfig 文件
root = true  

[*]  
charset = utf-8  
end_of_line = crlf  
indent_style = space  
indent_size = 4  
tab_width = 4  
max_line_length = 120  
trim_trailing_whitespace = true  
insert_final_newline = true  

[*.{html, js, vue, css, less, scss, sass}]  
indent_size = 4  
tab_width = 4  

[*.{lock, json}]  
indent_size = 2  
tab_width = 2
  • 新建测试 js 文件
(function () {  
    //   
})();
  • 在任意行末输入多余空格

预期结果:

Ctrl+S 保存后:

  • 行末多余空格被移除
  • 文件末尾新增空行

实际结果:

Ctrl+S 保存后:

  • 文件表现正常,即视觉上移除了行末多余空格,文件末尾新增了空行
  • 关闭文件后重新打开,或使用其他编辑器打开,文件内容是未被修正的,即包含行末多余空格,且行末无新增空行

bug描述:

.editorconfig 文件内容如下

root = true  

[*]  
charset = utf-8  
end_of_line = crlf  
indent_style = space  
indent_size = 4  
tab_width = 4  
max_line_length = 120  
trim_trailing_whitespace = true  
insert_final_newline = true  

[*.{html, js, vue, css, less, scss, sass}]  
indent_size = 4  
tab_width = 4  

[*.{lock, json}]  
indent_size = 2  
tab_width = 2

以上配置在 vscode 和 webstorm 中都可以正常作用,但是在 hbuilderx 中几乎不起作用,体现为:

  • 文件保存时无变化,无格式修正
  • 文件保存时,有格式修正,但是是无效修正,文件关闭后重新打开或在其他编辑器中打开时内容是修正之前的
2023-03-21 19:08 负责人:无 分享
已邀请:

最佳回复

DCloud

DCloud

HBuilderX 3.99.2023121601-alpha 已修复。

DCloud_HB_WTC

DCloud_HB_WTC

bug已确认, 后续会尽快修复, 感谢反馈

CodePencil

CodePencil

该问题3.8.7依然存在

1***@qq.com

1***@qq.com

3.8.12 依然存在,编辑器都不根据 .editorconfig 和 prettier 配置来的,相关开关和插件都安装了

要回复问题请先登录注册