bahmutov / bahmutov/comment-value
Variable comments confuse expression comments after it
- Dominant language
- JavaScript
- Stars
- 27
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Seems by inserting statements we break the expressions later
```js
const x = 2
// x:
function add(a, b) {
return a + b
}
add(x, 3) //>
```
crashes with
```
Error: missing line 6 for comment {
"start": 111,
"text": ">",
"from": {
"line": 7,
"column": 10
},
"to": {
"line": 7,
"column": 13
},
"filename": "/Users/gleb/git/comment-value/test/combined/index.js",
"commentStart": ">",
"index": 0
}
at lazyAssLogic (/Users/gleb/git/comment-value/node_modules/lazy-ass/index.js:110:14)
at lazyAss (/Users/gleb/git/comment-value/node_modules/lazy-ass/index.js:115:28)
at updateComment (/Users/gleb/git/comment-value/src/update.js:64:5)
```
Removing the variable comment from line 2 solves the crash
```js
const x = 2
// x:
function add(a, b) {
return a + b
}
add(x, 3) //> 5
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided JavaScript reproduction and inspect src/update.js at line 64, where updateComment reports the missing line. Confirm that the variable comment before the function no longer causes the later expression comment to crash, and verify the final comment is updated to `> 5`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100