From 7f9257b751b3648c6b09babd7e089216ed06088d Mon Sep 17 00:00:00 2001 From: Michael Hatherly Date: Fri, 18 Oct 2024 09:03:10 +0100 Subject: [PATCH] Revert "Pin `JuliaFormatter` to `v2` and fix new formatting failures (#199)" This reverts commit 328915b11baab30564f2afcc94a15239e427f8e0. --- .ci/Project.toml | 3 --- src/QuartoNotebookWorker/src/render.jl | 8 ++++---- src/precompile.jl | 2 +- src/server.jl | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.ci/Project.toml b/.ci/Project.toml index 18a15b4..f3aab8b 100644 --- a/.ci/Project.toml +++ b/.ci/Project.toml @@ -1,5 +1,2 @@ [deps] JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" - -[compat] -JuliaFormatter = "2" diff --git a/src/QuartoNotebookWorker/src/render.jl b/src/QuartoNotebookWorker/src/render.jl index d217312..0081614 100644 --- a/src/QuartoNotebookWorker/src/render.jl +++ b/src/QuartoNotebookWorker/src/render.jl @@ -57,7 +57,7 @@ function _render_thunk( return ((; code = "", # an expanded cell that errored can't have returned code cell_options = Dict{String,Any}(), # or options - results = Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}(), + results = Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}(), display_results, output = captured.output, error = string(typeof(error)), @@ -294,7 +294,7 @@ function clean_bt_str(is_error::Bool, bt, err, prefix = "", mimetype = false) if mimetype non_worker = findfirst(x -> contains(String(x.file), @__FILE__), bt) - bt = bt[1:max(something(non_worker, length(bt))-3, 0)] + bt = bt[1:max(something(non_worker, length(bt)) - 3, 0)] end buf = IOBuffer() @@ -329,7 +329,7 @@ function render_mimetypes(value, cell_options; inline::Bool = false) options = NotebookState.OPTIONS[] to_format = rget(options, ("format", "pandoc", "to"), nothing) - result = Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}() + result = Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}() # Some output formats that we want to write to need different # handling of valid MIME types. Currently `docx` and `typst`. When # we detect that the `to` format is one of these then we select a @@ -417,7 +417,7 @@ function render_mimetypes(value, cell_options; inline::Bool = false) return result end render_mimetypes(value::Nothing, cell_options; inline::Bool = false) = - Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}() + Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}() # Our custom MIME types need special handling. They get rendered to diff --git a/src/precompile.jl b/src/precompile.jl index 01cd4d1..4178f37 100644 --- a/src/precompile.jl +++ b/src/precompile.jl @@ -1,7 +1,7 @@ PrecompileTools.@setup_workload begin notebook = joinpath(@__DIR__, "..", "test", "examples", "cell_types.qmd") script = joinpath(@__DIR__, "..", "test", "examples", "cell_types.jl") - results = Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}() + results = Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}() PrecompileTools.@compile_workload begin raw_text_chunks(notebook) raw_text_chunks(script) diff --git a/src/server.jl b/src/server.jl index 20e53fd..f1abab6 100644 --- a/src/server.jl +++ b/src/server.jl @@ -1017,7 +1017,7 @@ values. We do here rather than in the worker because we don't want to have to define additional functions in the worker and import `Base64` there. The worker just has to provide bytes. """ -function process_results(dict::Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}) +function process_results(dict::Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}) funcs = Dict( "application/json" => json_reader, "application/pdf" => Base64.base64encode,