jashkenas / jashkenas/coffeescript
Bug: Missing source map for variable inside optional?.chaining operator
- Dominant language
- CoffeeScript
- Stars
- 16.6k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
Bug report
### Input Code
This shows the source maps the compiler returns for this line. Notice that the variable (`old_presences` in that case) is not being pointed at.

### Expected Behavior
Another source map from `old_presences` to `old_presences`
### Context
This is not problematic for normal users, but for IntelliSense from the [CoffeeSense LSP](https://github.com/phil294/coffeesense/) it would be necessary, as currently go-tos etc. are impossible around optional chaining vars.
That said, the source maps have been amazing otherwise. They are usually highly detailed and accurate so that I could successfully base the entire extension logic on them.
### Environment
* CoffeeScript version: 2.6.1
* Node.js version: 16.16.0
Contributor guide
Research direction
Start by reproducing the optional chaining source-map output with CoffeeScript 2.6.1 and inspect how the compiler maps the variable named old_presences. Compare the generated mappings with the expected old_presences-to-old_presences mapping; the issue is done when that mapping is emitted and the CoffeeSense go-to scenario can use it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript, node.js
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100