@@ -41,28 +41,27 @@ function renamerefactor(
41
41
if islocalrefactor (bind, old)
42
42
try
43
43
refactored = localrefactor (old, new, path, column, row, startrow, context, expr)
44
- isempty (refactored) || return Dict (
45
- :text => refactored,
46
- :success => " _Local_ rename refactoring `$old ` ⟹ `$new ` succeeded"
47
- )
44
+ return isempty (refactored) ?
45
+ # NOTE: global refactoring not on definition, e.g.: on a call site, will be caught here
46
+ Dict (:info => contextdescription (old, mod, context)) :
47
+ Dict (
48
+ :text => refactored,
49
+ :success => " _Local_ rename refactoring `$old ` ⟹ `$new ` succeeded"
50
+ )
48
51
catch err
49
52
@error err
50
53
end
51
54
end
52
55
53
56
# global rename refactor if the local rename refactor didn't happen
54
57
try
55
- val = getfield′ (mod, full)
56
-
57
- # catch global refactoring not on definition, e.g.: on a call site
58
- islocalrefactor (bind, old) && return Dict (:info => contextdescription (old, mod, context))
59
-
60
58
kind, desc = globalrefactor (old, new, mod, expr)
61
59
62
60
# make description
63
61
if kind === :success
62
+ val = getfield′ (mod, full)
64
63
moddesc = if (headval isa Module && headval ≠ mod) ||
65
- (applicable (parentmodule, val) && (headval = parentmodule (val)) ≠ mod)
64
+ (applicable (parentmodule, val) && (headval = parentmodule (val)) ≠ mod)
66
65
moduledescription (old, headval)
67
66
else
68
67
" "
@@ -175,23 +174,15 @@ function refactorfiles(old, new, mod, files, expr)
175
174
@info " Finish global rename refactoring" progress= 1 _id= id
176
175
177
176
return if ! isempty (refactoredfiles)
178
- ( :success , filedescription (mod, refactoredfiles) )
177
+ :success , filedescription (mod, refactoredfiles)
179
178
else
180
- ( :warning , " No rename refactoring occured on `$old ` in `$mod ` module." )
179
+ :warning , " No rename refactoring occured on `$old ` in `$mod ` module."
181
180
end
182
181
end
183
182
184
183
# descriptions
185
184
# ------------
186
185
187
- function moduledescription (old, parentmod)
188
- gotouri = urigoto (parentmod, old)
189
- """
190
- **NOTE**: `$old ` is defined in `$parentmod ` -- you may need the same rename refactorings
191
- in that module as well. <button>[Go to `$parentmod .$old `]($gotouri )</button>
192
- """
193
- end
194
-
195
186
function contextdescription (old, mod, context)
196
187
gotouri = urigoto (mod, old)
197
188
"""
@@ -203,6 +194,14 @@ function contextdescription(old, mod, context)
203
194
"""
204
195
end
205
196
197
+ function moduledescription (old, parentmod)
198
+ gotouri = urigoto (parentmod, old)
199
+ """
200
+ **NOTE**: `$old ` is defined in `$parentmod ` -- you may need the same rename refactorings
201
+ in that module as well. <button>[Go to `$parentmod .$old `]($gotouri )</button>
202
+ """
203
+ end
204
+
206
205
function nonwritabledescription (mod, files)
207
206
filelist = join ((" <li>[$file ]($(uriopen (file)) )</li>" for file in files), ' \n ' )
208
207
"""
0 commit comments