-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Arrays in inline tables break strangely #304
Comments
Unfortunately the TOML spec explicitly prohibits newlines in inline tables, so what you suggest is not valid TOML. The formatter will still attempt to shorten the line if it is over the target, and the only way to shorten it is by breaking up arrays. I agree that probably there should be an option to ignore inline tables that are too long. |
One possibility is to convert the long inline tables to standard tables. Or maybe a new LSP code-action cloud covert between the two formats. BTW, are the lsp-extensions documented somewhere? Thanks. |
There used to be an implementation of this in one direction (#92) but it was rather limited and buggy, I'd like to move this functionality into taplo itself in the future and expose it via the LSP.
|
I added an option for disabling the expansion of arrays inside inline tables, setting I'll do a release this week. |
Yo, sorry I didn't keep up with this conversation, been very busy. But many thanks for getting this done so quickly. Very cool! 👍 |
@tamasfe Actually, it would appear that the newlines in inline tables are permitted, per toml-lang/toml#904 (merged at the end of July this year), but that is indeed not part of the current 1.0.0 spec. In fact, I was quite surprised that the extension complains about example code taken from the current While it would appear that there is no timeframe for the 1.1.0 spec version that was said to include that change, I believe that in the meantime there should be at least an option for this in the extension. |
This is a welcome update! I would not get ahead of the specification though as it might break compatibility with other TOML tools, even supporting it conditionally might open up a can of worms I don't want to deal with right now. Supporting this feature by itself should not be hard:
|
The following inline table...
...breaks into:
I'm not sure if this is expected behavior. I find this to be very difficult and confusing to read. Other auto-formatters (from other languages) that I'm familiar tend to do something like the following:
But I would be ok with just not breaking the array and keeping the line longer that it is normally allowed to be. So, depending on whether the current behavior is correct, I would very much appreciate either a fix or an option for preventing arrays in inline tables from being expanded.
The text was updated successfully, but these errors were encountered: