Move ReferenceKind

This commit is contained in:
Aleksey Kladov 2020-03-04 12:06:37 +01:00
parent a549da7e3e
commit 1874b6738a
2 changed files with 21 additions and 21 deletions

View file

@ -31,7 +31,7 @@ use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeI
pub(crate) use self::rename::rename;
pub use ra_ide_db::search::SearchScope;
pub use ra_ide_db::search::{Reference, ReferenceAccess, ReferenceKind, SearchScope};
#[derive(Debug, Clone)]
pub struct ReferenceSearchResult {
@ -46,25 +46,6 @@ pub struct Declaration {
pub access: Option<ReferenceAccess>,
}
#[derive(Debug, Clone)]
pub struct Reference {
pub file_range: FileRange,
pub kind: ReferenceKind,
pub access: Option<ReferenceAccess>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum ReferenceKind {
StructLiteral,
Other,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum ReferenceAccess {
Read,
Write,
}
impl ReferenceSearchResult {
pub fn declaration(&self) -> &Declaration {
&self.declaration

View file

@ -5,13 +5,32 @@
use std::mem;
use hir::{DefWithBody, HasSource, ModuleSource};
use ra_db::{FileId, SourceDatabaseExt};
use ra_db::{FileId, FileRange, SourceDatabaseExt};
use ra_prof::profile;
use ra_syntax::{AstNode, TextRange};
use rustc_hash::FxHashMap;
use crate::{defs::Definition, RootDatabase};
#[derive(Debug, Clone)]
pub struct Reference {
pub file_range: FileRange,
pub kind: ReferenceKind,
pub access: Option<ReferenceAccess>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum ReferenceKind {
StructLiteral,
Other,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum ReferenceAccess {
Read,
Write,
}
pub struct SearchScope {
entries: FxHashMap<FileId, Option<TextRange>>,
}