Repository navigation
feat(run-config): 插件声明启动前任务(beforeLaunchTasks 0),启动前可添加插件任务 - #97
Merged
Merged
Conversation
对标 IntelliJ IDEA 运行配置“启动前”的“添加新任务”(如 Go 插件的“运行 Go 命令”), 由插件注入任务种类,Core 不含任何插件特判(1lck/Lithe-IDEA#2100)。 - 契约:buildSystems[].beforeLaunchTasks(最多 16 个),声明方式同 runConfigurationTypes, 但不能写 execution,arguments 不能用 ${userArguments};任务 ID 与类型 ID 各自唯一; requires.beforeLaunchTasks 0;语言文件新增 beforeLaunchTasks 一节;新 fixture before-launch-tasks/。 - 运行配置:beforeLaunch 步骤新增 {task: {pluginID, buildSystemID, type, values}}, 在拥有该列表的配置的工作目录里运行;步骤对象不允许其他键。 - 命令:新增 runConfig.checkBeforeLaunchTask(校验“添加新任务”表单值)和 build.beforeLaunchTaskPlan(把任务步骤展开成 argv 计划);runConfig.beforeLaunch、 updateOptions、saveEditorChanges 新增 runTypePlugins;拒绝码新增 taskNotDeclared、 invalidTaskValues;确认指纹覆盖任务、值和工作目录。 - 编辑器:beforeLaunch 字段新增 tasks(任务种类与表单),字段值里的任务步骤为 {task, name, summary, values},插件已卸载的为 {task, name, summary, missing: true}。 - 修复:runConfigurationTypes 的必填 arguments 字段留空以前不会被拒绝。 - 文档:rust-core-api、run-configuration-v2 schema、契约 README 与两份 schema、 能力表、API 总表、build-systems 领域页、协议更新记录(同时把已合入的 #96 managedRuntimes 从“待合入”移进时间线和首次出现表)。没有新增宿主方法或通知。
…取启动前列表 构建运行的编辑器不走 runConfig.editorForm,以前由宿主自己算可选配置,也看不到插件任务。 新命令按已保存配置返回 beforeLaunch 字段的 candidates、tasks 和当前生效的 value, 编辑后的值照旧交给 runConfig.updateOptions。未知配置返回 invalid_request。
xiaoyumuxi
marked this pull request as ready for review
November 18, 2026 12:46
This was referenced Nov 18, 2026
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
类型
feat:新能力
beforeLaunchTasks0。构建插件声明启动前任务的种类,运行配置的“启动前”列表在“运行另一个配置”之外还能加这些任务。宿主按声明画任务表单,Core 负责校验值、保存步骤,并在拥有该列表的配置的工作目录里展开命令行。Core 不含任何插件或语言的特判。改动
插件契约(
shared/plugins/contract/v1/)buildSystems[].beforeLaunchTasks(1–16 个),需要requires.beforeLaunchTasks: 0(schema 用allOf的 if/then 强制)。id、displayName、description?、icon?runConfigurationTypes相同的规则;任务 ID 和类型 ID 各自唯一,同一构建系统可以有同名的类型和任务fields[](≤16)text、choice、checkbox、file、directory、arguments,visibleWhen等)arguments${field:<id>};不能用${userArguments}(plugin.template.invalid)executionplugin.manifest.invalid)beforeLaunchTasks.<构建系统 ID>.<任务 ID>,结构同runConfigurationTypes;不合法时是plugin.build.invalidLocalization。fixtures/before-launch-tasks/:command(必填arguments字段)和generate两个任务,带l10n/zh-Hans.json。Core
lithe-build:manifest/run_types.rs用同一套声明校验处理类型和任务,RunTypeRole::{Configuration, BeforeLaunchTask}区分两者的差异(execution、${userArguments});run_types.rs新增declared_plan,build.beforeLaunchTaskPlan和build.runConfigurationPlan共用;lithe-execution:before_launch.rs重写。步骤是{configuration}或{task: {pluginID, buildSystemID, type, values}},两种都deny_unknown_fields。展开时任务步骤用拥有该列表的配置的工作目录。指纹覆盖{task, workingDirectory}。declared.rs给任务生成表单(task_kind_item)、字段值项(task_step_item)和一行摘要(summary),declared_task_launch解析工作目录(项目外的目录会失败)。runConfigurationTypes的必填arguments字段留空不会被拒绝:store和launch_values现在都执行required。lithe-plugin-model:能力BEFORE_LAUNCH_TASKS=&[0]。run-configuration-v2.schema.json:beforeLaunch的每一项改为oneOf{configuration}/{task: runTypeReference}。宿主调用 Core 的命令(不是插件宿主方法)
runConfig.checkBeforeLaunchTask(Core 命令,新){status: "ok", step},step是要放进beforeLaunch字段值的步骤;失败时返回{status: "invalid", errors},错误按field:<id>给出。未声明的任务返回not_supported。不写文件runConfig.beforeLaunchField(Core 命令,新)runConfig.editorForm的编辑器(构建运行的编辑器)读取已保存配置的beforeLaunch字段:返回{candidates, tasks, value},和 editorForm 的字段相同,value是当前生效的列表;编辑后的值交给runConfig.updateOptions。未知配置返回invalid_request。宿主不再自己算可选的配置build.beforeLaunchTaskPlan(Core 命令,新)runConfig.beforeLaunch返回的任务步骤展开成 argv 计划,带回beforeLaunchTask。实例的选择方式同build.runConfigurationPlan;保存的值不合法时返回plugin.build.invalidBeforeLaunchTask(字段values.<id>)runConfig.beforeLaunch/runConfig.updateOptions/runConfig.saveEditorChanges:新请求字段runTypePluginsrunConfig.beforeLaunch的任务步骤返回{task, name, summary, workingDirectory};拒绝码新增taskNotDeclared、invalidTaskValues,拒绝时带taskrunConfig.editorForm:beforeLaunch字段新增tasks{runType, displayName, description?, icon?, fields, values}。字段值里的任务步骤是{task, name, summary, values};插件已卸载的步骤是{task, name, summary, missing: true},编辑器照样显示并保留它没有新增或修改
lithe/host/*宿主方法和通知,所以 API 总表的宿主方法表和更新记录的“宿主方法(按 API 编号)”索引不加行。文档
rust/contracts/rust-core-api.md:beforeLaunchTasks;runTypePlugins、新拒绝码、指纹、编辑器tasks、checkBeforeLaunchTask;build.beforeLaunchTaskPlan。reference/protocol-changelog.md:能力表加beforeLaunchTasks0,2026-11-18 时间线加本 PR。另外,feat(plugins): add managed runtime preparation and isolated resolver sessions #96 已合入,但它的managedRuntimes0 还留在“待合入”,这次一并移进时间线和能力首次出现表,“待合入”改为“目前没有”。reference/capabilities-and-versions.md、reference/api-catalog.md(API-29 中英两行)、reference/domains/build-systems.md:加beforeLaunchTasks,桌面端标“未声明”,等宿主 PR 接入后再改。错误码
plugin.build.invalidBeforeLaunchTask(新)values.<id>plugin.build.invalidLocalizationbeforeLaunchTasks一节plugin.manifest.invalid/plugin.template.invalidexecution,或者arguments用了${userArguments},以及与类型相同的声明错误taskNotDeclared/invalidTaskValues(新)beforeLaunch{field: "beforeLaunch", code}测试
crates/core/src/tests/before_launch_tasks.rs,4 个测试:task_kinds_are_offered_on_the_step_field_and_not_as_configurations:runConfig.configurationTypes里;beforeLaunch字段的tasks带译文、图标、field:<id>字段和默认值;task_steps_are_checked_saved_and_reopened:checkBeforeLaunchTask按字段报错,成功时返回步骤;未声明的任务返回not_supported;beforeLaunchField返回同样的值、可选配置和任务种类,未知配置返回invalid_request;missing,保存时报taskNotDeclared;updateOptions也会检查任务步骤。task_steps_run_in_the_owning_configuration_directory:taskNotDeclared/invalidTaskValues带task;build.beforeLaunchTaskPlan选中包含工作目录的实例,返回execution: task和beforeLaunchTask;values.command;项目外的目录和别的插件的任务都会失败。before_launch_task_declarations_are_validated:requires.beforeLaunchTasks、写了execution、用了${userArguments}时,各报对应的错误码和字段。declarative_plugins.rs:新 fixture 加入“契约 fixture 都能通过校验”的测试。cargo test --workspace:2235 个通过,0 失败;cargo fmt --check、cargo clippy --workspace --all-targets --all-features -D warnings,以及改动 crate 的--target x86_64-pc-windows-msvcclippy:都通过;scripts/rust-core/verify-rust-core-comments.sh(改动的 5 个 crate)、node scripts/logging/generate-log-events.mjs --check、node shared/plugins/scripts/verify-docs.mjs、node --test shared/plugins/scripts/*.test.mjs:都通过;sdk-e2e.mjs。