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

Fix LSP removing static downloads and git refs from lockfile on save #130

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

kylewlacy
Copy link
Member

Closes #129

This PR tweaks the load_project function, which is where lockfiles are generated and updated. In this code, we were skipping over Brioche.download and Brioche.gitRef statics in the context of the LSP (where fully_valid is false), which meant that the lockfile that got built by the LSP would never have any download or git ref statics in it. When the LSP saves a file, we would write this recomputed lockfile (in order to update dependencies, which were handled correctly). The updated lockfile would therefore save as if the project had no Brioche.download or Brioche.gitRef statics included, removing them even if they were already present in the existing lockfile.

As a fix, we just copy over the Brioche.download and Brioche.gitRef statics from the existing lockfile if present, even if those statics are no longer used in the project. My thought was that, if someone commented out a Brioche.download, saved the project, then uncommented the Brioche.download, we wouldn't want to get rid of the download static in between. So, this means that the only way to remove Brioche.download / Brioche.gitRef statics from the lockfile is to let the CLI update it (e.g. with brioche check, brioche build, etc)

@kylewlacy kylewlacy merged commit f452ea1 into main Sep 27, 2024
5 checks passed
@kylewlacy kylewlacy deleted the fix-lsp-clobbering-lockfile branch September 27, 2024 04:15
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.

Saving .bri file in LSP removes locked downloads and git refs
1 participant