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:
Thorsten Ball 2024-09-17 14:33:53 +02:00 committed by GitHub
parent c34fc5c6e5
commit 2165d52d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View file

@ -860,7 +860,7 @@ impl LanguageRegistry {
adapter: Arc<CachedLspAdapter>,
root_path: Arc<Path>,
delegate: Arc<dyn LspAdapterDelegate>,
cli_environment: Shared<Task<Option<HashMap<String, String>>>>,
project_environment: Shared<Task<Option<HashMap<String, String>>>>,
cx: &mut AppContext,
) -> Option<PendingLanguageServer> {
let server_id = self.state.write().next_language_server_id();
@ -881,7 +881,7 @@ impl LanguageRegistry {
let task = cx.spawn({
let container_dir = container_dir.clone();
move |mut cx| async move {
let cli_environment = cli_environment.await;
let project_environment = project_environment.await;
let binary_result = adapter
.clone()
@ -892,15 +892,16 @@ impl LanguageRegistry {
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
// we pass along the CLI environment that we inherited.
if binary.env.is_none() && cli_environment.is_some() {
// we use the project environment.
if binary.env.is_none() && project_environment.is_some() {
log::info!(
"using CLI environment for language server {:?}, id: {server_id}",
"using project environment for language server {:?}, id: {server_id}",
adapter.name.0
);
binary.env = cli_environment.clone();
binary.env = project_environment.clone();
}
let options = adapter

View file

@ -4646,7 +4646,7 @@ impl LspStore {
let stderr_capture = Arc::new(Mutex::new(Some(String::new())));
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)
});
@ -4656,7 +4656,7 @@ impl LspStore {
adapter.clone(),
Arc::clone(&worktree_path),
lsp_adapter_delegate.clone(),
cli_environment,
project_environment,
cx,
) {
Some(pending_server) => pending_server,