StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

VSCode extension does not honor .editorconfig path overrides

Open zarillion opened this issue 1 year ago • 1 comments

We're looking at moving from lua-format to StyLua for our project and have encountered a hurdle. Our project contains a number of localization files where we like to remove the column limit to prevent wrapping. This leaves it up to the translators how they want to format their translations.

I did not see a way to apply path-specific settings using .stylua.toml, so we have this .editorconfig file:

[*.lua]
max_line_length = 120

[**/localization/**.lua]
max_line_length = 1000

When running stylua directly, ec4rs picks up this override and the configuration is honored. However, when formatted on save in VSCode using the extension, the max_line_length override is not honored.

Is there a way to set up the .editorconfig files such that the editor picks up this override as well? I assume the editor may just be passing the file name and contents to StyLua, so the path-specific section is not picked up on save.

zarillion avatar Jun 05 '24 20:06 zarillion

Just wanted to post an update! With the new WoW expansion we've released a new plugin and we're still very much interested in this feature for swapping formatters!

zarillion avatar Aug 28 '24 20:08 zarillion

So sorry for the delay here. I think https://github.com/JohnnyMorganz/StyLua/pull/913 should solve this issue

JohnnyMorganz avatar Nov 16 '24 20:11 JohnnyMorganz

I've just released v1.7.0 for the extension which should have those fixes. Let me know if have any issues with it

JohnnyMorganz avatar Nov 16 '24 20:11 JohnnyMorganz