Add basic bash and Python tasks (#10548)
Part of https://github.com/zed-industries/zed/issues/5141 * adds "run selection" and "run file" tasks for bash and Python. * replaces newlines with `\n` symbols in the human-readable task labels * properly escapes task command arguments when spawning the task in terminal Caveats: * bash tasks will always use user's default shell to spawn the selections, but they should rather respect the shebang line even if it's not selected * Python tasks will always use `python3` to spawn its tasks now, as there's no proper mechanism in Zed to deal with different Python executables Release Notes: - Added tasks for bash and Python to execute selections and open files in terminal
This commit is contained in:
parent
1911a9f39b
commit
db48c75231
11 changed files with 100 additions and 17 deletions
|
@ -28,6 +28,7 @@ search.workspace = true
|
|||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
settings.workspace = true
|
||||
shlex.workspace = true
|
||||
shellexpand.workspace = true
|
||||
smol.workspace = true
|
||||
terminal.workspace = true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{ops::ControlFlow, path::PathBuf, sync::Arc};
|
||||
use std::{borrow::Cow, ops::ControlFlow, path::PathBuf, sync::Arc};
|
||||
|
||||
use crate::TerminalView;
|
||||
use collections::{HashMap, HashSet};
|
||||
|
@ -319,6 +319,7 @@ impl TerminalPanel {
|
|||
let args = std::mem::take(&mut spawn_task.args);
|
||||
for arg in args {
|
||||
command.push(' ');
|
||||
let arg = shlex::try_quote(&arg).unwrap_or(Cow::Borrowed(&arg));
|
||||
command.push_str(&arg);
|
||||
}
|
||||
spawn_task.command = shell;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue