project: Update variable and change comment (#17933)
Previous this *was* the `cli_environment`, but now it's the project environment. Release Notes: - N/A
This commit is contained in:
parent
c34fc5c6e5
commit
2165d52d3e
2 changed files with 10 additions and 9 deletions
|
@ -860,7 +860,7 @@ impl LanguageRegistry {
|
||||||
adapter: Arc<CachedLspAdapter>,
|
adapter: Arc<CachedLspAdapter>,
|
||||||
root_path: Arc<Path>,
|
root_path: Arc<Path>,
|
||||||
delegate: Arc<dyn LspAdapterDelegate>,
|
delegate: Arc<dyn LspAdapterDelegate>,
|
||||||
cli_environment: Shared<Task<Option<HashMap<String, String>>>>,
|
project_environment: Shared<Task<Option<HashMap<String, String>>>>,
|
||||||
cx: &mut AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Option<PendingLanguageServer> {
|
) -> Option<PendingLanguageServer> {
|
||||||
let server_id = self.state.write().next_language_server_id();
|
let server_id = self.state.write().next_language_server_id();
|
||||||
|
@ -881,7 +881,7 @@ impl LanguageRegistry {
|
||||||
let task = cx.spawn({
|
let task = cx.spawn({
|
||||||
let container_dir = container_dir.clone();
|
let container_dir = container_dir.clone();
|
||||||
move |mut cx| async move {
|
move |mut cx| async move {
|
||||||
let cli_environment = cli_environment.await;
|
let project_environment = project_environment.await;
|
||||||
|
|
||||||
let binary_result = adapter
|
let binary_result = adapter
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -892,15 +892,16 @@ impl LanguageRegistry {
|
||||||
|
|
||||||
let mut binary = binary_result?;
|
let mut binary = binary_result?;
|
||||||
|
|
||||||
// If this Zed project was opened from the CLI and the language server command itself
|
// If we do have a project environment (either by spawning a shell in in the project directory
|
||||||
|
// or by getting it from the CLI) and the language server command itself
|
||||||
// doesn't have an environment (which it would have, if it was found in $PATH), then
|
// doesn't have an environment (which it would have, if it was found in $PATH), then
|
||||||
// we pass along the CLI environment that we inherited.
|
// we use the project environment.
|
||||||
if binary.env.is_none() && cli_environment.is_some() {
|
if binary.env.is_none() && project_environment.is_some() {
|
||||||
log::info!(
|
log::info!(
|
||||||
"using CLI environment for language server {:?}, id: {server_id}",
|
"using project environment for language server {:?}, id: {server_id}",
|
||||||
adapter.name.0
|
adapter.name.0
|
||||||
);
|
);
|
||||||
binary.env = cli_environment.clone();
|
binary.env = project_environment.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
let options = adapter
|
let options = adapter
|
||||||
|
|
|
@ -4646,7 +4646,7 @@ impl LspStore {
|
||||||
|
|
||||||
let stderr_capture = Arc::new(Mutex::new(Some(String::new())));
|
let stderr_capture = Arc::new(Mutex::new(Some(String::new())));
|
||||||
let lsp_adapter_delegate = ProjectLspAdapterDelegate::for_local(self, worktree_handle, cx);
|
let lsp_adapter_delegate = ProjectLspAdapterDelegate::for_local(self, worktree_handle, cx);
|
||||||
let cli_environment = local.environment.update(cx, |environment, cx| {
|
let project_environment = local.environment.update(cx, |environment, cx| {
|
||||||
environment.get_environment(Some(worktree_id), Some(worktree_path.clone()), cx)
|
environment.get_environment(Some(worktree_id), Some(worktree_path.clone()), cx)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4656,7 +4656,7 @@ impl LspStore {
|
||||||
adapter.clone(),
|
adapter.clone(),
|
||||||
Arc::clone(&worktree_path),
|
Arc::clone(&worktree_path),
|
||||||
lsp_adapter_delegate.clone(),
|
lsp_adapter_delegate.clone(),
|
||||||
cli_environment,
|
project_environment,
|
||||||
cx,
|
cx,
|
||||||
) {
|
) {
|
||||||
Some(pending_server) => pending_server,
|
Some(pending_server) => pending_server,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue