4 ms·
When does one need to format syntactically invalid code? What would that even mean?
by gowld 7y ago
When does one need to format syntactically invalid code? What would that even mean?
- dharmab 7y agoThe idea is that your code could be formatted for you as you type instead of having to wait until you reach a point where your code has no errors and hitting save.
- jvolkman 7y agoIDEs like IntelliJ do this all the time. For instance, formatting a block of code when it's pasted into a file with syntax errors elsewhere.
- deleted 7y ago[deleted]
- einpoklum 7y agoAll the time: 1. While you are in the middle of writing your file the first time. 2. When your IDE/editor doesn't see all the includes/imports 3. In languages where syntactic validity depends on semantics, beyond merely known and unknown identifiers. 4. When you make a syntax errors. Which is all the time, basically, until you've gotten your program or library to compile. 5. When you choose to format just a small segment of code, not the whole file.