diff --git a/docs/content/release/26.1.0.md b/docs/content/release/26.1.0.md new file mode 100644 index 0000000..221a141 --- /dev/null +++ b/docs/content/release/26.1.0.md @@ -0,0 +1,143 @@ +--- +title: 26.1.0 +--- + +CodeForge v26.1.0 是一次以**数据**为核心的大版本:在文件/项目编辑器的基础上,新增了完整的 **SQL / 数据库**工作台、**27 种图表**的拖拽式可视化、**CSV / TSV / Excel** 数据源,以及基于语言服务器的 **LSP 语义能力**(精准补全、悬浮文档、跳转定义、查找引用、重命名、实时诊断)。同时带来 **Git 源代码管理**、**集成终端**、**命令面板**、**全局搜索/替换**、**深色模式**等一系列编辑器与工程能力。 + +CodeForge v26.1.0 is a **data-centric** major release. On top of the file/project editor, it adds a full **SQL / database** workbench, drag-and-drop visualization with **27 chart types**, **CSV / TSV / Excel** data sources, and **LSP** semantic features powered by language servers (precise completion, hover docs, go-to-definition, find references, rename, live diagnostics). It also ships **Git source control**, an **integrated terminal**, a **command palette**, **global search/replace**, **dark mode**, and many more editor & engineering capabilities. + +--- + +## 📦 版本信息 | Release Information + +- **项目地址 | Repository**:https://github.com/devlive-community/codeforge +- **官方网站 | Official Website**:https://codeforge.devlive.org/ +- **版本号 | Version**:v26.1.0 +- **发布日期 | Release Date**:2026年6月10日 | June 10, 2026 + +--- + +## 📊 数据可视化与图表 | Data Visualization & Charts + +SQL 结果、CSV/TSV、Excel 都可一键切换为图表,**拖拽 / 单击 / 双击**把字段加入维度与指标即可成图。 +SQL results, CSV/TSV and Excel can switch to charts in one click — add fields to dimensions/metrics by **drag, click, or double-click**. + +- **27 种图表**(基于 ECharts):柱状图 · 折线图 · 面积图 · 饼图/环形图 · 玫瑰图 · 散点图 · 涟漪散点图 · 雷达图 · 漏斗图 · 热力图 · 仪表盘 · 桑基图 · 关系图 · 旭日图 · 矩形树图 · 树图 · 箱线图 · K 线图 · 平行坐标 · 主题河流 · 日历热力图 · 极坐标柱状图 · 象形柱图 · 词云 · 水球图 · 中国地图 · 世界地图 +- **表驱动配置面板** - 多维度透视、聚合(求和/计数/平均/最大/最小)、排序、Top N、数值标签、堆叠/横向/平滑等 +- **AI 自然语言配图** - 用一句话描述需求,自动选择图表类型并填好维度/指标 +- **命名预设与配置持久化** - 把图表配置存为预设一键套用,重开自动恢复 +- **导出** - 图表导出 PNG / SVG、复制图片到剪贴板、导出底层数据为 CSV,配色跟随主题 +- 配置侧栏可滚动、字段映射说明、图表区自适应高度 + +**27 chart types** (ECharts-based) covering bars/lines/area, pie/doughnut/rose, scatter & ripple scatter, radar, funnel, heatmap, gauge, sankey, graph, sunburst, treemap, tree, boxplot, candlestick, parallel, theme river, calendar heatmap, polar bar, pictorial bar, word cloud, liquid fill, and China / World maps. +**Table-driven config** — multi-dimension pivot, aggregation, sort, Top N, labels, stack/horizontal/smooth. +**AI natural-language charting** — describe what you want and the chart type & fields are filled automatically. +**Named presets & persistence** — save configs as presets and restore on reopen. +**Export** — PNG / SVG, copy image to clipboard, export underlying data as CSV; colors follow the theme. + +--- + +## 🗄 SQL 与数据库 | SQL & Database + +新增 SQL 语言,可连接内存库、SQLite 文件与 **MySQL**,运行结果以表格 / 图表呈现。 +A new SQL language connects to in-memory, SQLite files and **MySQL**, with results shown as tables/charts. + +- **插件式执行器** - 按数据库类型拆分,便于扩展;基于 rusqlite,无需外部 sqlite3 +- **数据源管理** - 在设置中配置连接,运行前在编辑器顶部选择数据源,连接信息持久化 +- **结果表格** - 虚拟滚动、列宽拖拽、点击列排序、导出 CSV;失败显示具体错误;执行历史与运行时一致 +- **数据库结构浏览器** - 库 → 表 → 字段树,搜索过滤,点字段插入光标,一键预览前 100 行、复制建表 DDL、整表导出 CSV +- **AI 自然语言生成 SQL** - 以当前库表结构为上下文,把需求转成可执行 SQL 并写入编辑器 + +**Plugin-style executors** per database type, on rusqlite (no external sqlite3 needed). +**Data sources** — configure connections in settings, pick the source above the editor, persisted across restarts. +**Result grid** — virtual scrolling, resizable columns, click-to-sort, CSV export; failures show the exact error; history matches the live view. +**Schema browser** — database → table → column tree with search, insert-on-click, preview top 100 rows, copy CREATE TABLE DDL, and export a whole table to CSV. +**AI natural-language SQL** — turn requests into executable SQL using the current schema as context. + +--- + +## 📥 数据源:CSV / TSV / Excel | Data Sources + +直接打开并解析常见数据文件,统一进入数据表 + 图表视图。 +Open and parse common data files into a unified table + chart view. + +- **CSV / TSV** - 引号转义、字段内换行、自动识别分隔符;解析在 **Web Worker** 后台进行并显示进度,超大文件不阻塞 UI +- **Excel(.xlsx / .xls)** - 基于 SheetJS 解析,支持**多工作表**切换;打开二进制 Excel 直接进入数据视图 +- **虚拟滚动数据表** - 仅渲染可视区,几十万行也流畅;列宽可拖拽、可点击列排序 +- 与 SQL 共用同一套图表面板与导出能力 + +**CSV / TSV** parsed in a **Web Worker** with progress (quote-escaping, embedded newlines, delimiter auto-detect). +**Excel (.xlsx / .xls)** via SheetJS with **multi-sheet** switching. +**Virtual-scroll table** renders only the visible rows, smooth for hundreds of thousands of rows, with resizable & sortable columns. + +--- + +## 🌳 结构化数据可视化 | Structured Data Views + +- **JSON / XML / YAML** - 可折叠**层级树**,以及卡片 + 连线的**关系图**两种可视化 +- **Markdown** - 实时渲染预览,支持内嵌 HTML(DOMPurify 净化防 XSS) +- **GitHub Actions 工作流** - 自动识别并渲染为 Jobs 依赖 DAG 图 +- 新增 JSON / XML / YAML / Markdown / 纯文本 / CSV / TSV / Excel 等编辑与可视化类型 + +**JSON / XML / YAML** as a collapsible **tree** and a card-and-edge **relationship graph**. +**Markdown** live preview with sanitized embedded HTML. +**GitHub Actions** workflows rendered as a Jobs dependency DAG. + +--- + +## 🧠 LSP 语义能力 | Language Server (LSP) + +接入语言服务器,提供 IDE 级语义能力;未安装对应服务器时自动回退,不影响编辑。 +Connect to language servers for IDE-grade semantics; gracefully falls back when a server isn't installed. + +- **精准补全、悬浮文档、跳转定义、查找引用、重命名、实时诊断** +- **自绘悬浮提示** - 精确定位到鼠标所指符号,主题适配,诊断按严重级显示 +- **设置「语言服务」面板** - 检测各语言服务器是否已安装,未装可**一键安装**并查看实时日志 +- **状态栏指示** - 显示「索引中 / 就绪」,支持草稿(未保存)文件 +- 内置 Python / TS·JS / Rust / Go / C·C++ / Lua / PHP / Ruby / HTML·CSS·JSON 等服务器映射 + +**Precise completion, hover docs, go-to-definition, find references, rename, live diagnostics.** +**Custom hover** anchored exactly at the symbol, theme-aware, with severity-colored diagnostics. +**"Language Servers" settings panel** — detect installation status and **install with one click** with live logs. +**Status-bar indicator** — shows indexing/ready, works for unsaved drafts too. + +--- + +## 🔀 源代码管理与编辑增强 | Source Control & Editing + +- **Git 源代码管理** - 状态 / 暂存 / 提交 / 推送 / 分支,文件树徽标,AI 生成提交信息 +- **行内 Git 差异标记** - 相对 HEAD 显示增改删 +- **差异对比与实时预览** +- **命令面板(Cmd/Ctrl+Shift+P)** - 一处直达所有命令 +- **全局搜索 / 替换(Cmd/Ctrl+Shift+F)** - 文件夹内搜索并跳转、全部替换(应用内确认) +- **符号大纲(Cmd/Ctrl+Shift+O)**、**跳转到行(Cmd/Ctrl+G)**、**面包屑路径导航** +- **运行配置按文件记忆** - 参数 / stdin / 环境变量 +- **代码片段** - 自定义前缀,Tab 展开 + +**Git source control** — status/stage/commit/push/branch, tree badges, AI-generated commit messages. +**Inline Git diff markers** vs HEAD; **diff view** with live preview. +**Command palette**, **global search/replace**, **symbol outline**, **go-to-line**, **breadcrumbs**. +**Per-file run config** (args / stdin / env) and **code snippets**. + +--- + +## 🎨 终端、外观与其它 | Terminal, Appearance & More + +- **集成终端** - 底部停靠、多标签、拖拽高度,收起保留会话 +- **深色模式** - 跟随系统 / 浅色 / 深色,编辑器与所有浮层、表单控件全面适配 +- **控制台 ANSI 颜色**、执行历史一键重跑、运行时自定义环境变量 +- **全部配置改用 SQLite 键值存储**,移除 localStorage +- 大量布局、滚动、下拉、显示不全等 UI 细节修复 + +**Integrated terminal** — bottom-docked, multi-tab, resizable, session-preserving. +**Dark mode** across the editor, popovers and form controls. +**ANSI colors** in console output, one-click re-run, custom env vars at run time. +All settings moved to **SQLite key-value storage** (no more localStorage), plus many UI fixes. + +--- + +## 📥 立即下载 | Download Now + +在 [GitHub Releases](https://github.com/devlive-community/codeforge/releases) 下载最新版本,或访问[官方网站](https://codeforge.devlive.org/)了解更多信息。 + +Download the latest version from [GitHub Releases](https://github.com/devlive-community/codeforge/releases), or visit the [Official Website](https://codeforge.devlive.org/) for more information. diff --git a/docs/pageforge.yaml b/docs/pageforge.yaml index 41de199..87e307f 100644 --- a/docs/pageforge.yaml +++ b/docs/pageforge.yaml @@ -14,7 +14,7 @@ repo: branch: dev banner: - content: 💗 CodeForge 26.0.0 已经发布, 如果喜欢我们的软件,请点击这里支持我们 ❤️ + content: 💗 CodeForge 26.1.0 已经发布, 如果喜欢我们的软件,请点击这里支持我们 ❤️ feature: lucide: @@ -43,6 +43,7 @@ footer: nav: - 发布日志: + - /release/26.1.0.md - /release/26.0.0.md - /release/25.0.5.md - /release/25.0.4.md diff --git a/package.json b/package.json index 75f39a3..97d9af9 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@babel/runtime": "^7.28.2", + "@codemirror/autocomplete": "6.20.3", "@codemirror/lang-cpp": "^6.0.3", "@codemirror/lang-css": "^6.3.1", "@codemirror/lang-go": "^6.0.1", @@ -70,5 +71,10 @@ "typescript": "~5.6.2", "vite": "^6.0.3", "vue-tsc": "^2.1.10" + }, + "pnpm": { + "overrides": { + "@codemirror/autocomplete": "6.20.3" + } } } diff --git a/src/editor/lspCompletion.ts b/src/editor/lspCompletion.ts new file mode 100644 index 0000000..185efb5 --- /dev/null +++ b/src/editor/lspCompletion.ts @@ -0,0 +1,44 @@ +// 显式接入 LSP 自动补全:补全源 + 输入即触发 + 键位(Ctrl+Space 触发、Enter/Tab 接受) +import {autocompletion, completionKeymap, type CompletionContext, type CompletionResult} from '@codemirror/autocomplete' +import {keymap} from '@codemirror/view' +import {Prec} from '@codemirror/state' +import {languageServerPlugin} from 'codemirror-languageserver' + +const offsetToPos = (doc: any, offset: number) => { + const line = doc.lineAt(offset) + return {line: line.number - 1, character: offset - line.from} +} + +// 向 LSP 请求补全(复用库内 plugin 的 requestCompletion) +const lspSource = async (ctx: CompletionContext): Promise => { + const {state, pos, explicit, view} = ctx + const plugin: any = view?.plugin(languageServerPlugin as any) + if (!plugin?.requestCompletion) { + return null + } + const line = state.doc.lineAt(pos) + const before = line.text[pos - line.from - 1] + const triggers: string[] | undefined = plugin.client?.capabilities?.completionProvider?.triggerCharacters + let triggerKind = 1 // Invoked + let triggerCharacter: string | undefined + if (!explicit && triggers && before && triggers.includes(before)) { + triggerKind = 2 // TriggerCharacter + triggerCharacter = before + } + // 非显式触发且不在单词中:不打扰 + if (!explicit && triggerKind === 1 && !ctx.matchBefore(/[\w.]$/)) { + return null + } + try { + return await plugin.requestCompletion(ctx, offsetToPos(state.doc, pos), {triggerKind, triggerCharacter}) + } + catch { + return null + } +} + +// 高优先级,确保 LSP 补全源生效;并补上补全键位 +export const lspCompletion = [ + Prec.highest(autocompletion({override: [lspSource], activateOnTyping: true, defaultKeymap: false})), + Prec.high(keymap.of(completionKeymap)) +] diff --git a/src/editor/lspExtension.ts b/src/editor/lspExtension.ts index 1050e73..4d92efa 100644 --- a/src/editor/lspExtension.ts +++ b/src/editor/lspExtension.ts @@ -4,6 +4,10 @@ import {LanguageServerClient, languageServerWithTransport} from 'codemirror-lang import {TauriLspTransport} from './lspTransport' import {setLspState} from './lspStatus' import {lspCustomHover} from './lspHover' +import {lspCompletion} from './lspCompletion' + +// 代次:每次构建 LSP 扩展自增,过期 client 的回调据此忽略 +let stateGen = 0 // CodeForge 语言 key → LSP languageId(与后端 server_cmd 对应) const LANGUAGE_ID: Record = { @@ -71,6 +75,8 @@ export async function createLspExtensions( setLspState(language, 'off') return null } + // 代次令牌:扩展重建时旧 client 的 onClose/onError 不应覆盖最新状态 + const myGen = ++stateGen setLspState(language, 'connecting') try { const transport = new TauriLspTransport(language) @@ -88,9 +94,21 @@ export async function createLspExtensions( documentUri, languageId, autoClose: true, - onCapabilities: () => setLspState(language, 'on'), - onError: () => setLspState(language, 'off'), - onClose: () => setLspState(language, 'off') + onCapabilities: () => { + if (myGen === stateGen) { + setLspState(language, 'on') + } + }, + onError: () => { + if (myGen === stateGen) { + setLspState(language, 'off') + } + }, + onClose: () => { + if (myGen === stateGen) { + setLspState(language, 'off') + } + } }) const base = languageServerWithTransport({ client, @@ -102,8 +120,8 @@ export async function createLspExtensions( allowHTMLContent: true, autoClose: true }) - // 用自绘悬浮替代库的 hover/诊断 tooltip(定位精确到鼠标 + 主题适配) - return [base, lspCustomHover] + // 自绘悬浮 + 显式 LSP 补全(本编辑器未启用 basicSetup, 需自带补全键位与源) + return [base, lspCustomHover, lspCompletion] } catch { return null