diff options
author | ivan770 <[email protected]> | 2021-03-16 12:37:00 +0000 |
---|---|---|
committer | ivan770 <[email protected]> | 2021-03-18 09:22:27 +0000 |
commit | 7d604584954660d255ad0929d3be8ce03f879d0c (patch) | |
tree | 613fdfdfd7eeb170082800533fb8b669dc35d25b /crates/ide/src/lib.rs | |
parent | d704750ba982153d92ccff90cf236121641b9da3 (diff) |
Item up and down movers
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r-- | crates/ide/src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 662da5a96..3f73c0632 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -37,6 +37,7 @@ mod hover; | |||
37 | mod inlay_hints; | 37 | mod inlay_hints; |
38 | mod join_lines; | 38 | mod join_lines; |
39 | mod matching_brace; | 39 | mod matching_brace; |
40 | mod move_item; | ||
40 | mod parent_module; | 41 | mod parent_module; |
41 | mod references; | 42 | mod references; |
42 | mod fn_references; | 43 | mod fn_references; |
@@ -76,6 +77,7 @@ pub use crate::{ | |||
76 | hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, | 77 | hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, |
77 | inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, | 78 | inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, |
78 | markup::Markup, | 79 | markup::Markup, |
80 | move_item::Direction, | ||
79 | prime_caches::PrimeCachesProgress, | 81 | prime_caches::PrimeCachesProgress, |
80 | references::{rename::RenameError, ReferenceSearchResult}, | 82 | references::{rename::RenameError, ReferenceSearchResult}, |
81 | runnables::{Runnable, RunnableKind, TestId}, | 83 | runnables::{Runnable, RunnableKind, TestId}, |
@@ -583,6 +585,14 @@ impl Analysis { | |||
583 | self.with_db(|db| annotations::resolve_annotation(db, annotation)) | 585 | self.with_db(|db| annotations::resolve_annotation(db, annotation)) |
584 | } | 586 | } |
585 | 587 | ||
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 | |||
586 | /// Performs an operation on that may be Canceled. | 596 | /// Performs an operation on that may be Canceled. |
587 | fn with_db<F, T>(&self, f: F) -> Cancelable<T> | 597 | fn with_db<F, T>(&self, f: F) -> Cancelable<T> |
588 | where | 598 | where |