Skip to content

Convert ManualMainFilesProvider and BSMDelegate to be actors #917

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

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

joehsieh
Copy link
Contributor

@joehsieh joehsieh commented Oct 21, 2023

issue: #868

  • Convert ManualMainFilesProvider to be an actor
  • Remove an unused queue from BSMDelegate

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thank you! Just a few suggestions to make the code more readable.

@joehsieh joehsieh force-pushed the migrate-queue-to-actor branch from d29e71a to 9144b5c Compare October 24, 2023 12:22
@joehsieh joehsieh marked this pull request as ready for review October 24, 2023 12:23
@joehsieh joehsieh requested a review from benlangmuir as a code owner October 24, 2023 12:23
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

I have one more comment on the naming of mainFilesDictionary. Sorry for not catching that in the first review. Otherwise, looks very good to me 👍🏽

get { lock.sync { _mainFiles } }
set { lock.sync { _mainFiles = newValue } }
private final actor ManualMainFilesProvider: MainFilesProvider {
private var mainFilesDictionary: [DocumentURI: Set<DocumentURI>]
Copy link
Member

Choose a reason for hiding this comment

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

One last comment: Dictionary is superfluous here because the type is already a dictionary. I would just name it mainFiles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intention for the renaming is to avoid the confusion between mainFiles: [DocumentURI: Set<DocumentURI>]
mainFiles: Set<DocumentURI> https://github.com/apple/sourcekit-lsp/pull/917/files#diff-4e5dc27e47b431520ccbd13ad2e859517644e3437c73157b2193a7b14ec30570R414

it was a trade-off when i named it, but yeah the data type already convey itself, so let me rename it.

Copy link
Member

Choose a reason for hiding this comment

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

I think that’s fine. updateMainFiles also is a really short methods and I don’t think it should cause too much confusion.

Comment on lines 410 to 412
init(mainFilesDictionary: [DocumentURI: Set<DocumentURI>]) {
self.mainFilesDictionary = mainFilesDictionary
}
Copy link
Member

Choose a reason for hiding this comment

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

And I think we can make the parameter unnamed here. Since we are constructing a ManualMainFilesProvider, it’s clear that we are passing the main files, IMO. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree. let me update the code.

Refactor the code

Remove unused code

Refine the code
@joehsieh joehsieh force-pushed the migrate-queue-to-actor branch from 9144b5c to ea445cb Compare October 24, 2023 16:30
@ahoppen
Copy link
Member

ahoppen commented Oct 24, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit 83519ea into swiftlang:main Oct 25, 2023
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.

2 participants