Skip to content

Commit 6f84942

Browse files
committed
add goto uri 🎉
1 parent d746383 commit 6f84942

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/refactor.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ function renamerefactor(
6565

6666
# catch global refactoring not on definition, e.g.: on a call site
6767
if bind === nothing || old bind.name
68-
# TODO: `goto` uri
6968
return Dict(:info => contextdescription(old, mod, context))
7069
end
7170

@@ -78,7 +77,7 @@ function renamerefactor(
7877
moddesc = moduledescription(old, parentmod)
7978
end
8079

81-
desc = join(("_Global_ rename refactoring `$old` ⟹ `$new` succeeded.", moddesc, desc), "\n\n")
80+
desc = join(("_Global_ rename refactoring `$mod.$old` ⟹ `$mod.$new` succeeded.", moddesc, desc), "\n\n")
8281
end
8382

8483
return Dict(kind => desc)
@@ -161,17 +160,24 @@ end
161160
# descriptions
162161
# ------------
163162

164-
moduledescription(old, parentmod) = """
165-
**NOTE**: `$old` is defined in `$parentmod`
166-
-- you may need the same rename refactorings in that module as well.
163+
function moduledescription(old, parentmod)
164+
gotouri = urigoto(parentmod, old)
167165
"""
166+
**NOTE**: `$old` was defined in `$parentmod` -- you may need the same rename refactorings
167+
in that module as well. <button>[Go to `$parentmod.$old`]($gotouri)</button>
168+
"""
169+
end
168170

169-
contextdescription(old, mod, context) = """
171+
function contextdescription(old, mod, context)
172+
gotouri = urigoto(mod, old)
173+
"""
170174
`$old` isn't found in local bindings in the current context:
171175
<details><summary>Context</summary><pre><code>$(strip(context))</code></p></details>
172176
173-
If you want a global rename refactoring on `$mod.$old`, you need to call from its definition.
177+
If you want a global rename refactoring on `$mod.$old`, you need to run this command
178+
from its definition. <button>[Go to `$mod.$old`]($gotouri)</button>
174179
"""
180+
end
175181

176182
function filedescription(mod, files)
177183
filelist = join(("<li>[$file]($(uriopen(file)))</li>" for file in files), '\n')

src/utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ cangetdocs(mod::AbstractString, word::Union{Symbol, AbstractString}) = cangetdoc
214214

215215
uriopen(file, line = 0) = "atom://julia-client/?open=true&file=$(file)&line=$(line)"
216216
uridocs(mod, word) = "atom://julia-client/?docs=true&mod=$(mod)&word=$(word)"
217+
urigoto(mod, word) = "atom://julia-client/?goto=true&mod=$(mod)&word=$(word)"
217218
urimoduleinfo(mod) = "atom://julia-client/?moduleinfo=true&mod=$(mod)"
218219

219220
#=

0 commit comments

Comments
 (0)