Fixing naming from graph to list

This commit is contained in:
Bruno Ortiz 2023-04-04 13:47:01 -03:00
parent e2535926e9
commit 1b8288ff96
7 changed files with 52 additions and 48 deletions

View file

@ -9,7 +9,7 @@ use vfs::FileId;
use crate::{
global_state::GlobalStateSnapshot, to_proto, Result,
lsp_ext::{
CrateInfoResult, FetchDependencyGraphResult, FetchDependencyGraphParams,
CrateInfoResult, FetchDependencyListResult, FetchDependencyListParams,
},
};
@ -49,12 +49,12 @@ pub(crate) fn publish_diagnostics(
Ok(diagnostics)
}
pub(crate) fn fetch_dependency_graph(
pub(crate) fn fetch_dependency_list(
state: GlobalStateSnapshot,
_params: FetchDependencyGraphParams,
) -> Result<FetchDependencyGraphResult> {
_params: FetchDependencyListParams,
) -> Result<FetchDependencyListResult> {
let crates = state.analysis.fetch_crates()?;
Ok(FetchDependencyGraphResult {
Ok(FetchDependencyListResult {
crates: crates
.into_iter()
.map(|it| CrateInfoResult { name: it.name, version: it.version, path: it.path })

View file

@ -34,21 +34,21 @@ pub struct CrateInfoResult {
pub version: String,
pub path: String,
}
pub enum FetchDependencyGraph {}
pub enum FetchDependencyList {}
impl Request for FetchDependencyGraph {
type Params = FetchDependencyGraphParams;
type Result = FetchDependencyGraphResult;
const METHOD: &'static str = "rust-analyzer/fetchDependencyGraph";
impl Request for FetchDependencyList {
type Params = FetchDependencyListParams;
type Result = FetchDependencyListResult;
const METHOD: &'static str = "rust-analyzer/fetchDependencyList";
}
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct FetchDependencyGraphParams {}
pub struct FetchDependencyListParams {}
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct FetchDependencyGraphResult {
pub struct FetchDependencyListResult {
pub crates: Vec<CrateInfoResult>,
}

View file

@ -660,7 +660,7 @@ impl GlobalState {
.on_sync::<lsp_ext::OnEnter>(handlers::handle_on_enter)
.on_sync::<lsp_types::request::SelectionRangeRequest>(handlers::handle_selection_range)
.on_sync::<lsp_ext::MatchingBrace>(handlers::handle_matching_brace)
.on::<lsp_ext::FetchDependencyGraph>(handlers::fetch_dependency_graph)
.on::<lsp_ext::FetchDependencyList>(handlers::fetch_dependency_list)
.on::<lsp_ext::AnalyzerStatus>(handlers::handle_analyzer_status)
.on::<lsp_ext::SyntaxTree>(handlers::handle_syntax_tree)
.on::<lsp_ext::ViewHir>(handlers::handle_view_hir)