ajaxorg / ajaxorg/ace

Mode specific and custom wrap indents

Open
#4,451 12 comments 0 reactions 0 assignees View on GitHub
feature-request p2
Dominant language
JavaScript
Stars
27.1k
Forks
5.3k
PR merge metrics
No merged PRs in 30d

Description

Currently Ace supports three wrapping behaviors:

1. wrap indent disabled:
```
This line wraps with no
indentation at all.
```

2. text mode, wrap indent enabled:

```
This line wraps with indentation
matching the its initial indent.
```

3. code mode, wrap indent enabled

``` javacript
stdout.write("This line wraps with indentation
a fixed amount beyond its initial indent.")
```

[These behaviors are hard-coded](https://github.com/ajaxorg/ace/blob/a505922a01395ab77a878c08da06eb09b7822d23/lib/ace/edit_session.js#L1781), without any way for a Mode to hook in custom behavior to suit the particular conventions of its file type, nor a means to add configuration options.

Some desirable alternate behaviors:

- In plain text, wrap indentation that aligns with the content on the first line gives the most legibilty. I fact,
CommonMark specifies this for *hard* wrapping of list content because
``` markdown
1. When this line is wrapped, it should line up
with the word "When".
```

- In code, some prefer *semantic* indentation, such as wrapping [wherein arguments are aligned](https://packagecontrol.io/packages/Align%20Arguments)
``` javascript
someLongFunction(argument1, argument2, argument3
argument4, argument5);
```

I propose that `getWrapIndent()` be customizable by Mode. I'm even willing to do the implementation. But first, would such changes be approved by the project maintainers?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.