Skip to content

impl item after struct decl, confuses LSP "go to definition" #7025

Open
@xunilrj

Description

@xunilrj

The test go_to_definition_for_structs tests the "go to definition" handler in this file:

contract;

/// My data enum
enum Data {
    First: (),
    Second: (),
}

/// My struct type
struct MyStruct<T, U> {
    g: U,
    x: T,
    y: Data,
    z: (u64, Data),
    t: [Data; 5],
    j: (u32, (Data, [Data; 2])),
    o: Option<Identity>,
}

The request points to "U" of "g: U", and expects the response point to "U" of "struct MyStruct<T, U>". Which works currently; but if an impl item appears after the struct declaration such as

contract;

/// My data enum
enum Data { ... }

/// My struct type
struct MyStruct<T, U> { ... }

trait A {}
impl<T, U> A for MyStruct<T, U> {}

Now, the same "go to definition" request points to the second "U" of the new line "impl<T, U> A for MyStruct<T, U> {}", which is wrong.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions