Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorder_arrays = false is ignored if the key is set to the array. #608

Open
Kladki opened this issue May 6, 2024 · 1 comment
Open

reorder_arrays = false is ignored if the key is set to the array. #608

Kladki opened this issue May 6, 2024 · 1 comment

Comments

@Kladki
Copy link

Kladki commented May 6, 2024

I have the following taplo.toml file:

include = ["**/*.toml"]
[formatting]
reorder_arrays = true

[[rule]]
include = ["bar.toml"]
keys = ["baz"]

[rule.formatting]
reorder_arrays = false

I would assume that the rule listed would prevent the array baz from being re-ordered, but still allow for all other arrays to be sorted.

This is my bar.toml file:

baz = ["foo", "bar", "baz"]

sort_me = ["z", "a"]

However, when running taplo fmt, bar.toml ends up like this:

baz = ["bar", "baz", "foo"]

sort_me = ["a", "z"]

As you can see, all arrays were sorted. When omitting keys, nothing gets formatted, which is not what I want.

@andrewweston
Copy link

I have a similar rule-based formatting issue. The rule works until I add the include property and then it stops being applied. It will work as expected if I use the Taplo cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants