CppCXY / EmmyLuaCodeStyle

fast, powerful, and feature-rich Lua formatting and checking tool.
MIT License
139 stars 27 forks source link

indent_style没生效 #103

Open actboy168 opened 1 year ago

actboy168 commented 1 year ago

像这个文件ninja_syntax.lua,我已经设置了indent_style=space,但格式化之后缩进还是tab

CppCXY commented 1 year ago

sumneko 要求缩进采用编辑器配置, 所以配置里面的indent_style会被无视

actboy168 commented 1 year ago

编辑器配置是vscode自动检测的缩进配置吗?我觉得这个不应该比自己设置的配置优先级高。 @sumneko

actboy168 commented 1 year ago

看了cpptools的做法,如果设置了format,就会在客户端设置编辑器的配置为format的配置 https://github.com/microsoft/vscode-cpptools/blob/c417da6ed438327a39b7fa0d18bfd4d05e3279cc/Extension/src/LanguageServer/client.ts#L2575-L2606

CppCXY commented 1 year ago

装editorconfig插件应该就会自动应用.editorconfig配置到文件

actboy168 commented 1 year ago

也确实是个办法

sumneko commented 1 year ago

编辑器配置是vscode自动检测的缩进配置吗?我觉得这个不应该比自己设置的配置优先级高。 @sumneko

编辑器配置默认是自动检测的,但是也可以手动点击右下角的缩进按钮修改,所以很难说清谁的优先级高,所以索性就按照规范来。 不过可以考虑检查一下2边的配置是否一样,不一样的话给个提示。

actboy168 commented 1 year ago

无论是自动检测还是手动设置都应该要比代码风格设置的优先级低

actboy168 commented 1 year ago

@sumneko vscode的设置,我觉得只是在没有format的时候很临时的一个解决方案。就跟没有语言服务时,vscode也会提供一些很弱智的自动补全一样,但它肯定不应该高于语言服务的优先级。

sumneko commented 1 year ago

LSP规范里设定的是客户端缩进优先级更高,其他语言服务器也都是这么实现的。

actboy168 commented 1 year ago

LSP规范里设定的是客户端缩进优先级更高,其他语言服务器也都是这么实现的。

我只用过cpptools也就是微软写的C++语言服务。某种意义上你说的是对的,但cpptools的客户端会把format的配置设置到vscode的设置里。 从使用者的角度看,就是format优先。

sumneko commented 1 year ago

可以加个配置,选择到底用哪边的缩进规则