Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PrecompileTools workloads #24

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ authors = ["Michael Hatherly <[email protected]>"]
version = "0.1.6"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
FoldingTrees = "1eca21be-9b9b-4ed8-839a-6d8ae26b1781"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"

Expand All @@ -27,10 +27,10 @@ InteractiveErrorsJuliaFormatterExt = "JuliaFormatter"
InteractiveErrorsOhMyREPLExt = "OhMyREPL"

[compat]
AbstractTrees = "0.3, 0.4"
FoldingTrees = "1.1"
IterTools = "1"
PackageExtensionCompat = "1"
PrecompileTools = "1"
julia = "1.6"

[extras]
Expand Down
7 changes: 7 additions & 0 deletions ext/InteractiveErrorsJuliaFormatterExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module InteractiveErrorsJuliaFormatterExt

import JuliaFormatter
import InteractiveErrors
import PrecompileTools

InteractiveErrors.has_juliaformatter() = true

Expand All @@ -14,4 +15,10 @@ function InteractiveErrors.format_julia_source(source::String)
end
end

PrecompileTools.@compile_workload begin
InteractiveErrors.format_julia_source(
read(joinpath(@__DIR__, "..", "src", "InteractiveErrors.jl"), String),
)
end

end
7 changes: 7 additions & 0 deletions ext/InteractiveErrorsOhMyREPLExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module InteractiveErrorsOhMyREPLExt

import OhMyREPL
import InteractiveErrors
import PrecompileTools

InteractiveErrors.has_ohmyrepl() = true

Expand All @@ -19,4 +20,10 @@ function InteractiveErrors.highlight(source::String)
return String(take!(io))
end

PrecompileTools.@compile_workload begin
InteractiveErrors.highlight(
read(joinpath(@__DIR__, "..", "src", "InteractiveErrors.jl"), String),
)
end

end
10 changes: 9 additions & 1 deletion src/InteractiveErrors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using FoldingTrees

using REPL, REPL.TerminalMenus, InteractiveUtils, IterTools

import PackageExtensionCompat
import PackageExtensionCompat, PrecompileTools

export toggle, current_theme, set_theme!, reset_theme!, adjust_theme!

Expand Down Expand Up @@ -391,4 +391,12 @@ function __init__()
PackageExtensionCompat.@require_extensions
end

PrecompileTools.@compile_workload begin
try
div(1, 0)
catch error
explore(IOBuffer(), CapturedError(error, catch_backtrace()); interactive = false)
end
end

end # module