swiftlang / swiftlang/swift-syntax
[Diagnostics] Intra-group trivia not preserved when moving a node group
- Dominant language
- Swift
- Stars
- 3.7k
- Forks
- 553
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 16
Description
### Description
When a Fix-it moves a group of consecutive nodes, the intra-group trivia won't be preserved,
```swift
func test() -> throws(any /**/ Error) Int
// after Fix-it
func test() throws(any Error) -> Int
```
It's because the nodes aren't actually "moved" when applying a Fix-it. Rather the misplaced nodes carrying the trivia are removed, and the missing nodes created by the parser (without the trivia) are presented at the designated site.
Currently trivia at the sides of a node group to move are transferred to its adjacent tokens, we should create facilities to transfer intra-group trivia from the misplaced nodes to the missing nodes.
### Steps to Reproduce
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.