Skip to content

Commit

Permalink
strip preceding ! operator
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Nov 18, 2020
1 parent 1f854cd commit a0942e5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/eval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ handle("docs") do data
end

function docs(word, mod = "Main")
word = replace(word, r"\!+([^=\(]+)" => s"\1") # strip preceding ! operator
docstring = @errs getdocs(mod, word)
docstring isa EvalError && return Dict(:error => true)

Expand Down
1 change: 1 addition & 0 deletions src/goto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function gotosymbol(
# module context
mod = "Main", text = ""
)
word = replace(word, r"\!+([^=\(]+)" => s"\1") # strip preceding ! operator
try
# local goto
if !onlyglobal
Expand Down
15 changes: 15 additions & 0 deletions test/goto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@
@test (Atom.localgotoitem("word", nothing, 1, 1, 0, ""); true)
end

@testset "strip preceding ! operator" begin
using Atom: gotosymbol
let
ret = gotosymbol("!isnothing")
@test isdefined(ret, :items)
@test !isempty(ret.items)
end

let
ret = gotosymbol("!")
@test isdefined(ret, :items)
@test !isempty(ret.items)
end
end

@testset "goto global symbols" begin
using Atom: globalgotoitems, toplevelgotoitems, SYMBOLSCACHE, updatesymbols,
clearsymbols, regeneratesymbols, methodgotoitems
Expand Down

0 comments on commit a0942e5

Please sign in to comment.