-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Prevent failure while creating BuildPlan from lock file in the case of a dependency removal #1974
Changes from 21 commits
f985bf0
b4219a7
9495057
e97c684
38af42e
e469399
4be5880
aa90853
316a871
4548afb
9bda581
38cc164
344ceaa
cb255e2
cb6a2e0
bb40017
1905046
5d466ec
6de10da
4ac21d4
057afeb
f11442b
476efa7
2bc0d94
b590f03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -162,7 +162,7 @@ impl TextDocument { | |||
pkg::ManifestFile::from_dir(&manifest_dir, forc::utils::SWAY_GIT_TAG).unwrap(); | ||||
let lock_path = forc_util::lock_path(manifest.dir()); | ||||
let plan = pkg::BuildPlan::from_lock_file(&lock_path, forc::utils::SWAY_GIT_TAG).unwrap(); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh I wonder if this If we can change this over to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on the input from @JoshuaBatty maybe we can do something like let plan =
pkg::BuildPlan::load_from_manifest(&manifest, false, false, forc::utils::SWAY_GIT_TAG)
.unwrap_or_else(|_| {
pkg::BuildPlan::from_lock_file(&lock_path, forc::utils::SWAY_GIT_TAG)
.map(|plan| plan.0)
.unwrap()
}); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think rather than falling back to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I add a crate to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case it sounds like we do want to change the use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be good to go but didn't add an explicit error throwing for the failure as we didn't have one for the current version too: sway/sway-lsp/src/core/document.rs Line 164 in 92ec0a6
Should we change the current behavior and explicitly return an error? or keep the current logic there (which is simply unwrapping) |
||||
let res = pkg::check(&plan, silent_mode, forc::utils::SWAY_GIT_TAG).unwrap(); | ||||
let res = pkg::check(&plan.0, silent_mode, forc::utils::SWAY_GIT_TAG).unwrap(); | ||||
|
||||
match res { | ||||
CompileAstResult::Failure { .. } => None, | ||||
|
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 we can make this private too