aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/Cargo.toml1
-rw-r--r--crates/ra_ide/src/completion/complete_path.rs5
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs7
3 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml
index e6383dd35..e3439ae31 100644
--- a/crates/ra_ide/Cargo.toml
+++ b/crates/ra_ide/Cargo.toml
@@ -11,6 +11,7 @@ doctest = false
11wasm = [] 11wasm = []
12 12
13[dependencies] 13[dependencies]
14either = "1.5"
14format-buf = "1.0.0" 15format-buf = "1.0.0"
15itertools = "0.8.0" 16itertools = "0.8.0"
16join_to_string = "0.1.3" 17join_to_string = "0.1.3"
diff --git a/crates/ra_ide/src/completion/complete_path.rs b/crates/ra_ide/src/completion/complete_path.rs
index 89e0009a1..28f94e0a7 100644
--- a/crates/ra_ide/src/completion/complete_path.rs
+++ b/crates/ra_ide/src/completion/complete_path.rs
@@ -1,6 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir::{Adt, Either, HasSource, PathResolution}; 3use either::Either;
4use hir::{Adt, HasSource, PathResolution};
4use ra_syntax::AstNode; 5use ra_syntax::AstNode;
5use test_utils::tested_by; 6use test_utils::tested_by;
6 7
@@ -27,7 +28,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
27 } 28 }
28 if Some(module) == ctx.module { 29 if Some(module) == ctx.module {
29 if let Some(import) = import { 30 if let Some(import) = import {
30 if let Either::A(use_tree) = import.source(ctx.db).value { 31 if let Either::Left(use_tree) = import.source(ctx.db).value {
31 if use_tree.syntax().text_range().contains_inclusive(ctx.offset) { 32 if use_tree.syntax().text_range().contains_inclusive(ctx.offset) {
32 // for `use self::foo<|>`, don't suggest `foo` as a completion 33 // for `use self::foo<|>`, don't suggest `foo` as a completion
33 tested_by!(dont_complete_current_use); 34 tested_by!(dont_complete_current_use);
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index 61dca14ac..f920d3db6 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -1,6 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir::{AssocItem, Either, FieldSource, HasSource, InFile, ModuleSource}; 3use either::Either;
4use hir::{AssocItem, FieldSource, HasSource, InFile, ModuleSource};
4use ra_db::{FileId, SourceDatabase}; 5use ra_db::{FileId, SourceDatabase};
5use ra_syntax::{ 6use ra_syntax::{
6 ast::{self, DocCommentsOwner, NameOwner}, 7 ast::{self, DocCommentsOwner, NameOwner},
@@ -342,10 +343,10 @@ impl ToNav for hir::Local {
342 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 343 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
343 let src = self.source(db); 344 let src = self.source(db);
344 let (full_range, focus_range) = match src.value { 345 let (full_range, focus_range) = match src.value {
345 Either::A(it) => { 346 Either::Left(it) => {
346 (it.syntax().text_range(), it.name().map(|it| it.syntax().text_range())) 347 (it.syntax().text_range(), it.name().map(|it| it.syntax().text_range()))
347 } 348 }
348 Either::B(it) => (it.syntax().text_range(), Some(it.self_kw_token().text_range())), 349 Either::Right(it) => (it.syntax().text_range(), Some(it.self_kw_token().text_range())),
349 }; 350 };
350 let name = match self.name(db) { 351 let name = match self.name(db) {
351 Some(it) => it.to_string().into(), 352 Some(it) => it.to_string().into(),