jhipster / jhipster/prettier-java

[2.10.0] Outputs spaces instead of tabs

Open
#947 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
120
Avg merge
1d 14h
Merged PRs (30d)
27

Description

**Prettier-Java 2.10.0**

```sh
--print-width 100
--use-tabs
```

[Playground link](https://www.jhipster.tech/prettier-java/playground#N4IgDgTglgdgLgdSgEzgCxALgIwAZcA0IcAhgEZKoaYAsRArgM4CmAKuY1nBPc0SRAgB7AO4AFAcxidMIEgBsRJAJ6ci3ElHmwA5gGEhAW0Mksc+fJBFmADzDNohqaXkB5exBJwhEMUMZQcFBCMGZSyFYgEMwAjvRQ0WKeOiZYAGYKLEQAxkLIzGZg9GTa2QAEAIJlJDUkABQAlGXAADowZWVQaWV13LxNre0dZdFw9BDtJG3DwwD81dMzZZhlZGvrG5tb22RlAD57i0urO6dn5xebR0vzU0PHKzD0FgDciwC+bZ+h70A)

**Input:**

```java
public A aaaa() {
if (true) {
return a
? a
: bbbbbbbbbbbbbbbbbbbbbbbbbbbbb ||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
? a
: null;
}
}
```

**Output:**

```java
public A aaaa() {
if (true) {
return a
? a
: bbbbbbbbbbbbbbbbbbbbbbbbbbbbb ||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
? a
: null;
}
}
```

Note the spaces just before the long "bbb" line. That should be a tab instead.

**Expected behavior:**
Same but with tabs.

Contributor guide

Open the contributing guide

Research direction

Start with the linked Playground example and reproduce the output using --print-width 100 and --use-tabs. Compare the long “bbb” continuation line with the expected output, then trace the formatter path responsible for indentation and add or update a regression test if the project provides one. Done means that indentation uses tabs without the extra spaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.