Skip to content

[Feature] Run the current file and an individual function or test #21

Done

Description

@xiaoyumuxi

Problem to solve / 要解决的问题

Python 编辑器当前缺少从当前文件直接运行和从 pytest 函数/方法声明直接运行的统一入口。开发者需要频繁切换到构建配置,单个测试验证成本较高。

Proposed solution / 建议方案

识别当前 Python 文件并提供 Run 入口;普通 .py/.pyw 直接使用项目解释器执行,不要求 __main__ guard。识别 pytest 函数、类方法并通过精确 node ID 提供单测试 Run/Debug 入口。运行前重新读取文档、保存并校验版本,rerun 时重新验证声明,同时统一 Windows/macOS 相对路径安全处理。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

Run / 运行

Priority / 优先级

P1 / 尽快处理:使用体验大幅下降,但通常仍可继续使用

Alternatives considered / 已考虑的替代方案

继续手写 Python 命令或使用完整 pytest,无法提供编辑器内当前文件与单测试的快速反馈。

Additional context / 补充信息

本 Issue 与 feat(run): run current files and individual functions 实现对应。PHP、Lua 不在本次插件范围内。

Checklist / 提交前检查

  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。

Activity

  1. added
    enhancement
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions