-
Notifications
You must be signed in to change notification settings - Fork 314
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
Conversation
There was a problem hiding this 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.
d29e71a
to
9144b5c
Compare
There was a problem hiding this 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>] |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
init(mainFilesDictionary: [DocumentURI: Set<DocumentURI>]) { | ||
self.mainFilesDictionary = mainFilesDictionary | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
9144b5c
to
ea445cb
Compare
@swift-ci Please test |
issue: #868