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: Fix duplicated and misplaced diagnostics #6446

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Arcticae
Copy link
Collaborator

@Arcticae Arcticae commented Oct 1, 2024

The diagnostics were not sorted properly, because of lack of including their kind in sorting before deduplication
(.format() is a derivative of that)

Also added a check for file relevance, so that vfs-based diagnostics aren't included in the mapping phase


This change is Reviewable

@Arcticae Arcticae linked an issue Oct 1, 2024 that may be closed by this pull request
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 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 335 at r1 (raw file):

        let files_db = db.upcast();
        let mut indexed_dup_diagnostic =
            diagnostic_with_dup.iter().enumerate().sorted_by_key(|(idx, diag)| {

if you're opting for heavy weapons here, then consider using https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.sorted_by_cached_key0

@Arcticae Arcticae force-pushed the chore/fix-duplicated-and-misplaced-diagnostics branch from ce865ea to 038bb85 Compare October 2, 2024 12:59
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 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Draggu, @orizi, and @piotmag769)

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.

bug: Wrongly mapped diagnostics in LS
2 participants