4 ms·
> Grain format provides an opinionated code formatter tool for Grain source code I think this is a great idea; for the lang devs to provide such a thing. Afte
by Chris2048 5y ago
> Grain format provides an opinionated code formatter tool for Grain source code
I think this is a great idea; for the lang devs to provide such a thing.
After using black & isort in pythons, the option of automatic consistent formatting for shared code really cuts down on manual formatting work.
- nerdponx 5y agoI strongly agree. It makes it much easier for a language to compete with incumbent languages if it already has basic developer tools like a test suite, a build system, etc. it also has the benefit of centralizing in standardizing the developer experience, compared to some languages where it's difficult for a beginner because there is no obvious correct way to do things. I agree about formatting too, although every once in a while I do wish I could protect a specific section from automated formatting. Custom format and can be nice for things like mappings/tables, and certain deeply-nested JSON-like structures such as MongoDB queries.
- Chris2048 5y agoHmm, the advantage of an "official" formatter, is that the language itself could maybe support formatting directives?
- marcusr 5y agoFormatter author here - we do have the ability to protect specific sections with a // formatter-ignore comment before the section you want the formatter to leave as-is.
- jagger27 5y agogofmt is another excellent example.