mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Rename Type => TypeAlias
This commit is contained in:
parent
61d9612633
commit
bd8ed644e4
12 changed files with 57 additions and 43 deletions
|
@ -85,9 +85,19 @@ pub enum ModuleDef {
|
||||||
Const(Const),
|
Const(Const),
|
||||||
Static(Static),
|
Static(Static),
|
||||||
Trait(Trait),
|
Trait(Trait),
|
||||||
Type(Type),
|
TypeAlias(TypeAlias),
|
||||||
}
|
}
|
||||||
impl_froms!(ModuleDef: Module, Function, Struct, Enum, EnumVariant, Const, Static, Trait, Type);
|
impl_froms!(
|
||||||
|
ModuleDef: Module,
|
||||||
|
Function,
|
||||||
|
Struct,
|
||||||
|
Enum,
|
||||||
|
EnumVariant,
|
||||||
|
Const,
|
||||||
|
Static,
|
||||||
|
Trait,
|
||||||
|
TypeAlias
|
||||||
|
);
|
||||||
|
|
||||||
pub enum ModuleSource {
|
pub enum ModuleSource {
|
||||||
SourceFile(TreeArc<ast::SourceFile>),
|
SourceFile(TreeArc<ast::SourceFile>),
|
||||||
|
@ -604,11 +614,11 @@ impl Docs for Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct Type {
|
pub struct TypeAlias {
|
||||||
pub(crate) id: TypeId,
|
pub(crate) id: TypeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Type {
|
impl TypeAlias {
|
||||||
pub fn source(&self, db: &impl PersistentHirDatabase) -> (HirFileId, TreeArc<ast::TypeDef>) {
|
pub fn source(&self, db: &impl PersistentHirDatabase) -> (HirFileId, TreeArc<ast::TypeDef>) {
|
||||||
self.id.source(db)
|
self.id.source(db)
|
||||||
}
|
}
|
||||||
|
@ -645,7 +655,7 @@ impl Type {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Docs for Type {
|
impl Docs for TypeAlias {
|
||||||
fn docs(&self, db: &impl HirDatabase) -> Option<Documentation> {
|
fn docs(&self, db: &impl HirDatabase) -> Option<Documentation> {
|
||||||
docs_from_ast(&*self.source(db).1)
|
docs_from_ast(&*self.source(db).1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use ra_db::{SourceDatabase, salsa};
|
||||||
use crate::{
|
use crate::{
|
||||||
MacroCallId, HirFileId,
|
MacroCallId, HirFileId,
|
||||||
SourceFileItems, SourceItemId, Crate, Module, HirInterner,
|
SourceFileItems, SourceItemId, Crate, Module, HirInterner,
|
||||||
Function, FnSignature, ExprScopes,
|
Function, FnSignature, ExprScopes, TypeAlias,
|
||||||
Struct, Enum, StructField,
|
Struct, Enum, StructField,
|
||||||
macros::MacroExpansion,
|
macros::MacroExpansion,
|
||||||
module_tree::ModuleTree,
|
module_tree::ModuleTree,
|
||||||
|
@ -15,7 +15,9 @@ use crate::{
|
||||||
adt::{StructData, EnumData},
|
adt::{StructData, EnumData},
|
||||||
impl_block::{ModuleImplBlocks, ImplSourceMap},
|
impl_block::{ModuleImplBlocks, ImplSourceMap},
|
||||||
generics::{GenericParams, GenericDef},
|
generics::{GenericParams, GenericDef},
|
||||||
ids::SourceFileItemId, nameres::Namespace, type_ref::TypeRef, code_model_api::Type
|
ids::SourceFileItemId,
|
||||||
|
nameres::Namespace,
|
||||||
|
type_ref::TypeRef,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[salsa::query_group(PersistentHirDatabaseStorage)]
|
#[salsa::query_group(PersistentHirDatabaseStorage)]
|
||||||
|
@ -79,7 +81,7 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef<HirInterner> {
|
||||||
fn fn_signature(&self, func: Function) -> Arc<FnSignature>;
|
fn fn_signature(&self, func: Function) -> Arc<FnSignature>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::type_alias::type_alias_ref_query)]
|
#[salsa::invoke(crate::type_alias::type_alias_ref_query)]
|
||||||
fn type_alias_ref(&self, typ: Type) -> Arc<TypeRef>;
|
fn type_alias_ref(&self, typ: TypeAlias) -> Arc<TypeRef>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[salsa::query_group(HirDatabaseStorage)]
|
#[salsa::query_group(HirDatabaseStorage)]
|
||||||
|
|
|
@ -7,7 +7,10 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use ra_syntax::ast::{self, NameOwner, TypeParamsOwner};
|
use ra_syntax::ast::{self, NameOwner, TypeParamsOwner};
|
||||||
|
|
||||||
use crate::{db::PersistentHirDatabase, Name, AsName, Function, Struct, Enum, Trait, Type, ImplBlock};
|
use crate::{
|
||||||
|
db::PersistentHirDatabase,
|
||||||
|
Name, AsName, Function, Struct, Enum, Trait, TypeAlias, ImplBlock
|
||||||
|
};
|
||||||
|
|
||||||
/// Data about a generic parameter (to a function, struct, impl, ...).
|
/// Data about a generic parameter (to a function, struct, impl, ...).
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
|
@ -30,10 +33,10 @@ pub enum GenericDef {
|
||||||
Struct(Struct),
|
Struct(Struct),
|
||||||
Enum(Enum),
|
Enum(Enum),
|
||||||
Trait(Trait),
|
Trait(Trait),
|
||||||
Type(Type),
|
TypeAlias(TypeAlias),
|
||||||
ImplBlock(ImplBlock),
|
ImplBlock(ImplBlock),
|
||||||
}
|
}
|
||||||
impl_froms!(GenericDef: Function, Struct, Enum, Trait, Type, ImplBlock);
|
impl_froms!(GenericDef: Function, Struct, Enum, Trait, TypeAlias, ImplBlock);
|
||||||
|
|
||||||
impl GenericParams {
|
impl GenericParams {
|
||||||
pub(crate) fn generic_params_query(
|
pub(crate) fn generic_params_query(
|
||||||
|
@ -43,7 +46,7 @@ impl GenericParams {
|
||||||
let mut generics = GenericParams::default();
|
let mut generics = GenericParams::default();
|
||||||
let parent = match def {
|
let parent = match def {
|
||||||
GenericDef::Function(it) => it.impl_block(db),
|
GenericDef::Function(it) => it.impl_block(db),
|
||||||
GenericDef::Type(it) => it.impl_block(db),
|
GenericDef::TypeAlias(it) => it.impl_block(db),
|
||||||
GenericDef::Struct(_) | GenericDef::Enum(_) | GenericDef::Trait(_) => None,
|
GenericDef::Struct(_) | GenericDef::Enum(_) | GenericDef::Trait(_) => None,
|
||||||
GenericDef::ImplBlock(_) => None,
|
GenericDef::ImplBlock(_) => None,
|
||||||
};
|
};
|
||||||
|
@ -54,7 +57,7 @@ impl GenericParams {
|
||||||
GenericDef::Struct(it) => generics.fill(&*it.source(db).1, start),
|
GenericDef::Struct(it) => generics.fill(&*it.source(db).1, start),
|
||||||
GenericDef::Enum(it) => generics.fill(&*it.source(db).1, start),
|
GenericDef::Enum(it) => generics.fill(&*it.source(db).1, start),
|
||||||
GenericDef::Trait(it) => generics.fill(&*it.source(db).1, start),
|
GenericDef::Trait(it) => generics.fill(&*it.source(db).1, start),
|
||||||
GenericDef::Type(it) => generics.fill(&*it.source(db).1, start),
|
GenericDef::TypeAlias(it) => generics.fill(&*it.source(db).1, start),
|
||||||
GenericDef::ImplBlock(it) => generics.fill(&*it.source(db).1, start),
|
GenericDef::ImplBlock(it) => generics.fill(&*it.source(db).1, start),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use ra_syntax::{
|
||||||
ast::{self, AstNode}};
|
ast::{self, AstNode}};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Const, Type, Function, HirFileId,
|
Const, TypeAlias, Function, HirFileId,
|
||||||
HirDatabase, PersistentHirDatabase,
|
HirDatabase, PersistentHirDatabase,
|
||||||
ModuleDef, Trait, Resolution,
|
ModuleDef, Trait, Resolution,
|
||||||
type_ref::TypeRef,
|
type_ref::TypeRef,
|
||||||
|
@ -135,13 +135,9 @@ impl ImplData {
|
||||||
item_list
|
item_list
|
||||||
.impl_items()
|
.impl_items()
|
||||||
.map(|item_node| match item_node.kind() {
|
.map(|item_node| match item_node.kind() {
|
||||||
ast::ImplItemKind::FnDef(it) => {
|
ast::ImplItemKind::FnDef(it) => Function { id: ctx.to_def(it) }.into(),
|
||||||
ImplItem::Method(Function { id: ctx.to_def(it) })
|
ast::ImplItemKind::ConstDef(it) => Const { id: ctx.to_def(it) }.into(),
|
||||||
}
|
ast::ImplItemKind::TypeDef(it) => TypeAlias { id: ctx.to_def(it) }.into(),
|
||||||
ast::ImplItemKind::ConstDef(it) => {
|
|
||||||
ImplItem::Const(Const { id: ctx.to_def(it) })
|
|
||||||
}
|
|
||||||
ast::ImplItemKind::TypeDef(it) => ImplItem::Type(Type { id: ctx.to_def(it) }),
|
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
|
@ -168,10 +164,10 @@ impl ImplData {
|
||||||
pub enum ImplItem {
|
pub enum ImplItem {
|
||||||
Method(Function),
|
Method(Function),
|
||||||
Const(Const),
|
Const(Const),
|
||||||
Type(Type),
|
TypeAlias(TypeAlias),
|
||||||
// Existential
|
// Existential
|
||||||
}
|
}
|
||||||
impl_froms!(ImplItem: Const, Type);
|
impl_froms!(ImplItem: Const, TypeAlias);
|
||||||
|
|
||||||
impl From<Function> for ImplItem {
|
impl From<Function> for ImplItem {
|
||||||
fn from(func: Function) -> ImplItem {
|
fn from(func: Function) -> ImplItem {
|
||||||
|
|
|
@ -72,5 +72,5 @@ pub use self::code_model_api::{
|
||||||
Function, FnSignature,
|
Function, FnSignature,
|
||||||
StructField, FieldSource,
|
StructField, FieldSource,
|
||||||
Static, Const,
|
Static, Const,
|
||||||
Trait, Type,
|
Trait, TypeAlias,
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ use rustc_hash::FxHashMap;
|
||||||
use crate::{
|
use crate::{
|
||||||
SourceItemId, Path, ModuleSource, Name,
|
SourceItemId, Path, ModuleSource, Name,
|
||||||
HirFileId, MacroCallLoc, AsName, PerNs, Function,
|
HirFileId, MacroCallLoc, AsName, PerNs, Function,
|
||||||
ModuleDef, Module, Struct, Enum, Const, Static, Trait, Type,
|
ModuleDef, Module, Struct, Enum, Const, Static, Trait, TypeAlias,
|
||||||
ids::LocationCtx, PersistentHirDatabase,
|
ids::LocationCtx, PersistentHirDatabase,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ impl LoweredModule {
|
||||||
}
|
}
|
||||||
ast::ModuleItemKind::TypeDef(it) => {
|
ast::ModuleItemKind::TypeDef(it) => {
|
||||||
if let Some(name) = it.name() {
|
if let Some(name) = it.name() {
|
||||||
let t = Type { id: ctx.to_def(it) };
|
let t = TypeAlias { id: ctx.to_def(it) };
|
||||||
self.declarations.insert(name.as_name(), PerNs::types(t.into()));
|
self.declarations.insert(name.as_name(), PerNs::types(t.into()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,7 +406,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
||||||
crate::ImplItem::Const(_) => None,
|
crate::ImplItem::Const(_) => None,
|
||||||
|
|
||||||
// TODO: Resolve associated types
|
// TODO: Resolve associated types
|
||||||
crate::ImplItem::Type(_) => None,
|
crate::ImplItem::TypeAlias(_) => None,
|
||||||
})?;
|
})?;
|
||||||
resolved = Resolution::Def(item.into());
|
resolved = Resolution::Def(item.into());
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
||||||
let ty = self.insert_type_vars(ty.apply_substs(substs));
|
let ty = self.insert_type_vars(ty.apply_substs(substs));
|
||||||
(ty, Some(var.into()))
|
(ty, Some(var.into()))
|
||||||
}
|
}
|
||||||
TypableDef::Type(_) | TypableDef::Function(_) | TypableDef::Enum(_) => {
|
TypableDef::TypeAlias(_) | TypableDef::Function(_) | TypableDef::Enum(_) => {
|
||||||
(Ty::Unknown, None)
|
(Ty::Unknown, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Function, Struct, StructField, Enum, EnumVariant, Path, Name,
|
Function, Struct, StructField, Enum, EnumVariant, Path, Name,
|
||||||
ModuleDef, Type,
|
ModuleDef, TypeAlias,
|
||||||
HirDatabase,
|
HirDatabase,
|
||||||
type_ref::TypeRef,
|
type_ref::TypeRef,
|
||||||
name::KnownName,
|
name::KnownName,
|
||||||
|
@ -124,7 +124,7 @@ impl Ty {
|
||||||
TypableDef::Struct(s) => s.generic_params(db),
|
TypableDef::Struct(s) => s.generic_params(db),
|
||||||
TypableDef::Enum(e) => e.generic_params(db),
|
TypableDef::Enum(e) => e.generic_params(db),
|
||||||
TypableDef::EnumVariant(var) => var.parent_enum(db).generic_params(db),
|
TypableDef::EnumVariant(var) => var.parent_enum(db).generic_params(db),
|
||||||
TypableDef::Type(t) => t.generic_params(db),
|
TypableDef::TypeAlias(t) => t.generic_params(db),
|
||||||
};
|
};
|
||||||
let parent_param_count = def_generics.count_parent_params();
|
let parent_param_count = def_generics.count_parent_params();
|
||||||
substs.extend((0..parent_param_count).map(|_| Ty::Unknown));
|
substs.extend((0..parent_param_count).map(|_| Ty::Unknown));
|
||||||
|
@ -163,7 +163,7 @@ impl Ty {
|
||||||
TypableDef::Function(_)
|
TypableDef::Function(_)
|
||||||
| TypableDef::Struct(_)
|
| TypableDef::Struct(_)
|
||||||
| TypableDef::Enum(_)
|
| TypableDef::Enum(_)
|
||||||
| TypableDef::Type(_) => last,
|
| TypableDef::TypeAlias(_) => last,
|
||||||
TypableDef::EnumVariant(_) => {
|
TypableDef::EnumVariant(_) => {
|
||||||
// the generic args for an enum variant may be either specified
|
// the generic args for an enum variant may be either specified
|
||||||
// on the segment referring to the enum, or on the segment
|
// on the segment referring to the enum, or on the segment
|
||||||
|
@ -196,13 +196,13 @@ pub(crate) fn type_for_def(db: &impl HirDatabase, def: TypableDef, ns: Namespace
|
||||||
(TypableDef::Struct(s), Namespace::Values) => type_for_struct_constructor(db, s),
|
(TypableDef::Struct(s), Namespace::Values) => type_for_struct_constructor(db, s),
|
||||||
(TypableDef::Enum(e), Namespace::Types) => type_for_enum(db, e),
|
(TypableDef::Enum(e), Namespace::Types) => type_for_enum(db, e),
|
||||||
(TypableDef::EnumVariant(v), Namespace::Values) => type_for_enum_variant_constructor(db, v),
|
(TypableDef::EnumVariant(v), Namespace::Values) => type_for_enum_variant_constructor(db, v),
|
||||||
(TypableDef::Type(t), Namespace::Types) => type_for_type_alias(db, t),
|
(TypableDef::TypeAlias(t), Namespace::Types) => type_for_type_alias(db, t),
|
||||||
|
|
||||||
// 'error' cases:
|
// 'error' cases:
|
||||||
(TypableDef::Function(_), Namespace::Types) => Ty::Unknown,
|
(TypableDef::Function(_), Namespace::Types) => Ty::Unknown,
|
||||||
(TypableDef::Enum(_), Namespace::Values) => Ty::Unknown,
|
(TypableDef::Enum(_), Namespace::Values) => Ty::Unknown,
|
||||||
(TypableDef::EnumVariant(_), Namespace::Types) => Ty::Unknown,
|
(TypableDef::EnumVariant(_), Namespace::Types) => Ty::Unknown,
|
||||||
(TypableDef::Type(_), Namespace::Values) => Ty::Unknown,
|
(TypableDef::TypeAlias(_), Namespace::Values) => Ty::Unknown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ fn type_for_enum(db: &impl HirDatabase, s: Enum) -> Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn type_for_type_alias(db: &impl HirDatabase, t: Type) -> Ty {
|
fn type_for_type_alias(db: &impl HirDatabase, t: TypeAlias) -> Ty {
|
||||||
let generics = t.generic_params(db);
|
let generics = t.generic_params(db);
|
||||||
let resolver = t.resolver(db);
|
let resolver = t.resolver(db);
|
||||||
let type_ref = t.type_ref(db);
|
let type_ref = t.type_ref(db);
|
||||||
|
@ -317,9 +317,9 @@ pub enum TypableDef {
|
||||||
Struct(Struct),
|
Struct(Struct),
|
||||||
Enum(Enum),
|
Enum(Enum),
|
||||||
EnumVariant(EnumVariant),
|
EnumVariant(EnumVariant),
|
||||||
Type(Type),
|
TypeAlias(TypeAlias),
|
||||||
}
|
}
|
||||||
impl_froms!(TypableDef: Function, Struct, Enum, EnumVariant, Type);
|
impl_froms!(TypableDef: Function, Struct, Enum, EnumVariant, TypeAlias);
|
||||||
|
|
||||||
impl From<ModuleDef> for Option<TypableDef> {
|
impl From<ModuleDef> for Option<TypableDef> {
|
||||||
fn from(def: ModuleDef) -> Option<TypableDef> {
|
fn from(def: ModuleDef) -> Option<TypableDef> {
|
||||||
|
@ -328,7 +328,7 @@ impl From<ModuleDef> for Option<TypableDef> {
|
||||||
ModuleDef::Struct(s) => s.into(),
|
ModuleDef::Struct(s) => s.into(),
|
||||||
ModuleDef::Enum(e) => e.into(),
|
ModuleDef::Enum(e) => e.into(),
|
||||||
ModuleDef::EnumVariant(v) => v.into(),
|
ModuleDef::EnumVariant(v) => v.into(),
|
||||||
ModuleDef::Type(t) => t.into(),
|
ModuleDef::TypeAlias(t) => t.into(),
|
||||||
ModuleDef::Const(_)
|
ModuleDef::Const(_)
|
||||||
| ModuleDef::Static(_)
|
| ModuleDef::Static(_)
|
||||||
| ModuleDef::Module(_)
|
| ModuleDef::Module(_)
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{code_model_api::Type, db::PersistentHirDatabase, type_ref::TypeRef};
|
use crate::{TypeAlias, db::PersistentHirDatabase, type_ref::TypeRef};
|
||||||
|
|
||||||
pub(crate) fn type_alias_ref_query(db: &impl PersistentHirDatabase, typ: Type) -> Arc<TypeRef> {
|
pub(crate) fn type_alias_ref_query(
|
||||||
|
db: &impl PersistentHirDatabase,
|
||||||
|
typ: TypeAlias,
|
||||||
|
) -> Arc<TypeRef> {
|
||||||
let (_, node) = typ.source(db);
|
let (_, node) = typ.source(db);
|
||||||
Arc::new(TypeRef::from_ast_opt(node.type_ref()))
|
Arc::new(TypeRef::from_ast_opt(node.type_ref()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::ImplItem::Const(ct) => acc.add_const(ctx, ct),
|
hir::ImplItem::Const(ct) => acc.add_const(ctx, ct),
|
||||||
hir::ImplItem::Type(ty) => acc.add_type(ctx, ty),
|
hir::ImplItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty),
|
||||||
}
|
}
|
||||||
None::<()>
|
None::<()>
|
||||||
});
|
});
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl Completions {
|
||||||
Resolution::Def(Const(it)) => (CompletionItemKind::Const, it.docs(ctx.db)),
|
Resolution::Def(Const(it)) => (CompletionItemKind::Const, it.docs(ctx.db)),
|
||||||
Resolution::Def(Static(it)) => (CompletionItemKind::Static, it.docs(ctx.db)),
|
Resolution::Def(Static(it)) => (CompletionItemKind::Static, it.docs(ctx.db)),
|
||||||
Resolution::Def(Trait(it)) => (CompletionItemKind::Trait, it.docs(ctx.db)),
|
Resolution::Def(Trait(it)) => (CompletionItemKind::Trait, it.docs(ctx.db)),
|
||||||
Resolution::Def(Type(it)) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)),
|
Resolution::Def(TypeAlias(it)) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)),
|
||||||
Resolution::GenericParam(..) => (CompletionItemKind::TypeParam, None),
|
Resolution::GenericParam(..) => (CompletionItemKind::TypeParam, None),
|
||||||
Resolution::LocalBinding(..) => (CompletionItemKind::Binding, None),
|
Resolution::LocalBinding(..) => (CompletionItemKind::Binding, None),
|
||||||
Resolution::SelfType(..) => (
|
Resolution::SelfType(..) => (
|
||||||
|
@ -132,7 +132,7 @@ impl Completions {
|
||||||
.add_to(self);
|
.add_to(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn add_type(&mut self, ctx: &CompletionContext, type_alias: hir::Type) {
|
pub(crate) fn add_type_alias(&mut self, ctx: &CompletionContext, type_alias: hir::TypeAlias) {
|
||||||
let (_file_id, type_def) = type_alias.source(ctx.db);
|
let (_file_id, type_def) = type_alias.source(ctx.db);
|
||||||
let name = match type_def.name() {
|
let name = match type_def.name() {
|
||||||
Some(name) => name,
|
Some(name) => name,
|
||||||
|
|
|
@ -154,7 +154,7 @@ impl NavigationTarget {
|
||||||
let (file_id, node) = e.source(db);
|
let (file_id, node) = e.source(db);
|
||||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||||
}
|
}
|
||||||
hir::ModuleDef::Type(e) => {
|
hir::ModuleDef::TypeAlias(e) => {
|
||||||
let (file_id, node) = e.source(db);
|
let (file_id, node) = e.source(db);
|
||||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue