Fix eslint diagnostics by passing worktree root during workspace init

This commit is contained in:
Kirill Bulatov 2023-11-30 11:38:16 +02:00
parent 02174084ca
commit f9cd45269a
9 changed files with 45 additions and 16 deletions

View file

@ -2641,8 +2641,9 @@ impl Project {
});
for (adapter, server) in servers {
let workspace_config =
cx.update(|cx| adapter.workspace_configuration(cx)).await;
let workspace_config = cx
.update(|cx| adapter.workspace_configuration(server.root_path(), cx))
.await;
server
.notify::<lsp::notification::DidChangeConfiguration>(
lsp::DidChangeConfigurationParams {
@ -2753,7 +2754,7 @@ impl Project {
stderr_capture.clone(),
language.clone(),
adapter.clone(),
worktree_path,
Arc::clone(&worktree_path),
ProjectLspAdapterDelegate::new(self, cx),
cx,
) {
@ -2776,6 +2777,7 @@ impl Project {
cx.spawn_weak(|this, mut cx| async move {
let result = Self::setup_and_insert_language_server(
this,
&worktree_path,
override_options,
pending_server,
adapter.clone(),
@ -2891,6 +2893,7 @@ impl Project {
async fn setup_and_insert_language_server(
this: WeakModelHandle<Self>,
worktree_path: &Path,
override_initialization_options: Option<serde_json::Value>,
pending_server: PendingLanguageServer,
adapter: Arc<CachedLspAdapter>,
@ -2903,6 +2906,7 @@ impl Project {
this,
override_initialization_options,
pending_server,
worktree_path,
adapter.clone(),
server_id,
cx,
@ -2932,11 +2936,14 @@ impl Project {
this: WeakModelHandle<Self>,
override_options: Option<serde_json::Value>,
pending_server: PendingLanguageServer,
worktree_path: &Path,
adapter: Arc<CachedLspAdapter>,
server_id: LanguageServerId,
cx: &mut AsyncAppContext,
) -> Result<Arc<LanguageServer>> {
let workspace_config = cx.update(|cx| adapter.workspace_configuration(cx)).await;
let workspace_config = cx
.update(|cx| adapter.workspace_configuration(worktree_path, cx))
.await;
let language_server = pending_server.task.await?;
language_server
@ -2964,11 +2971,14 @@ impl Project {
language_server
.on_request::<lsp::request::WorkspaceConfiguration, _, _>({
let adapter = adapter.clone();
let worktree_path = worktree_path.to_path_buf();
move |params, mut cx| {
let adapter = adapter.clone();
let worktree_path = worktree_path.clone();
async move {
let workspace_config =
cx.update(|cx| adapter.workspace_configuration(cx)).await;
let workspace_config = cx
.update(|cx| adapter.workspace_configuration(&worktree_path, cx))
.await;
Ok(params
.items
.into_iter()