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: Refactor DiagnosticsController #6657

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

Conversation

mkaput
Copy link
Contributor

@mkaput mkaput commented Nov 14, 2024

This commit prepares DiagnosticsController
for adding multithreaded processing.

  1. DiagnosticsController::refresh takes shared reference to owned
    state and makes snapshots internally. It needs it to create N
    snapshots for many threads.
  2. Encapsulated controller thread state into a struct.
  3. Notifier and file_diagnostics are now stored in controller's
    state instead of being passed around.
  4. Some minor renames and doc rewordings.

Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@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.

:lgtm:

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

Copy link
Collaborator

@Arcticae Arcticae 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 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Draggu and @orizi)

Copy link
Collaborator

@Arcticae Arcticae left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Draggu and @orizi)

@mkaput mkaput changed the base branch from spr/main/eeefe2cb to spr/main/bd1161e7 November 14, 2024 10:53
Copy link
Collaborator

@Draggu Draggu 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: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @mkaput and @orizi)


crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs line 32 at r2 (raw file):

    //   Otherwise, the controller thread will never be requested to stop, and the controller's
    //   JoinHandle will never terminate.
    trigger: trigger::Sender<StateSnapshot>,

How do you plan making multiple snapshots from this? salsa snapshot is !Clone and can only be made from db itself, not another snapshot, as so we must prepare N snapshots on LS main thread so we can distribute them here.

Copy link
Contributor Author

@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: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @Draggu, @orizi, and @piotmag769)


crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs line 32 at r2 (raw file):

Previously, Draggu (Piotr Figiela) wrote…

How do you plan making multiple snapshots from this? salsa snapshot is !Clone and can only be made from db itself, not another snapshot, as so we must prepare N snapshots on LS main thread so we can distribute them here.

See how I did it in #6658

Copy link
Collaborator

@Draggu Draggu left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 2 of 3 files reviewed, all discussions resolved (waiting on @orizi and @piotmag769)


crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs line 32 at r2 (raw file):

Previously, mkaput (Marek Kaput) wrote…

See how I did it in #6658

Ok, I see, description is confusing.


-- commits line 9 at r3:
If you are doing this in next PR please move it to mentioned PR.

Copy link
Contributor Author

@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: 2 of 3 files reviewed, all discussions resolved (waiting on @orizi and @piotmag769)


-- commits line 9 at r3:

Previously, Draggu (Piotr Figiela) wrote…

If you are doing this in next PR please move it to mentioned PR.

you mean moving the description?

i changed signature here because it breaks diff for next PR (marks too much code as diffing)

Copy link
Collaborator

@Draggu Draggu 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: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @mkaput, @orizi, and @piotmag769)


-- commits line 9 at r3:

you mean moving the description?

Yes, it states that making N snapshots is done here while it is not.

This commit prepares `DiagnosticsController`
for adding multithreaded processing.

1. `DiagnosticsController::refresh` takes shared reference to owned
   state and makes snapshots internally. It needs it to create `N`
   snapshots for many threads.
2. Encapsulated controller thread state into a struct.
3. `Notifier` and `file_diagnostics` are now stored in controller's
   state instead of being passed around.
4. Some minor renames and doc rewordings.

commit-id:b9bb403e
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.

5 participants