Repository navigation
feat(editor): 按插件首行规则识别无后缀文件 - #2217
Merged
Merged
Conversation
1 task done
1 task done
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
无后缀脚本打开后需要由插件声明决定高亮、编辑规则和语言服务。
改动 / Changes
languages: 0,读取启用插件的 TextMate 语法或独立首行元数据,并交 Core 校验。独立资源保留内置高亮。现有文件名、扩展名和路径关联优先。不在本 PR 范围内 / Out of scope
Python 清单、真实 ZIP 测试和发行说明在插件仓库交付。
类型专属:feat
范围检查 / Scope checks
功能矩阵 / Feature matrix
插件归属 / Plugin ownership
UI 验证 / UI evidence
无新控件、布局或文案。已检查修复前后 16 张 Viva 无头截图,覆盖 Git Diff 可编辑侧和全局搜索只读预览,包含中英文与明暗主题。窗口 1280×800,产物 2560×1600。Linux CI 也采集相同场景。 截图与采集命令
统一日志系统 / Structured logging
界面文案 / i18n
逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A。无新设置项。
插件契约 / Plugin contract
rust/fixtures/plugins/first-line-match-v1.json,验证注册顺序、空匹配和无效候选。发行包与资源 / Bundle and resources
无用代码与重构 / Dead code and refactoring
验证 / Verification
编辑器基准
Apple M5,前后各运行
scripts/desktop/perf/editor-bench.sh run --count 6,默认大文件 10 MiB,并用compare对比。两侧均得到 125 项结果。机器不是 M4 参考机,43 项耗时预算未判定。BenchmarkEditorViewType/longline-wrap是唯一新超限项。100 KiB 中位数 36.51 → 36.26 µs,10 MiB 72.51 → 72.58 µs,比例 1.986× → 2.001×,分配分别稳定在 9 和 16。规模比越过阈值主要来自小样本变快。首行匹配只在打开时运行,该基准使用已经选好语法并打开的编辑器。perfhistory另报告 6 项分配波动,冷跳转 Go 100 KiB 631→635、10 MiB 756→757、Java 10 MiB 447→448、Markdown 100 KiB 601→617、10 MiB 647→668,以及 Markdown 100 KiB 整篇分词 16106→16422 allocs/op。上述基准直接传入已有语法并测量后台分词,无插件注册或首行匹配。绘制和滚动仍为 0 allocs/op。耗时与分配数据保留为测量结果。主线同步及验证状态
上述前后基准使用首行分支当时的
1200f901d和同一 Viva pin。最终分支同步 0.8.9 准备提交 release: prepare desktop 0.8.9 #2216。在原主线和原候选都复现搜索测试的空白可见行。同步 release: prepare desktop 0.8.9 #2216 的列表滚动修复后,该搜索测试与首行、语法回退、能力声明及安装审查专项均通过。
最终 0.8.9 基线上的本机 macOS ARM64 全量测试通过,共 65 个有测试的包,另通过受影响专项的竞态测试。Windows 原生安装和交互待实机。
在最终 Viva 基线上将长行换行输入两种规模各复测 6 次。100 KiB 从 37.5 至 40.7 µs,10 MiB 从 73.9 至 74.2 µs。分配不变,最终规模比为 1.82×,两项均在预算内。
Python #6 使用本 PR 的宿主提交复验最终真实 ZIP。同包的新宿主 E2E 5 项通过。0.8.9 的普通 .py 高亮用例也通过。
提交前确认 / Final checks
基于桌面 main,按 Draft 提交,等待维护者评审。
测试 fixture 由已固定的 Core 提供,测试产物和个人路径未进入提交。
本轮兼容调整全量 macOS Go 65 个有测试的包通过。新合成回归的逐项计时为 0.40 秒。
首行元数据兼容性复审
3dd5a79e9固定 Core3c0fcff。合成用例覆盖包内语法与独立元数据两条路径。macOS ARM64 专项及竞态通过,22 项逐项计时通过,首行测试 0.71 秒。env -S绝对解释器路径的高亮和 Pyrefly 编辑诊断,共通过 5 项宿主 E2E。工作台审查修复
3ff530de8基于 Core3c0fcff和桌面 main742898929。已知路径可先显示。未知无后缀路径收到首份快照后重新查路径关联,再尝试首行规则。0813d3cf4失败,修复后通过。受控测试中,插件语言快照保持挂起时,Makefile从等待 1 秒超时变为立即返回语法。未测量完整原生启动与常驻内存。./scripts/desktop/desktop-go.sh test -p=1 -parallel=1 -count=1 -timeout=3m ./internal/localshell ./internal/pluginservice串行复跑两个完整包均通过。两包及其运行时代码与此次工作台修复的基线一致。