From 9f0a7eb97b4e047cebbe51ffd6f9e2092dd63e00 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Fri, 24 Apr 2020 21:57:10 +0200 Subject: [PATCH] Make some stuff public so that they can be reused by other tools --- crates/ra_ide/src/lib.rs | 8 ++------ crates/ra_project_model/src/lib.rs | 2 +- crates/ra_text_edit/src/lib.rs | 2 +- crates/rust-analyzer/src/cli.rs | 1 + crates/rust-analyzer/src/cli/load_cargo.rs | 2 +- editors/code/src/commands/ssr.ts | 2 +- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 915199bd87..78149ddfcb 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -176,14 +176,10 @@ impl AnalysisHost { pub fn request_cancellation(&mut self) { self.db.request_cancellation(); } - pub fn raw_database( - &self, - ) -> &(impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) { + pub fn raw_database(&self) -> &RootDatabase { &self.db } - pub fn raw_database_mut( - &mut self, - ) -> &mut (impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) { + pub fn raw_database_mut(&mut self) -> &mut RootDatabase { &mut self.db } } diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 4f098b706b..a2e9f65eff 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs @@ -35,7 +35,7 @@ pub enum ProjectWorkspace { /// `PackageRoot` describes a package root folder. /// Which may be an external dependency, or a member of /// the current workspace. -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct PackageRoot { /// Path to the root folder path: PathBuf, diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs index 37f77cc47c..c4f945101e 100644 --- a/crates/ra_text_edit/src/lib.rs +++ b/crates/ra_text_edit/src/lib.rs @@ -21,7 +21,7 @@ pub struct TextEdit { indels: Vec, } -#[derive(Debug, Default)] +#[derive(Debug, Default, Clone)] pub struct TextEditBuilder { indels: Vec, } diff --git a/crates/rust-analyzer/src/cli.rs b/crates/rust-analyzer/src/cli.rs index a865a7c7e2..39ce779008 100644 --- a/crates/rust-analyzer/src/cli.rs +++ b/crates/rust-analyzer/src/cli.rs @@ -16,6 +16,7 @@ use ra_syntax::{AstNode, SourceFile}; pub use analysis_bench::{analysis_bench, BenchWhat, Position}; pub use analysis_stats::analysis_stats; pub use diagnostics::diagnostics; +pub use load_cargo::load_cargo; #[derive(Clone, Copy)] pub enum Verbosity { diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index 023ced6cfb..8eaf75ff61 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs @@ -22,7 +22,7 @@ fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId { SourceRootId(r.0) } -pub(crate) fn load_cargo( +pub fn load_cargo( root: &Path, load_out_dirs_from_check: bool, with_proc_macro: bool, diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts index 6fee051fdf..4ef8cdf04f 100644 --- a/editors/code/src/commands/ssr.ts +++ b/editors/code/src/commands/ssr.ts @@ -11,7 +11,7 @@ export function ssr(ctx: Ctx): Cmd { const options: vscode.InputBoxOptions = { value: "() ==>> ()", - prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ", + prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ", validateInput: async (x: string) => { try { await client.sendRequest(ra.ssr, { query: x, parseOnly: true });