Skip to content

CLI rust-analyzer parse outputs json #21777

@A4-Tacks

Description

@A4-Tacks
$ rust-analyzer parse < foo.rs

Outputs rowan debug tree.

Add a --json option, outputs like:

{
    "kind": "SOURCE_FILE",
    "type": "Node",
    "start": ...,
    "end": ...,
    "children": [
        {
            "kind": "ERROR",
            "type": "Node",
            "start": ...,
            "end": ...,
            "children": [
                {
                    "kind": "COMMA",
                    "type": "Token",
                    "text": ",",
                    "start": ...,
                    "end": ...
                }
            ]
        }
    ]
}

Similar to rust-analyzer.viewSyntaxTree, but with the addition of a text field in the token

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions