taplo icon indicating copy to clipboard operation
taplo copied to clipboard

Formatter splits nested array across multiple lines unnecessarily

Open UtkarshVerma opened this issue 11 months ago • 5 comments

I have the following toml.

# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"

[manager]
prepend_keymap = [
	# Disable defaults
	{ on = [ "g", "h" ], run = "noop" },
]

taplo keeps formatting this as the following:

# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"

[manager]
prepend_keymap = [
	# Disable defaults
	{ on = [
		"g",
		"h",
	], run = "noop" },
]

I really like how concise the previous layout is. Is there any way to tell it not do anything here?

UtkarshVerma avatar Dec 24 '24 10:12 UtkarshVerma

Set inline_table_expand to false

panekj avatar Dec 24 '24 11:12 panekj

How do I configure that in my LSP? I could not find the settings schema for taplo.

UtkarshVerma avatar Dec 24 '24 13:12 UtkarshVerma

How are you using it? VSCode? Other editor?

panekj avatar Dec 24 '24 19:12 panekj

I'm using it with Neovim.

UtkarshVerma avatar Jan 09 '25 10:01 UtkarshVerma

I'm using it with Neovim.

create a .taplo.toml or taplo.toml file in the root directory then put this

[formatting]
inline_table_expand = false

more information can be found here

khangnm1340 avatar Feb 28 '25 08:02 khangnm1340