5 ms·
Any configuration format that cannot be auto-formatted (i.e. has significant whitespace) goes straight in the trash. 90% of my time spent with YAML is usually t
by enlyth 3y ago
Any configuration format that cannot be auto-formatted (i.e. has significant whitespace) goes straight in the trash. 90% of my time spent with YAML is usually trying to figure out if something is indented correctly.
- hk__2 3y ago> Any configuration format that cannot be auto-formatted (i.e. has significant whitespace) goes straight in the trash. 90% of my time spent with YAML is usually trying to figure out if something is indented correctly. What are you talking about, exactly? If I hit alt+L in IntelliJ, my YAML file is auto-formatted.
- Defletter 3y agoUsing IntelliJ to edit YAML files is a bit much
- hk__2 3y ago> Using IntelliJ to edit YAML files is a bit much Not if those YAML files are part of a larger project, which they quite obviously are.
- madeofpalk 3y agoProblem is that it's pretty easy to have "wrong" whitespace that'll get formatted to something different than you expected.
- enlyth 3y agoIndentation changes the structure of the data. There is no deterministic way to auto format YAML, you have to make sure, as a human, that everything is at the right indentation level - something - a - b Is completely different to: - something - a - b
- bandie91 3y agowhat about stopping the little darf who writes into your files unauthorizedly?
- hk__2 3y agoIt can be deterministically auto-formatted as long as you respect the format, like with everything. If you wrongly indent a line then it’s your fault and the auto-format can’t know if some indent is wrong or not. I don’t see what’s wrong here; it’s like adding a superfluous } in JSON or not closing a tag in XML.
- tom_ 3y agoIt complicates moving stuff around the hierarchy.
- verdverm 3y agoWhat are your thoughts on Helm templates...
- xigoi 3y agoThat's actually an advantage of indentation sensitivity: the indentation is always correct, so you don't need to auto-format it.
- Xeamek 3y ago[flagged]
- bobbylarrybobby 3y agoThe indentation is always syntactically correct, but good luck ensuring it's semantically correct.
- xigoi 3y agoWhy would that be any more difficult than in a brace-based language?
- bobbylarrybobby 3y agoBecause braces delimit entire blocks of code, whereas leading whitespace only delimits a single line of code. It is very easy to stick your cursor between two braces and start typing or paste the clipboard. It is easy to see exactly which depth the added content will exist in. If you'd like a little breathing room, you can put some empty lines between the braces and insert there. Either way, once you (auto)format it'll be fine. But if whitespace is significant, it's not enough to place your cursor in the spot where the content — the whole block — belongs because there is no one spot where the content belongs. Rather, each line of the content you wish to insert must be placed individually. When pasting a block, placing the cursor at the correct spot before the paste is no guarantee that all of the content will be indented correctly; you can only guarantee that the first line is correct (and even then, doing so might require taking into account any leading whitespace of the copied content). Subsequent lines might need to be adjusted to retain the same relative indentation relative to the first line — or not! It depends on your particular scenario. But with braces, there really is no “it depends”. Place cursor, put text. It just works.