Repository navigation
fix(python): 接通当前文件运行 - #9
Merged
Merged
Conversation
Mucheen
marked this pull request as ready for review
November 20, 2026 15:58
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
Refs 1lck/Lithe-IDEA#2122
PR 类型 / Type
改动说明 / What changes
背景 / Why
在 Python 项目中打开含
if __name__ == '__main__'的main.py,选择工具栏「当前文件 → 运行」会提示没有可运行入口。同一文件从「构建 → 目标」可以执行。改动 / Changes
buildProviders: 1能力,并注册供工具栏使用的main入口类型。构建面板继续使用原有fromTargets运行项。python工具链启动计划,由宿主按项目配置选解释器。__main__.py,保留脚本参数边界、运行时参数、环境变量和工作目录。src布局或自定义工作目录下按项目包路径解析导入。.venv,并优先采用已显式设置的 Python 解释器。无头用例固定主题,避免从后台线程查询 AppKit。补充参数、环境、模块和失效入口的协议回归,更新 0.8.9 CI 和插件功能矩阵。initializationOptions识别显式配置,转发宿主已经校验的tool.executable。POSIX 保留应用进程身份,Windows 子进程留在宿主 Job 中并报告同一退出码。__main__.py前逐级验证包来源并核对入口文件;遇到同名模块遮蔽时报告错误。入口相关错误由插件提供中英文,未传界面语言的旧宿主使用双语提示。不在本 PR 范围内 / Out of scope
项目向导的简体中文字段、桌面与 Core 协议修改、插件发版。
类型专属 · fix
复现与根因
main.py后从工具栏运行。实际提示没有入口,预期用项目 Python 执行。构建面板中的同一目标可运行。a31a0a5引入入口探测时,Python 清单只声明了fromTargets和buildProviders: 0,也缺少lithe/build/prepareRun的实现,宿主无法走完整入口运行链路。检查项
e2e/host/desktop/internal/workbench/python_current_file_run_e2e_test.go用正式 ZIP 先复现The current file has no entrypoint to run,修复后同一用例通过。范围检查 / Scope checks
功能矩阵 / Feature matrix
docs/feature-matrix.md,标注 macOS ARM64 工作台证据及其他平台待验证。宿主矩阵不增插件条目。插件归属 / Plugin ownership
UI 验证 / UI evidence
N/A。通过工作台端到端用例触发既有工具栏和构建面板动作,验证本次修复的执行结果。改动未涉及视图布局、控件或宿主界面文案。
统一日志系统 / Structured logging
lithe/build/prepareRun接入插件现有lithe_rpc结构化操作日志。协议回归检查失效入口的终态错误;入口发现继续抑制高频成功日志。界面文案 / i18n
逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A。没有设置改动。
插件契约 / Plugin contract
N/A。插件声明现有
buildProviders: 1并实现现有 RPC。Core 契约、能力定义、宿主 API 与 SDK 无改动。发行包与资源 / Bundle and resources
scripts/run_entrypoint.py随插件 ZIP 安装,运行时只读。归档存在性和插件文件哈希回归覆盖该脚本;宿主安装包和签名资源不受影响。无用代码与重构 / Dead code and refactoring
验证 / Verification
node scripts/e2e-host.mjs --ref 7d62ff572d7f6fb79b977efe98af263b2a181fe8 --run '^TestPythonSupportPluginRunCurrentFile$'node scripts/package.mjs --platform darwin-arm64、node scripts/test.mjs、node --test scripts/package/*.test.mjs、Store 清单验证node scripts/e2e-host.mjs --ref 4d1b88f03f243356c855299464baa2647cc57226 --run '^TestPythonSupportPlugin(GrammarHighlighting|RunCurrentFile(InterpreterOverride)?)$'desktop-go.sh testactionlint、git diff --check、宿主静态只读、稳定性、i18n 与矩阵校验复审新增回归先在
a8fbf9c失败,覆盖显式解释器被忽略和误执行同名脚本。修复包通过同样的用例,并验证带空格参数、非零退出码转发和中英诊断。未在原生窗口手点验收本次修复。Windows、Linux 和 Intel Mac 工作台待验证。
提交前确认 / Final checks
main的50daeb2创建分支,目标为main。