aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/extend_selection.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-28 16:17:19 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-28 16:17:19 +0000
commit7a268b9b9635425176f93d3c893fb5345e84e9ce (patch)
tree6ea69024cb22d3fc48a3b392a0185163fa452014 /crates/ra_analysis/src/extend_selection.rs
parent9d6740a9c9ad2ca47c4885bd994f849e90bbef86 (diff)
parentb911ee542b2f4d1cd62a655f24197856cd9b9097 (diff)
Merge #350
350: Super simple macro support r=matklad a=matklad Super simple support for macros, mostly for figuring out how to fit them into the current architecture. Expansion is hard-coded and string based (mid-term, we should try to copy-paste macro-by-example expander from rustc). Ideally, we should handle * highlighting inside the macro (done) * extend selection inside the macro * completion inside the macro * indexing structs, produced by the macro Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/extend_selection.rs')
-rw-r--r--crates/ra_analysis/src/extend_selection.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_analysis/src/extend_selection.rs b/crates/ra_analysis/src/extend_selection.rs
new file mode 100644
index 000000000..5e1fbee18
--- /dev/null
+++ b/crates/ra_analysis/src/extend_selection.rs
@@ -0,0 +1,11 @@
1use ra_db::SyntaxDatabase;
2
3use crate::{
4 TextRange, FileRange,
5 db::RootDatabase,
6};
7
8pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange {
9 let file = db.source_file(frange.file_id);
10 ra_editor::extend_selection(&file, frange.range).unwrap_or(frange.range)
11}