-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
add indentation guide #116
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a draft PR, I just took a very brief look at what you were going for here and added a few comments
|
||
Sublime Text can perform automatic indentation when you type. | ||
It can also reindent text according to the indentation rules on demand. | ||
Note that it will not perform auto-formatting, like adding newlines or adjusting spaces around parenthesis and the like. You would need an external tool or plugin for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider adding more line breaks at positions that make sense semantically. I assume you're still in the process of revising this, however, since some sections already use shorter lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plural is "parentheses."
This is also potentially useful for incomplete statements (split over multiple lines), for example some languages require statements to be terminated with a semi-colon `;`, and visually indenting them makes it more readable. | ||
```js | ||
a.b().c.d.e.f | ||
.g().h.i(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a bad example here because this exact use case breaks when a statement is broken over more than just two lines. A better idea would be to cover C-style bracket-less if statements.
Indentation rules are defined using metadata files. | ||
However, because metadata for indentation rules is complicated and | ||
is commonly required by packages which add syntax definitions, | ||
it's discussed separately in this page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general style thing, I tend to refrain from using shortenings like "it's" in prose. But this is an optional thing and just an FYI. I will most likely do a full pass on the page once it's ready for a more detailed review and commit it directly.
|
||
## Indentation when pressing <kbd>Enter</kbd> | ||
|
||
The main aspect of auto indentation increasing the indent level occurs when pressing <kbd>Enter</kbd>, anywhere on a line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a custom tag for key bindings. Usage is <Key k="enter" />
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Learned some things, reading this. I almost want a set of flow charts now. 😅
|
||
Sublime Text can perform automatic indentation when you type. | ||
It can also reindent text according to the indentation rules on demand. | ||
Note that it will not perform auto-formatting, like adding newlines or adjusting spaces around parenthesis and the like. You would need an external tool or plugin for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plural is "parentheses."
|
||
### other built-ins | ||
|
||
The user preference `indent_to_bracket` adds whitespace up to the first open bracket when indenting. It also affects unindenting too, the close paren is placed in the column after the open paren. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user preference `indent_to_bracket` adds whitespace up to the first open bracket when indenting. It also affects unindenting too, the close paren is placed in the column after the open paren. | |
The user preference `indent_to_bracket` adds whitespace up to the first open bracket when indenting. It also affects unindenting, too; the close paren is placed in the column after the open paren. |
Fixes #107