Skip to content

On unclosed impl, documentSymbol symbol name can span many lines #16743

@krobelus

Description

@krobelus
Contributor

I'm not sure if there's anything to do here but I found this interesting.

No minimal reproducer but it should be reproducible on any impl block like below.
Cursor is at |

impl Foo<|
impl Bar<Baz> for Baz {
    ...
}

Now textDocument/documentSymbol will report a symbol with a name that starts at
impl Foo and spans across the impl Bar block and even further (in my case,
another impl block and a global function). I think it would be more intuitive to not report a symbol, or give it the name impl Foo<.

As workaround I'll truncate symbol names after the first line for now

Activity

Veykril

Veykril commented on Mar 3, 2024

@Veykril
Member

Probably parser recovery just eating everything as an error node when encountering the impl keyword in the generic param list

added a commit that references this issue on Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserparser issuesC-supportCategory: support questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Veykril@krobelus

        Issue actions

          On unclosed `impl`, documentSymbol symbol name can span many lines · Issue #16743 · rust-lang/rust-analyzer