-
Notifications
You must be signed in to change notification settings - Fork 581
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
LS: Consider empty strings in workspace/configuration
as None
#6247
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.
Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @mkaput, and @piotmag769)
crates/cairo-lang-language-server/src/config.rs
line 83 at r1 (raw file):
fn nullify_empty_str(value: &str) -> Option<&str> { (!value.is_empty()).then_some(value) }
Suggestion:
self.unmanaged_core_path = response
.pop_front()
.as_ref()
.and_then(Value::as_str)
.filter(|v|!v.is_empty())
.map(Into::into);
debug!("reloaded configuration: {self:#?}");
}
}
}
It occurs that the `workspace/configuration` request returns `Some("")` for the `cairo1.corelibPath` field even if it is not set anywhere. This fact blocked any logic that happened in the ` find_unmanaged_core ` function, as it always assumed that the user explicitly set the path in their config to `""`. By nullifying empty configuration values, this change fixes `find_unmanaged_core`. commit-id:c5cd2e07
773f54a
to
94e0ee7
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)
crates/cairo-lang-language-server/src/config.rs
line 83 at r1 (raw file):
fn nullify_empty_str(value: &str) -> Option<&str> { (!value.is_empty()).then_some(value) }
🧠
Done
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @orizi, and @piotmag769)
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Arcticae and @piotmag769)
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.
returns
Some("")
for thecairo1.corelibPath
Do you know why this happens? Isn't it an issue with our extension? Does it happen for other fields that are strings as well?
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Arcticae)
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 tried to find a reason but couldn't conclude anything in reasonable time.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @Arcticae)
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.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @mkaput)
It occurs that the
workspace/configuration
request returns
Some("")
for thecairo1.corelibPath
field even if it is not set anywhere.
This fact blocked any logic that happened in the
find_unmanaged_core
function,
as it always assumed
that the user explicitly set the path in their config to
""
.By nullifying empty configuration values, this change fixes
find_unmanaged_core
.Stack:
core
in Scarb #6248workspace/configuration
asNone
#6247 ⬅This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)