Skip to content

Commit e618a16

Browse files
committed
jumpable global rename refactor information
1 parent 79bd617 commit e618a16

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/refactor.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,18 @@ function refactorfiles(old, new, mod, files)
9797
oldsym = Symbol(old)
9898
newsym = Symbol(new)
9999
total = length(files)
100-
101100
desc = ""
102101

103102
for (i, file) enumerate(files)
104103
@info "Refactoring: $file ($i / $total)" progress=i/total _id=id
105104
MacroTools.sourcewalk(file) do ex
106105
return if ex === oldsym
107106
newsym
108-
elseif @capture(ex, m_.$oldsym) && getfield′(mod, m) isa Module
109-
desc *= "`$m.$old` ⟹ `$m.$new` in $(fullpath(file))\n"
107+
elseif @capture(ex, m_.$oldsym) && getfield′(mod, Symbol(m)) isa Module
108+
# TODO: enable line location information (the upstream needs to be enhanced)
109+
file = fullpath(file)
110+
link = "atom://julia-client/?open=true&file=$(file)&line=0"
111+
desc *= "- `$m.$old` ⟹ `$m.$new` in [$file]($link)\n"
110112
Expr(:., m, newsym)
111113
else
112114
ex
@@ -116,5 +118,5 @@ function refactorfiles(old, new, mod, files)
116118

117119
@info "Finish global rename refactoring" progress=1 _id=id
118120

119-
(:info, isempty(desc) ? "" : "Refactorings across modules\n\n" * desc)
121+
(:info, isempty(desc) ? "" : "Refactorings across modules\n" * desc)
120122
end

0 commit comments

Comments
 (0)