Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LS: add support for struct members #6145

Merged
merged 4 commits into from
Aug 6, 2024
Merged

LS: add support for struct members #6145

merged 4 commits into from
Aug 6, 2024

Conversation

piotmag769
Copy link
Collaborator

@piotmag769 piotmag769 commented Aug 5, 2024

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 10 files at r1, all commit messages.
Reviewable status: 4 of 10 files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @mkaput, and @piotmag769)


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 26 at r1 (raw file):

use crate::{find_definition, ResolvedItem};

type StructDef = ItemDef;

explain the redefinition.

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 10 files reviewed, 2 unresolved discussions (waiting on @Arcticae, @Draggu, and @piotmag769)


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 37 at r1 (raw file):

    ExprInlineMacro(String),
    Member((MemberId, StructDef)),
}

Suggestion:

/// Keeps information about the symbol that is being searched for/inspected.
///
/// This is an ephemeral data structure.
/// Do not store it in any kind of state.
pub enum SymbolDef {
    Item(ItemDef),
    Variable(VariableDef),
    ExprInlineMacro(String),
    Member(MemberDef),
}

pub enum MemberDef {
    member: MemberId,
    struct: ItemDef,
}

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 10 files at r1, all commit messages.
Reviewable status: 7 of 10 files reviewed, 3 unresolved discussions (waiting on @Arcticae, @Draggu, and @piotmag769)


crates/cairo-lang-doc/src/db.rs line 13 at r1 (raw file):

/// Item which documentation can be fetched from source code.
#[derive(Clone, Debug, Hash, Eq, PartialEq)]

Suggestion:

#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]

Copy link
Collaborator Author

@piotmag769 piotmag769 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 10 of 10 files at r1.
Reviewable status: 7 of 10 files reviewed, 3 unresolved discussions (waiting on @Arcticae, @Draggu, @mkaput, and @orizi)


crates/cairo-lang-doc/src/db.rs line 13 at r1 (raw file):

/// Item which documentation can be fetched from source code.
#[derive(Clone, Debug, Hash, Eq, PartialEq)]

Done.


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 26 at r1 (raw file):

Previously, orizi wrote…

explain the redefinition.

Not relevant anymore.


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 37 at r1 (raw file):

    ExprInlineMacro(String),
    Member((MemberId, StructDef)),
}

Done.

@piotmag769 piotmag769 requested review from mkaput and orizi August 6, 2024 10:15
Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 10 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 141 at r1 (raw file):

        contexts
            .chain(this)
            .map(|item| db.get_item_signature(DocumentableItemId::LookupItem(item)))

Implement From<T> for DocumentableItemId for all variants.


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 37 at r2 (raw file):

}

pub struct MemberDef {

doc


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 39 at r2 (raw file):

pub struct MemberDef {
    pub member: MemberId,
    pub r#struct: ItemDef,

Suggestion:

structure

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 10 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Arcticae, @Draggu, and @piotmag769)

Copy link
Collaborator Author

@piotmag769 piotmag769 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r2, 5 of 5 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Arcticae, @Draggu, and @mkaput)


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 141 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

Implement From<T> for DocumentableItemId for all variants.

Done.


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 37 at r2 (raw file):

Previously, mkaput (Marek Kaput) wrote…

doc

Done.


crates/cairo-lang-language-server/src/lang/inspect/defs.rs line 39 at r2 (raw file):

pub struct MemberDef {
    pub member: MemberId,
    pub r#struct: ItemDef,

Done.

@piotmag769 piotmag769 requested a review from mkaput August 6, 2024 13:28
Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 5 of 5 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Arcticae and @Draggu)

Copy link
Collaborator Author

@piotmag769 piotmag769 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Arcticae and @Draggu)

@piotmag769 piotmag769 added this pull request to the merge queue Aug 6, 2024
Merged via the queue into main with commit aa3865e Aug 6, 2024
44 checks passed
@piotmag769 piotmag769 deleted the members-support-ls branch August 6, 2024 15:32
orizi pushed a commit that referenced this pull request Aug 13, 2024
orizi pushed a commit that referenced this pull request Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants