Skip to content

[0805] 重构 Julia 代码结构 & 补充测试#3786

Merged
da-liii merged 9 commits into
mainfrom
ty/0805
Jun 23, 2026
Merged

[0805] 重构 Julia 代码结构 & 补充测试#3786
da-liii merged 9 commits into
mainfrom
ty/0805

Conversation

@AXeonV

@AXeonV AXeonV commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

[0805] 重构 Julia 代码结构 & 补充测试

1 相关文档

  • 0801.md - 集成 Julia 交互式会话
  • 0804.md - Julia 会话支持符号计算

2 任务相关的代码文件

  • TeXmacs/plugins/julia/julia/julia.jl - 插件入口,主交互循环 (由原 MoganJulia.jl 重命名并重构)
  • TeXmacs/plugins/julia/julia/tmjl/protocol.jl - 核心通信协议实现
  • TeXmacs/plugins/julia/julia/tmjl/capture.jl - 标准输入输出流拦截重定向
  • TeXmacs/plugins/julia/julia/tmjl/display.jl - 多媒体显示与符号对象自动 LaTeX 格式化
  • TeXmacs/plugins/julia/julia/tmjl/completion.jl - Tab 自动补全驱动
  • TeXmacs/plugins/julia/progs/init-julia.scm - 更新 Julia 启动入口脚本为 julia.jl
  • TeXmacs/plugins/julia/tests/runtests.jl - 80个 Julia 插件后端单元测试
  • TeXmacs/tests/0801.scm - 13个 Julia 插件通用端到端集成测试
  • TeXmacs/tests/0804.scm - 13个 Julia 插件符号计算端到端集成测试

3 如何测试

3.1 确定性测试(集成/单元测试)

集成测试:

xmake r 0801
xmake r 0804
xmake b stem

单元测试(确保环境中安装了 Julia):

julia TeXmacs/plugins/julia/tests/runtests.jl

3.2 非确定性测试(文档验证)

4 What

重构 Julia 后端插件支持的代码结构,并补充集成/单元测试。

Copilot AI review requested due to automatic review settings June 22, 2026 05:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Julia TeXmacs plugin by splitting the former monolithic entry file into smaller focused modules, renaming the plugin entrypoint to julia.jl, and adding end-to-end Scheme tests to validate session execution and symbolic/LaTeX output.

Changes:

  • Replace MoganJulia.jl with a new modular entrypoint julia.jl and new tmjl/* implementation files (protocol, stream capture, display, completion).
  • Update the Scheme launcher (init-julia.scm) to start julia.jl.
  • Add new integration tests TeXmacs/tests/0801.scm and TeXmacs/tests/0804.scm.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
TeXmacs/tests/0801.scm Adds Julia plugin integration tests (serialization + session execution).
TeXmacs/tests/0804.scm Adds Symbolics/Latexify integration tests for LaTeX formatting output.
TeXmacs/plugins/julia/progs/init-julia.scm Updates plugin entrypoint path from MoganJulia.jl to julia.jl.
TeXmacs/plugins/julia/julia/tmjl/protocol.jl Introduces protocol constants and TeXmacs/Mogan framing helpers.
TeXmacs/plugins/julia/julia/tmjl/capture.jl Implements stdout/stderr redirection and flushing to TeXmacs.
TeXmacs/plugins/julia/julia/tmjl/display.jl Implements rich display routing (HTML/LaTeX/images) and symbolic-object formatting.
TeXmacs/plugins/julia/julia/tmjl/completion.jl Implements tab-completion command parsing and Scheme tuple output.
TeXmacs/plugins/julia/julia/MoganJulia.jl Removes the previous monolithic Julia plugin implementation.
TeXmacs/plugins/julia/julia/julia.jl New plugin entrypoint wiring submodules + main REPL loop.
devel/0805.md Developer documentation for this refactor and the added tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +53 to +60
display(d::InlineDisplay, m::MIME"image/png", x) =
sendimage("png", m, x)

display(d::InlineDisplay, m::MIME"image/jpeg", x) =
sendimage("jpg", m, x)

display(d::InlineDisplay, m::MIME"application/pdf", x) =
sendimage("pdf", m, x)
Comment on lines +97 to +104
const tm_mimetypes = [
MIME("image/svg"),
MIME("application/pdf"),
MIME("image/png"),
MIME("image/jpg"),
MIME("text/latex"),
MIME("text/html"),
MIME("text/markdown")]
Comment on lines +22 to +23
compls = join(unique!(map(x -> "\"$(completion_text(x)[range.stop+2-range.start:end])\"",ret))," ")
tm_out("scheme:", "(tuple \"$(arg1[range])\" $(compls))")
Comment thread TeXmacs/tests/0801.scm
Comment on lines +111 to +112
(let* ((julia-bin (if (os-windows?) "julia" "env -u LD_LIBRARY_PATH julia"))
(cmd (string-append julia-bin " --startup-file=no " julia-script " < " input-path " > " output-path " 2>&1")))
Comment thread TeXmacs/tests/0804.scm
Comment on lines +133 to +134
(let* ((julia-bin (if (os-windows?) "julia" "env -u LD_LIBRARY_PATH julia"))
(cmd (string-append julia-bin " --startup-file=no " julia-script " < " input-path " > " output-path " 2>&1")))
Comment thread TeXmacs/plugins/julia/julia/julia.jl Outdated
Comment thread TeXmacs/plugins/julia/julia/tmjl/protocol.jl Outdated
@AXeonV AXeonV changed the title [0805] 重构 Julia 代码结构 & 补充单元测试 [0805] 重构 Julia 代码结构 & 补充测试 Jun 22, 2026

@MoonL79 MoonL79 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@da-liii da-liii merged commit 3a77aa1 into main Jun 23, 2026
3 checks passed
@da-liii da-liii deleted the ty/0805 branch June 23, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants