Show tooltip in task spawn modal (#10744)

Tooltip shows original task template's label, if it differs from the one
displayed in the modal. Also, a resolved command with args will be shown
in the tooltip if different from the modal entry text.

<img width="578" alt="Screenshot 2024-04-19 at 00 40 28"
src="https://github.com/zed-industries/zed/assets/2690773/c89369d6-8ffc-4464-ab3b-ea5e8fb7625a">
<img width="761" alt="Screenshot 2024-04-19 at 00 40 32"
src="https://github.com/zed-industries/zed/assets/2690773/b02f1518-976a-4a9b-ba7c-f88c6e056217">
<img width="738" alt="Screenshot 2024-04-19 at 00 40 56"
src="https://github.com/zed-industries/zed/assets/2690773/be502537-f4bd-4ae0-a5e7-78e37fe8fb00">
<img width="785" alt="Screenshot 2024-04-19 at 00 41 01"
src="https://github.com/zed-industries/zed/assets/2690773/9bedcd21-8729-44c8-9a17-46a5a01c7f26">


Release Notes:

- Added tooltips into task spawn modal
This commit is contained in:
Kirill Bulatov 2024-04-19 01:43:52 +03:00 committed by GitHub
parent 870a61dd4d
commit 6d1ea782a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 17 deletions

View file

@ -75,6 +75,26 @@ impl ResolvedTask {
pub fn substituted_variables(&self) -> &HashSet<VariableName> {
&self.substituted_variables
}
/// If the resolution produced a task with the command, returns a string, combined from its command and arguments.
pub fn resolved_command(&self) -> Option<String> {
self.resolved.as_ref().map(|resolved| {
let mut command = resolved.command.clone();
for arg in &resolved.args {
command.push(' ');
command.push_str(arg);
}
command
})
}
/// A human-readable label to display in the UI.
pub fn display_label(&self) -> &str {
self.resolved
.as_ref()
.map(|resolved| resolved.label.as_str())
.unwrap_or_else(|| self.resolved_label.as_str())
}
}
/// Variables, available for use in [`TaskContext`] when a Zed's [`TaskTemplate`] gets resolved into a [`ResolvedTask`].