vscode julia path changed, code to avoid Main.Notebook module context changed

This commit is contained in:
2026-03-05 20:50:28 +01:00
parent 733fe8c290
commit 0e6b3d92fa
10 changed files with 90 additions and 31 deletions

View File

@@ -10,6 +10,8 @@ engine: julia
#| output: false
using InteractiveUtils
#struct M a::Int end; x = M(22); @show x
#should not print "Main.Notebook.M(22)" but only "M(22)"
function Base.show(io::IO, x::T) where T
if parentmodule(T) == @__MODULE__
# Print "TypeName(fields...)" without module prefix
@@ -24,14 +26,6 @@ function Base.show(io::IO, x::T) where T
invoke(Base.show, Tuple{IO, Any}, io, x)
end
end
##import QuartoNotebookWorker
##Base.stdout = QuartoNotebookWorker.with_context(stdout)
##myactive_module() = Main.Notebook
##Base.active_module() = myactive_module()
# https://github.com/JuliaLang/julia/blob/master/base/show.jl#L516-L520
# https://github.com/JuliaLang/julia/blob/master/base/show.jl#L3073-L3077
```