apache / apache/netbeans

Javascript Formatting of anonymous functions with JSDoc-Comment as function parameters

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

Description

### Apache NetBeans version

Apache NetBeans 21

### What happened

The following code snippet will show the incorrect behaviour: after reformatting the code the second function will have an extra level of indentation.

### Language / Project Type / NetBeans Component

_No response_

### How to reproduce

```
xyz(/** comment in same line: this will format ok */ function doClose(){
this.close();
},
/** comment in previous line: this will have an extra indentation */
function resetVal(){
this.close();
});
```

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Mageia 8 (Linux)

### JDK

javac 11.0.17

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

_No response_

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

No

Contributor guide

Open the contributing guide

Research direction

Reproduce the formatting problem in Apache NetBeans 21 using the JavaScript snippet in the issue, then inspect the JavaScript formatter entry point responsible for anonymous functions with JSDoc comments. Done means reformatting no longer gives the second function an extra indentation level.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.