Move typing to ra_ide_api
This commit is contained in:
parent
d99abe4c25
commit
0c15deac76
@ -37,6 +37,7 @@ mod line_index;
|
||||
mod folding_ranges;
|
||||
mod line_index_utils;
|
||||
mod join_lines;
|
||||
mod typing;
|
||||
|
||||
#[cfg(test)]
|
||||
mod marks;
|
||||
@ -295,7 +296,7 @@ impl Analysis {
|
||||
/// up minor stuff like continuing the comment.
|
||||
pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> {
|
||||
let file = self.db.parse(position.file_id);
|
||||
let edit = ra_ide_api_light::on_enter(&file, position.offset)?;
|
||||
let edit = typing::on_enter(&file, position.offset)?;
|
||||
Some(SourceChange::from_local_edit(position.file_id, edit))
|
||||
}
|
||||
|
||||
@ -304,14 +305,14 @@ impl Analysis {
|
||||
// FIXME: use a snippet completion instead of this hack here.
|
||||
pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
|
||||
let file = self.db.parse(position.file_id);
|
||||
let edit = ra_ide_api_light::on_eq_typed(&file, position.offset)?;
|
||||
let edit = typing::on_eq_typed(&file, position.offset)?;
|
||||
Some(SourceChange::from_local_edit(position.file_id, edit))
|
||||
}
|
||||
|
||||
/// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately.
|
||||
pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> {
|
||||
let file = self.db.parse(position.file_id);
|
||||
let edit = ra_ide_api_light::on_dot_typed(&file, position.offset)?;
|
||||
let edit = typing::on_dot_typed(&file, position.offset)?;
|
||||
Some(SourceChange::from_local_edit(position.file_id, edit))
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@ use ra_syntax::{
|
||||
ast::{self, AstToken},
|
||||
};
|
||||
use ra_fmt::leading_indent;
|
||||
use crate::{LocalEdit, TextEditBuilder};
|
||||
use crate::LocalEdit;
|
||||
use ra_text_edit::TextEditBuilder;
|
||||
|
||||
pub fn on_enter(file: &SourceFile, offset: TextUnit) -> Option<LocalEdit> {
|
||||
let comment =
|
@ -4,10 +4,8 @@
|
||||
//! an edit or some auxiliary info.
|
||||
|
||||
mod structure;
|
||||
mod typing;
|
||||
|
||||
use rustc_hash::FxHashSet;
|
||||
use ra_text_edit::TextEditBuilder;
|
||||
use ra_syntax::{
|
||||
SourceFile, SyntaxNode, TextRange, TextUnit, Direction,
|
||||
algo::find_leaf_at_offset,
|
||||
@ -17,7 +15,6 @@ use ra_syntax::{
|
||||
|
||||
pub use crate::{
|
||||
structure::{file_structure, StructureNode},
|
||||
typing::{on_enter, on_dot_typed, on_eq_typed},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user