Remove rust-analyzer/addProject in favor of notifying r-a that configuration has changed

This commit is contained in:
David Barsky 2023-03-13 13:17:17 -04:00
parent 8d9bff0c74
commit 56273b3cf5
7 changed files with 8 additions and 65 deletions

View file

@ -5,7 +5,6 @@
use std::{
io::Write as _,
process::{self, Stdio},
sync::Arc,
};
use anyhow::Context;
@ -53,21 +52,6 @@ pub(crate) fn handle_workspace_reload(state: &mut GlobalState, _: ()) -> Result<
Ok(())
}
pub(crate) fn handle_add_project(
state: &mut GlobalState,
params: lsp_ext::AddProjectParams,
) -> Result<()> {
state.proc_macro_clients.clear();
state.proc_macro_changed = false;
let config = Arc::make_mut(&mut state.config);
config.add_linked_projects(params.project);
state.fetch_workspaces_queue.request_op("linked projects changed".to_string());
state.fetch_build_data_queue.request_op("linked projects changed".to_string());
Ok(())
}
pub(crate) fn handle_cancel_flycheck(state: &mut GlobalState, _: ()) -> Result<()> {
let _p = profile::span("handle_stop_flycheck");
state.flycheck.iter().for_each(|flycheck| flycheck.cancel());

View file

@ -9,7 +9,6 @@ use lsp_types::{
notification::Notification, CodeActionKind, DocumentOnTypeFormattingParams,
PartialResultParams, Position, Range, TextDocumentIdentifier, WorkDoneProgressParams,
};
use project_model::ProjectJsonData;
use serde::{Deserialize, Serialize};
use crate::line_index::PositionEncoding;
@ -52,20 +51,6 @@ impl Request for ReloadWorkspace {
const METHOD: &'static str = "rust-analyzer/reloadWorkspace";
}
pub enum AddProject {}
impl Request for AddProject {
type Params = AddProjectParams;
type Result = ();
const METHOD: &'static str = "rust-analyzer/addProject";
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct AddProjectParams {
pub project: Vec<ProjectJsonData>,
}
pub enum SyntaxTree {}
impl Request for SyntaxTree {

View file

@ -625,7 +625,6 @@ impl GlobalState {
.on_sync_mut::<lsp_ext::ReloadWorkspace>(handlers::handle_workspace_reload)
.on_sync_mut::<lsp_ext::MemoryUsage>(handlers::handle_memory_usage)
.on_sync_mut::<lsp_ext::ShuffleCrateGraph>(handlers::handle_shuffle_crate_graph)
.on_sync_mut::<lsp_ext::AddProject>(handlers::handle_add_project)
.on_sync::<lsp_ext::JoinLines>(handlers::handle_join_lines)
.on_sync::<lsp_ext::OnEnter>(handlers::handle_on_enter)
.on_sync::<lsp_types::request::SelectionRangeRequest>(handlers::handle_selection_range)