Pass project environment to runInTerminal requests (#32720)
Closes #ISSUE Release Notes: - debugger: Pass environment to run in terminal requests
This commit is contained in:
parent
d7db4d4e0a
commit
92addb005a
5 changed files with 29 additions and 7 deletions
|
@ -49,7 +49,7 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
sync::{Arc, Once},
|
||||
};
|
||||
use task::{DebugScenario, SpawnInTerminal, TaskTemplate};
|
||||
use task::{DebugScenario, SpawnInTerminal, TaskContext, TaskTemplate};
|
||||
use util::ResultExt as _;
|
||||
use worktree::Worktree;
|
||||
|
||||
|
@ -362,6 +362,7 @@ impl DapStore {
|
|||
&mut self,
|
||||
label: SharedString,
|
||||
adapter: DebugAdapterName,
|
||||
task_context: TaskContext,
|
||||
parent_session: Option<Entity<Session>>,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Entity<Session> {
|
||||
|
@ -379,6 +380,7 @@ impl DapStore {
|
|||
parent_session,
|
||||
label,
|
||||
adapter,
|
||||
task_context,
|
||||
cx,
|
||||
);
|
||||
|
||||
|
@ -889,7 +891,9 @@ impl dap::adapters::DapDelegate for DapAdapterDelegate {
|
|||
}
|
||||
|
||||
async fn which(&self, command: &OsStr) -> Option<PathBuf> {
|
||||
which::which(command).ok()
|
||||
let worktree_abs_path = self.worktree.abs_path();
|
||||
let shell_path = self.shell_env().await.get("PATH").cloned();
|
||||
which::which_in(command, shell_path.as_ref(), worktree_abs_path).ok()
|
||||
}
|
||||
|
||||
async fn shell_env(&self) -> HashMap<String, String> {
|
||||
|
|
|
@ -49,6 +49,7 @@ use std::{
|
|||
path::Path,
|
||||
sync::Arc,
|
||||
};
|
||||
use task::TaskContext;
|
||||
use text::{PointUtf16, ToPointUtf16};
|
||||
use util::ResultExt;
|
||||
use worktree::Worktree;
|
||||
|
@ -619,6 +620,7 @@ pub struct Session {
|
|||
ignore_breakpoints: bool,
|
||||
exception_breakpoints: BTreeMap<String, (ExceptionBreakpointsFilter, IsEnabled)>,
|
||||
background_tasks: Vec<Task<()>>,
|
||||
task_context: TaskContext,
|
||||
}
|
||||
|
||||
trait CacheableCommand: Any + Send + Sync {
|
||||
|
@ -733,6 +735,7 @@ impl Session {
|
|||
parent_session: Option<Entity<Session>>,
|
||||
label: SharedString,
|
||||
adapter: DebugAdapterName,
|
||||
task_context: TaskContext,
|
||||
cx: &mut App,
|
||||
) -> Entity<Self> {
|
||||
cx.new::<Self>(|cx| {
|
||||
|
@ -783,12 +786,17 @@ impl Session {
|
|||
exception_breakpoints: Default::default(),
|
||||
label,
|
||||
adapter,
|
||||
task_context,
|
||||
};
|
||||
|
||||
this
|
||||
})
|
||||
}
|
||||
|
||||
pub fn task_context(&self) -> &TaskContext {
|
||||
&self.task_context
|
||||
}
|
||||
|
||||
pub fn worktree(&self) -> Option<Entity<Worktree>> {
|
||||
match &self.mode {
|
||||
Mode::Building => None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue