eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Feature Request: "formatter:off" for variables with certain suffix or pattern

Open
#648 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

Hi,

in our code base we have many occurrences of HTML-Strings and that look like this for e.g.:
```java
String html =
//@formatter:off
"" +
"" +
"" + TimeUtils.formatMinutes(monthResult.effectiveWorkedTimeInMinutes) + "" +
"
" +
"" + actualWorkTimeOutput + "" +
"
" +
"";
//@formatter:on
```
So we exclude that kind of variables from formatting by using formatter-on/off-tags. The intention to leave the variable-content unformatted is basically already defined by the variable name as it is "html".

So my feature request is roughly:

Add an option to the Java formatter, that excludes variable contents from being formatted for variable-names that match a certain regex.

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.