mod annotations;
mod call_hierarchy;
-mod diagnostics;
mod expand_macro;
mod extend_selection;
mod file_structure;
mod move_item;
mod parent_module;
mod references;
+mod rename;
mod fn_references;
mod runnables;
mod ssr;
pub use crate::{
annotations::{Annotation, AnnotationConfig, AnnotationKind},
call_hierarchy::CallItem,
- diagnostics::{Diagnostic, DiagnosticsConfig, Severity},
display::navigation_target::NavigationTarget,
expand_macro::ExpandedMacro,
file_structure::{StructureNode, StructureNodeKind},
markup::Markup,
move_item::Direction,
prime_caches::PrimeCachesProgress,
- references::{rename::RenameError, ReferenceSearchResult},
+ references::ReferenceSearchResult,
+ rename::RenameError,
runnables::{Runnable, RunnableKind, TestId},
syntax_highlighting::{
tags::{Highlight, HlMod, HlMods, HlOperator, HlPunct, HlTag},
symbol_index::Query,
RootDatabase, SymbolKind,
};
+pub use ide_diagnostics::{Diagnostic, DiagnosticsConfig, Severity};
pub use ide_ssr::SsrError;
pub use syntax::{TextRange, TextSize};
pub use text_edit::{Indel, TextEdit};
cfg_options,
Env::default(),
Default::default(),
+ Default::default(),
);
change.change_file(file_id, Some(Arc::new(text)));
change.set_crate_graph(crate_graph);
file_id: FileId,
text_range: Option<TextRange>,
) -> Cancellable<String> {
- self.with_db(|db| syntax_tree::syntax_tree(&db, file_id, text_range))
+ self.with_db(|db| syntax_tree::syntax_tree(db, file_id, text_range))
}
pub fn view_hir(&self, position: FilePosition) -> Cancellable<String> {
- self.with_db(|db| view_hir::view_hir(&db, position))
+ self.with_db(|db| view_hir::view_hir(db, position))
}
pub fn view_item_tree(&self, file_id: FileId) -> Cancellable<String> {
- self.with_db(|db| view_item_tree::view_item_tree(&db, file_id))
+ self.with_db(|db| view_item_tree::view_item_tree(db, file_id))
}
/// Renders the crate graph to GraphViz "dot" syntax.
pub fn view_crate_graph(&self) -> Cancellable<Result<String, String>> {
- self.with_db(|db| view_crate_graph::view_crate_graph(&db))
+ self.with_db(|db| view_crate_graph::view_crate_graph(db))
}
pub fn expand_macro(&self, position: FilePosition) -> Cancellable<Option<ExpandedMacro>> {
/// up minor stuff like continuing the comment.
/// The edit will be a snippet (with `$0`).
pub fn on_enter(&self, position: FilePosition) -> Cancellable<Option<TextEdit>> {
- self.with_db(|db| typing::on_enter(&db, position))
+ self.with_db(|db| typing::on_enter(db, position))
}
/// Returns an edit which should be applied after a character was typed.
if !typing::TRIGGER_CHARS.contains(char_typed) {
return Ok(None);
}
- self.with_db(|db| typing::on_char_typed(&db, position, char_typed))
+ self.with_db(|db| typing::on_char_typed(db, position, char_typed))
}
/// Returns a tree representation of symbols in the file. Useful to draw a
&self,
position: FilePosition,
links_in_hover: bool,
+ documentation: bool,
markdown: bool,
) -> Cancellable<Option<RangeInfo<HoverResult>>> {
- self.with_db(|db| hover::hover(db, position, links_in_hover, markdown))
+ self.with_db(|db| hover::hover(db, position, links_in_hover, documentation, markdown))
}
/// Return URL(s) for the documentation of the symbol under the cursor.
) -> Cancellable<Vec<Assist>> {
self.with_db(|db| {
let ssr_assists = ssr::ssr_assists(db, &resolve, frange);
- let mut acc = Assist::get(db, config, resolve, frange);
+ let mut acc = ide_assists::assists(db, config, resolve, frange);
acc.extend(ssr_assists.into_iter());
acc
})
resolve: AssistResolveStrategy,
file_id: FileId,
) -> Cancellable<Vec<Diagnostic>> {
- self.with_db(|db| diagnostics::diagnostics(db, config, &resolve, file_id))
+ self.with_db(|db| ide_diagnostics::diagnostics(db, config, &resolve, file_id))
}
/// Convenience function to return assists + quick fixes for diagnostics
};
self.with_db(|db| {
- let ssr_assists = ssr::ssr_assists(db, &resolve, frange);
let diagnostic_assists = if include_fixes {
- diagnostics::diagnostics(db, diagnostics_config, &resolve, frange.file_id)
+ ide_diagnostics::diagnostics(db, diagnostics_config, &resolve, frange.file_id)
.into_iter()
.flat_map(|it| it.fixes.unwrap_or_default())
.filter(|it| it.target.intersect(frange.range).is_some())
} else {
Vec::new()
};
+ let ssr_assists = ssr::ssr_assists(db, &resolve, frange);
+ let assists = ide_assists::assists(db, assist_config, resolve, frange);
- let mut res = Assist::get(db, assist_config, resolve, frange);
+ let mut res = diagnostic_assists;
res.extend(ssr_assists.into_iter());
- res.extend(diagnostic_assists.into_iter());
+ res.extend(assists.into_iter());
res
})
position: FilePosition,
new_name: &str,
) -> Cancellable<Result<SourceChange, RenameError>> {
- self.with_db(|db| references::rename::rename(db, position, new_name))
+ self.with_db(|db| rename::rename(db, position, new_name))
}
pub fn prepare_rename(
&self,
position: FilePosition,
) -> Cancellable<Result<RangeInfo<()>, RenameError>> {
- self.with_db(|db| references::rename::prepare_rename(db, position))
+ self.with_db(|db| rename::prepare_rename(db, position))
}
pub fn will_rename_file(
file_id: FileId,
new_name_stem: &str,
) -> Cancellable<Option<SourceChange>> {
- self.with_db(|db| references::rename::will_rename_file(db, file_id, new_name_stem))
+ self.with_db(|db| rename::will_rename_file(db, file_id, new_name_stem))
}
pub fn structural_search_replace(