Skip to content
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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

keith-hall
Copy link
Contributor

Fixes #107

Copy link
Member

@FichteFoll FichteFoll left a 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.
Copy link
Member

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.

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();
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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" />.

Copy link

@michaelblyons michaelblyons left a 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.

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add page(s) for indentation
3 participants