Skip to content

Remove assertion that we can't register for change notifications twice in SwiftPMWorkspace #949

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

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 27, 2023

There’s no harm in registering for change notifications for the same file twice. Currently, this can happen if you open two files that have the same main file.

BuildSystemManager checks that there are no more files referencing a main file before calling unregisterForChangeNotifications, so this is where the “complicated” logic lives that checks if sourcekit-lsp really isn’t interested in a file anymore.

While looking through the code I noticed that I could remove the language parameter from BuildSystem.registerForChangeNotifications because it isn’t used anywhere.

rdar://117603105

…cations`

The language wasn’t used anywhere.
…e in `SwiftPMWorkspace`

There’s no harm in registering for change notifications for the same file twice. Currently, this can happen if you open two files that have the same main file.

 `BuildSystemManager` checks that there are no more files referencing a main file before calling `unregisterForChangeNotifications`, so this is where the “complicated” logic lives that checks if sourcekit-lsp really isn’t interested in a file anymore.

rdar://117603105
@ahoppen ahoppen force-pushed the ahoppen/fix-unbalanced-register-unregister-crash branch from 7140ca3 to 4a924c4 Compare October 30, 2023 20:59
@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit 19f8638 into swiftlang:main Oct 30, 2023
@ahoppen ahoppen deleted the ahoppen/fix-unbalanced-register-unregister-crash branch October 30, 2023 23:16
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