Indenting of code in Edi is a central part of a good developer experience. It is divided into Code Formatting and Auto Indenting, as described below
When a user taps "return" and a newline is entered into the editor it should intelligently set the correct indent for the current context of the code.
When tab is pressed and the cursor is preceeded only by whitespace then two different behaviours should be supported (whether the caret is on the last character of the line or if it is "over" the first non-whitespace character
- If the caret is after the correct indentation level then the indent should increase to the next scope level
- Should the caret be before the correct indentation then it should advance to the same position as if return were pressed from the line above (fixing incorrect indentation).
Other tab behaviour is not discussed in this document but can be found in edi-tab-completion.
More details to be added about how to help developers keep their code tidy...
Hopefully we can have a "reformat code" option in the app.
The indentation scheme should be configurable but for now we will implement an EFL style that should meet all of our standards. This means the following behaviours will be set up:
- No tabs, only spaces to be used when indenting (tab key goes to next indentation level except as documented above to fix broken indentation
- Indentation follows a 3-2-3 scheme (as documented ini Ecoding
- The correct newline indentation within a "(" is on the column after the "(" opens
- A newline within a "/ /" comment will assume the comment should continue by adding "/ / " at the beginning of the line
- A multiline comment "/* " will be followed on a new line using " * "