Skip to content

Commit d4fa672

Browse files
bors[bot]ivan770
andauthored
Merge #8054
8054: Item movers r=matklad a=ivan770 Closes #6823 https://user-images.githubusercontent.com/14003886/111331579-b4f43480-8679-11eb-9af0-e4dabacc4923.mp4 Implementation issues: - [ ] Most of items are non-movable, since _movability_ of any item has to be determined manually. Common ones are movable though - [x] Cursor should move with the item Co-authored-by: ivan770 <[email protected]>
2 parents 3af1885 + d331155 commit d4fa672

File tree

11 files changed

+781
-1
lines changed

11 files changed

+781
-1
lines changed

crates/ide/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ mod hover;
3737
mod inlay_hints;
3838
mod join_lines;
3939
mod matching_brace;
40+
mod move_item;
4041
mod parent_module;
4142
mod references;
4243
mod fn_references;
@@ -76,6 +77,7 @@ pub use crate::{
7677
hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult},
7778
inlay_hints::{InlayHint, InlayHintsConfig, InlayKind},
7879
markup::Markup,
80+
move_item::Direction,
7981
prime_caches::PrimeCachesProgress,
8082
references::{rename::RenameError, ReferenceSearchResult},
8183
runnables::{Runnable, RunnableKind, TestId},
@@ -583,6 +585,14 @@ impl Analysis {
583585
self.with_db(|db| annotations::resolve_annotation(db, annotation))
584586
}
585587

588+
pub fn move_item(
589+
&self,
590+
range: FileRange,
591+
direction: Direction,
592+
) -> Cancelable<Option<TextEdit>> {
593+
self.with_db(|db| move_item::move_item(db, range, direction))
594+
}
595+
586596
/// Performs an operation on that may be Canceled.
587597
fn with_db<F, T>(&self, f: F) -> Cancelable<T>
588598
where

0 commit comments

Comments
 (0)