Skip to content

symbol hierarchy for out-of-class member definitions aren't processed correctly by vscode #793

@joelhock

Description

@joelhock

Observed behavior

When the cursor is on a out-of-class member definition, vscode does not display the symbol in the breadcrumb. This does work in clangd. It's unclear to me if this is because ccls is doing something wrong, the ccls vscode extension, or vscode itself.

image

possibly vscode is confused because the out-of-class definition is a child of the class, but isn't contained within the class's extent?

{
    "jsonrpc": "2.0",
    "id": 604,
    "result": [
        {
            "name": "Foo",
            "detail": "class Foo {}",
            "kind": 5,
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 5,
                    "character": 1
                }
            },
            "selectionRange": {
                "start": {
                    "line": 0,
                    "character": 6
                },
                "end": {
                    "line": 0,
                    "character": 9
                }
            },
            "children": [
                {
                    "name": "bar",
                    "detail": "void Foo::bar()",
                    "kind": 6,
                    "range": {
                        "start": {
                            "line": 1,
                            "character": 4
                        },
                        "end": {
                            "l ine": 3,
                            "character": 5
                        }
                    },
                    "selectionRange": {
                        "start": {
                            "line": 1,
                            "character": 9
                        },
                        "end": {
                            "line": 1,
                            "character": 12
                        }
                    },
                    "children": []
                },
                {
                    "name": "baz",
                    "detail": "void Foo::baz()",
                    "kind": 6,
                    "range": {
                        "start": {
                            "line": 7,
                            " character": 0
                        },
                        "end": {
                            "line": 9,
                            "character": 1
                        }
                    },
                    "selectionRange": {
                        "start": {
                            "line": 7,
                            "character": 10
                        },
                        "end": {
                            "line": 7,
                            "character": 13
                        }
                    },
                    "children": []
                }
            ]
        }
    ]
}

Expected behavior

Something more like what happens with clangd:
image

Steps to reproduce

Recreate code from screenshots. See that putting cursor on in-class definition of bar() on line 5 displays function in breadcrumb at top of screenshot, while putting cursor on out-of-class definition of baz() on line 9 does not.

System information

  • ccls version (git describe --tags --long): 0.20201219-5-g4cd308d7
  • clang version: 12
  • OS: linux
  • Editor: vscode 1.55.2
  • Language client (and version): vscode ccls extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions