mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Make some stuff public so that they can be reused by other tools
This commit is contained in:
parent
530a35f3f9
commit
9f0a7eb97b
6 changed files with 7 additions and 10 deletions
|
@ -176,14 +176,10 @@ impl AnalysisHost {
|
||||||
pub fn request_cancellation(&mut self) {
|
pub fn request_cancellation(&mut self) {
|
||||||
self.db.request_cancellation();
|
self.db.request_cancellation();
|
||||||
}
|
}
|
||||||
pub fn raw_database(
|
pub fn raw_database(&self) -> &RootDatabase {
|
||||||
&self,
|
|
||||||
) -> &(impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) {
|
|
||||||
&self.db
|
&self.db
|
||||||
}
|
}
|
||||||
pub fn raw_database_mut(
|
pub fn raw_database_mut(&mut self) -> &mut RootDatabase {
|
||||||
&mut self,
|
|
||||||
) -> &mut (impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) {
|
|
||||||
&mut self.db
|
&mut self.db
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub enum ProjectWorkspace {
|
||||||
/// `PackageRoot` describes a package root folder.
|
/// `PackageRoot` describes a package root folder.
|
||||||
/// Which may be an external dependency, or a member of
|
/// Which may be an external dependency, or a member of
|
||||||
/// the current workspace.
|
/// the current workspace.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PackageRoot {
|
pub struct PackageRoot {
|
||||||
/// Path to the root folder
|
/// Path to the root folder
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub struct TextEdit {
|
||||||
indels: Vec<Indel>,
|
indels: Vec<Indel>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct TextEditBuilder {
|
pub struct TextEditBuilder {
|
||||||
indels: Vec<Indel>,
|
indels: Vec<Indel>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ use ra_syntax::{AstNode, SourceFile};
|
||||||
pub use analysis_bench::{analysis_bench, BenchWhat, Position};
|
pub use analysis_bench::{analysis_bench, BenchWhat, Position};
|
||||||
pub use analysis_stats::analysis_stats;
|
pub use analysis_stats::analysis_stats;
|
||||||
pub use diagnostics::diagnostics;
|
pub use diagnostics::diagnostics;
|
||||||
|
pub use load_cargo::load_cargo;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub enum Verbosity {
|
pub enum Verbosity {
|
||||||
|
|
|
@ -22,7 +22,7 @@ fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId {
|
||||||
SourceRootId(r.0)
|
SourceRootId(r.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn load_cargo(
|
pub fn load_cargo(
|
||||||
root: &Path,
|
root: &Path,
|
||||||
load_out_dirs_from_check: bool,
|
load_out_dirs_from_check: bool,
|
||||||
with_proc_macro: bool,
|
with_proc_macro: bool,
|
||||||
|
|
|
@ -11,7 +11,7 @@ export function ssr(ctx: Ctx): Cmd {
|
||||||
|
|
||||||
const options: vscode.InputBoxOptions = {
|
const options: vscode.InputBoxOptions = {
|
||||||
value: "() ==>> ()",
|
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) => {
|
validateInput: async (x: string) => {
|
||||||
try {
|
try {
|
||||||
await client.sendRequest(ra.ssr, { query: x, parseOnly: true });
|
await client.sendRequest(ra.ssr, { query: x, parseOnly: true });
|
||||||
|
|
Loading…
Reference in a new issue