apache / apache/netbeans

add editor folds or similar to keep hand crafted formatting intact

Open
#7,045 0 comments 0 reactions 0 assignees View on GitHub
kind:feature needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Description

For readability, you sometimes format code in a nicely aligned way, e.g. columnar for operations on a sequence of array elements.

For instance
```
return new Student(
java.lang.String.class.cast( components[ 0 ] ),
java.lang.String.class.cast( components[ 1 ] ),
java.lang.String.class.cast( components[ 2 ] ),
java.time.LocalDate.class.cast( components[ 3 ] )
);
```
This is hard work, even in this wiki editor I am currently using, for lack of a fixed sized font.
Anyhow, if you could keep that formatting intact even with a reformat all over the code, that would be nice.

The start and end tags could look like this: The first to turn reformatting off.
- `//!reformat-`
- `//!reformat+`

complete example
```
//!reformat-
return new Student(
java.lang.String.class.cast( components[ 0 ] ),
java.lang.String.class.cast( components[ 1 ] ),
java.lang.String.class.cast( components[ 2 ] ),
java.time.LocalDate.class.cast( components[ 3 ] )
);
//!reformat+

```

### Use case/motivation

The readability of code is key.

### Related issues

reformatting in general

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by locating the NetBeans Java editor's reformat entry point and formatter implementation, then determine where marker lines could preserve a selected block; done means reformatting leaves the marked example unchanged, with coverage for the start and end markers.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.