From fdd4df97ba5ce1f59abf9e945052fc6f3e077c3a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 6 May 2020 15:26:40 +0200 Subject: Use SourceChange for assists --- crates/ra_ide_db/src/source_change.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide_db/src') diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ra_ide_db/src/source_change.rs index 4dd01b312..af81a91a4 100644 --- a/crates/ra_ide_db/src/source_change.rs +++ b/crates/ra_ide_db/src/source_change.rs @@ -6,7 +6,7 @@ use ra_db::{FileId, FilePosition, RelativePathBuf, SourceRootId}; use ra_text_edit::{TextEdit, TextSize}; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct SourceChange { /// For display in the undo log in the editor pub label: String, @@ -90,13 +90,13 @@ impl SourceChange { } } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct SourceFileEdit { pub file_id: FileId, pub edit: TextEdit, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum FileSystemEdit { CreateFile { source_root: SourceRootId, path: RelativePathBuf }, MoveFile { src: FileId, dst_source_root: SourceRootId, dst_path: RelativePathBuf }, -- cgit v1.2.3 From bd9f1f7eb78843ddd91d259a04e988b0681a5db4 Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Wed, 6 May 2020 17:17:35 +0300 Subject: Fix rename of enum variant visible from module --- crates/ra_ide_db/src/defs.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide_db/src') diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 40d0e77b5..2e2850efb 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -47,7 +47,10 @@ impl Definition { match self { Definition::Macro(_) => None, Definition::Field(sf) => Some(sf.visibility(db)), - Definition::ModuleDef(def) => module?.visibility_of(db, def), + Definition::ModuleDef(def) => match def { + ModuleDef::EnumVariant(id) => Some(id.visibility(db)), + _ => module?.visibility_of(db, def), + }, Definition::SelfType(_) => None, Definition::Local(_) => None, Definition::TypeParam(_) => None, -- cgit v1.2.3 From 210f0cbd27b0621c47e15c74bbb16ab47a642999 Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Thu, 7 May 2020 16:30:20 +0300 Subject: Remove HasVisibility implementation --- crates/ra_ide_db/src/defs.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_db/src') diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 2e2850efb..f990e3bb9 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -6,7 +6,7 @@ // FIXME: this badly needs rename/rewrite (matklad, 2020-02-06). use hir::{ - Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, + Adt, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, Semantics, TypeParam, Visibility, }; use ra_prof::profile; @@ -48,7 +48,10 @@ impl Definition { Definition::Macro(_) => None, Definition::Field(sf) => Some(sf.visibility(db)), Definition::ModuleDef(def) => match def { - ModuleDef::EnumVariant(id) => Some(id.visibility(db)), + ModuleDef::EnumVariant(id) => { + let parent = id.parent_enum(db); + module?.visibility_of(db, &ModuleDef::Adt(Adt::Enum(parent))) + } _ => module?.visibility_of(db, def), }, Definition::SelfType(_) => None, -- cgit v1.2.3