mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Replace ra_hir_expand::either
with crate
This commit is contained in:
parent
15f143f0c3
commit
009437f5d9
23 changed files with 69 additions and 112 deletions
|
@ -1,6 +1,7 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use hir::{Adt, Either, HasSource, PathResolution};
|
||||
use either::Either;
|
||||
use hir::{Adt, HasSource, PathResolution};
|
||||
use ra_syntax::AstNode;
|
||||
use test_utils::tested_by;
|
||||
|
||||
|
@ -27,7 +28,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
}
|
||||
if Some(module) == ctx.module {
|
||||
if let Some(import) = import {
|
||||
if let Either::A(use_tree) = import.source(ctx.db).value {
|
||||
if let Either::Left(use_tree) = import.source(ctx.db).value {
|
||||
if use_tree.syntax().text_range().contains_inclusive(ctx.offset) {
|
||||
// for `use self::foo<|>`, don't suggest `foo` as a completion
|
||||
tested_by!(dont_complete_current_use);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use hir::{AssocItem, Either, FieldSource, HasSource, InFile, ModuleSource};
|
||||
use either::Either;
|
||||
use hir::{AssocItem, FieldSource, HasSource, InFile, ModuleSource};
|
||||
use ra_db::{FileId, SourceDatabase};
|
||||
use ra_syntax::{
|
||||
ast::{self, DocCommentsOwner, NameOwner},
|
||||
|
@ -342,10 +343,10 @@ impl ToNav for hir::Local {
|
|||
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
||||
let src = self.source(db);
|
||||
let (full_range, focus_range) = match src.value {
|
||||
Either::A(it) => {
|
||||
Either::Left(it) => {
|
||||
(it.syntax().text_range(), it.name().map(|it| it.syntax().text_range()))
|
||||
}
|
||||
Either::B(it) => (it.syntax().text_range(), Some(it.self_kw_token().text_range())),
|
||||
Either::Right(it) => (it.syntax().text_range(), Some(it.self_kw_token().text_range())),
|
||||
};
|
||||
let name = match self.name(db) {
|
||||
Some(it) => it.to_string().into(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue