-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from MichaelHatherly/mh/pkgexts
Switch to using package extensions
- Loading branch information
Showing
7 changed files
with
99 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module InteractiveErrorsCthulhuExt | ||
|
||
import Cthulhu | ||
import InteractiveErrors | ||
|
||
InteractiveErrors.has_cthulhu() = true | ||
|
||
InteractiveErrors.ascend(mi::Core.MethodInstance) = Cthulhu.ascend(mi) | ||
|
||
InteractiveErrors.descend(mi::Core.MethodInstance) = Cthulhu.descend(mi) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module InteractiveErrorsDebuggerExt | ||
|
||
import Debugger | ||
import InteractiveErrors | ||
|
||
InteractiveErrors.has_debugger() = true | ||
|
||
InteractiveErrors.breakpoint(file::AbstractString, line::Integer) = Debugger.breakpoint(file, line) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module InteractiveErrorsJETExt | ||
|
||
import JET | ||
import InteractiveErrors | ||
|
||
InteractiveErrors.has_jet() = true | ||
|
||
function InteractiveErrors.report_call(mi::Core.MethodInstance) | ||
func = Base.tuple_type_head(mi.specTypes).instance | ||
sig = Base.tuple_type_tail(mi.specTypes) | ||
result = JET.report_call(func, sig) | ||
@info "Press return to continue." | ||
readline() | ||
return result | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module InteractiveErrorsJuliaFormatterExt | ||
|
||
import JuliaFormatter | ||
import InteractiveErrors | ||
|
||
InteractiveErrors.has_juliaformatter() = true | ||
|
||
function InteractiveErrors.format_julia_source(source::String) | ||
try | ||
return JuliaFormatter.format_text(source) | ||
catch err | ||
@debug "failed to format source" err source | ||
return source | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module InteractiveErrorsOhMyREPLExt | ||
|
||
import OhMyREPL | ||
import InteractiveErrors | ||
|
||
InteractiveErrors.has_ohmyrepl() = true | ||
|
||
function InteractiveErrors.highlight(source::String) | ||
O = OhMyREPL | ||
tokens = collect(O.tokenize(source)) | ||
crayons = fill(O.Crayon(), length(tokens)) | ||
O.Passes.SyntaxHighlighter.SYNTAX_HIGHLIGHTER_SETTINGS(crayons, tokens, 0, source) | ||
io = IOBuffer() | ||
for (token, crayon) in zip(tokens, crayons) | ||
print(io, crayon) | ||
print(io, O.untokenize(token, source)) | ||
print(io, O.Crayon(reset = true)) | ||
end | ||
return String(take!(io)) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters