StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Feature: Fall back to .editorconfig even when stylua.toml is present

Open rnxden opened this issue 6 months ago • 0 comments

Problem

When both stylua.toml and .editorconfig files are present, StyLua only uses the config options from stylua.toml.

For example, with the following two files:

stylua.toml

quote_style = "AutoPreferSingle"

.editorconfig

root = true

[*.lua]
indent_style = space
indent_size = 2

StyLua would only use the quote_style option from stylua.toml and ignore the options set in .editorconfig, falling back to the default of 4 space tabs.

Requested Behavior

I propose that config options are applied in decreasing priority:

  1. From stylua.toml
  2. From .editorconfig
  3. From the default configuration

In the example above, this would set quote_style to AutoPreferSingle, while also setting indent_type to Spaces and indent_width to 2.

This will prevent duplicate config options from being written, and prevent forgetting to update a config option in one file after changing the option in another file. Plus, Prettier (formatter for HTML/CSS/JS/Others) also follows this behavior.

rnxden avatar Jul 05 '25 02:07 rnxden