Add support for JSON, XML, Markdown, and YAML visualizations#80
Merged
Conversation
- JSON 运行: python3 -m json.tool(美化输出,非法 JSON 报错) - XML 运行: xmllint --format(格式化,非法 XML 报错),xmllint 为 macOS 自带
- JSON 插件 console_type 改为 json,运行输出原文交前端渲染 - 新增 JsonView/JsonNode:可折叠 JSON 树(键值着色、顶部两层默认展开、折叠摘要、复制格式化、解析失败回退原文+错误) - App 输出区按 consoleType==='json' 渲染;撤销 XML 的 xmllint 改回 cat
consoleTypes 增加 {label: 'JSON', value: 'json'},可在语言设置里把输出类型选为 JSON 视图
- Markdown 插件 console_type 改为 markdown,输出原文交前端渲染 - 新增 MarkdownView:markdown-it 渲染预览(标题/列表/代码/表格/引用等样式) - 配置页输出类型增加 Markdown 选项;App 按 consoleType==='markdown' 渲染
MarkdownView 与 PreviewPanel 的 markdown-it 开启 html:true,渲染结果经 DOMPurify 净化后再 v-html,既能渲染 md 中的 HTML 又防止脚本注入
根因:迁移到 KvStore 后所有配置/状态都写入同一个 codeforge.sqlite,运行时 kv 写入与 history.insert 在同库并发;而执行历史连接未开 WAL、synchronous=FULL 且无 busy_timeout,单次 insert 在 fsync/竞争下可阻塞数秒(执行耗时只统计到命令本身故仍显示百毫秒)。 - 四个连接(execution/ai/kv/snippets)统一 WAL + synchronous=NORMAL + busy_timeout(5s) - 执行轮询 sleep 100ms→20ms,快命令响应更快
consoleType 之前只在启动时设置,打开文件/切换标签/下拉切语言都不更新,导致打开 .md/.json 运行后仍按旧输出类型渲染(如控制台),定制视图不生效。改为 watch(currentLanguage) 同步
cat 输出按行流式刷新 output,MarkdownView/JsonView 的渲染是 computed,每行都全量重渲染(markdown-it+DOMPurify / 整树解析),几百行就 O(N²) 卡死主线程。改为对 output 防抖 200ms 后再渲染,流式期间不逐行重渲染
- XML 插件 console_type 改为 xml,输出原文交前端渲染 - 新增 XmlView/XmlNode:DOMParser 解析,可折叠元素树(标签蓝/属性紫/值绿/文本),顶 3 层默认展开,解析失败回退原文+错误,渲染防抖 - 配置页输出类型增加 XML 选项;App 按 consoleType==='xml' 渲染
- YAML 插件 console_type 改为 yaml,输出原文交前端渲染 - 新增 YamlView:js-yaml 解析为对象后复用 JsonNode 渲染可折叠树,解析失败回退原文+错误,渲染防抖 - 配置页输出类型增加 YAML 选项;App 按 consoleType==='yaml' 渲染
默认格式化文本,点头部「可视化」图标切换为可折叠树;复制与清空改为图标(Copy/Trash2),与控制台一致
模式1=层级树(默认),模式2=关系图(DataGraph):每个对象/数组渲染成卡片,标量为键值行,嵌套对象作为独立卡片用贝塞尔连线连接,行内 chevron 展开/收起子节点;确定性布局(深度分列、父节点居中)。头部 Network 图标切换两种模式
复用 DataGraph:YAML 解析为对象后渲染关系图;头部 Network 图标切换 层级树/关系图,清空改为图标
XML DOM 转为普通对象(属性 @ 前缀、同名子标签聚合为数组)后复用 DataGraph 渲染关系图,根节点标题为根标签名;头部 Network 图标切换 层级树/关系图,清空改为图标。DataGraph 增加 rootTitle 属性
YAML 检测到 on+jobs 时识别为 GHA 工作流,新增'工作流图'模式(检测到时默认):触发(on)为起始节点,各 job 按 needs 依赖拓扑分列连线,job 卡片列出 runs-on 与 steps。头部 Workflow 图标切换
- 定位更新为「多语言代码编辑器与运行器」,不再只是执行器 - 按编辑/运行/可视化/AI/Git/搜索终端分类列出完整功能与快捷键 - 支持语言图标网格补全(含 scala/applescript/json/xml/yaml/markdown/text)并附文字清单 - 加徽章、技术栈表、环境要求(Node 22+)、贡献入口
底部状态栏右侧新增终端图标按钮,点击切换终端面板,并显示当前绑定的快捷键(默认 ⌘`/Ctrl+`),跟随用户自定义
- 按插件架构新增 src-tauri/src/plugins/sql.rs(.sql),默认在内存 SQLite 中执行(sqlite3 :memory: .read),在 mod.rs/manager.rs 注册 - 前端 getLanguageExtension 增加 SQL 高亮(@codemirror/lang-sql) - 新增 sql.svg 数据库图标
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.