Skip to content

[Diagnostics] Intra-group trivia not preserved when moving a node group #2850

Open
@AppAppWorks

Description

@AppAppWorks

Description

When a Fix-it moves a group of consecutive nodes, the intra-group trivia won't be preserved,

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions