Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion rust/crates/toolchain/src/settings_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,18 @@ pub fn settings_view(input: &Value) -> Validation<Value> {
problems.sort_by(|left, right| tool_order(tools, &statuses, *left, *right));
let errors = statuses.iter().filter(|s| **s == Status::Error).count();
let warnings = statuses.iter().filter(|s| **s == Status::Warning).count();
// An issue names the group its tool is listed under, so a host that opens the tool from
// the list of issues can open that group without knowing how keys are formed.
let issues: Vec<Value> = problems
.iter()
.take(request.issue_limit.unwrap_or(DEFAULT_ISSUES))
.map(|index| json!({"index":index,"status":statuses[*index].name()}))
.map(|index| {
let mut issue = json!({"index":index,"status":statuses[*index].name()});
if query.group_by != "none" {
issue["group"] = Value::String(group_of(&tools[*index], &query.group_by).0);
}
issue
})
.collect();
Ok(json!({
"rows":rows,
Expand Down Expand Up @@ -445,6 +453,15 @@ mod tests {
json!({"total":6,"matched":6,"problems":3,"errors":2,"warnings":1,"pinned":1,"changed":1})
);
assert_eq!(keys(&result["issues"]), ["1:error", "4:error", "2:warning"]);
let groups: Vec<&str> = result["issues"]
.as_array()
.expect("issues")
.iter()
.map(|issue| issue["group"].as_str().unwrap_or_default())
.collect();
assert_eq!(groups, ["category:runtime", "audience:plugin", "category:build"]);
let flat = view(sample(), json!({"groupBy":"none"}));
assert!(flat["issues"][0].get("group").is_none());
}

#[test]
Expand Down
5 changes: 4 additions & 1 deletion shared/plugins/contract/v1/toolchains/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ reason is `error`. The output `view` is `{rows,issues,counts}`:
starts collapsed, and so does every plugin group when there are more than 40.
While `text` or a filter other than `all` applies, no group is collapsed, so a
match is never hidden.
- `issues` lists the first problems in the same order as `{index,status}`.
- `issues` lists the first problems of every tool, whatever the query, as
`{index,status,group?}`: errors first, then warnings, each by name. `group` is
the key of the group the tool is listed under when the query groups, so a host
that opens the tool can open its group.
- `counts` is `{total,matched,problems,errors,warnings,pinned,changed}`. Only
`matched` depends on the query.

Expand Down
5 changes: 2 additions & 3 deletions shared/plugins/reference/protocol-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

## 待合入

目前没有。

- **`toolDefinitions` 1**(API-23、API-19):工具定义新增只影响显示位置的 `category`(`runtime`、`build`、`package`、`debug`、`lint`、`other`,默认 `other`)和 `audience`(`user` 默认,`plugin` 表示插件自用的运行时);用到任一字段的插件声明 `toolDefinitions: 1`,只支持 0 的宿主不会安装,其他插件继续写 0。新增 Core 命令 `toolchains.settingsView`:按宿主已有的解析原因、固定和未应用状态给设置页工具列表分类(`error`、`warning`、`ok`)、筛选、分组、折叠和计数,最多 20,000 个工具。`plugins.settings.navigation` 支持三级、每项可选 `limit`(超出的子项折叠成一行“全部 N 个”)以及每行的 `matched` 与 `path`。清单 schema 的 `requires.buildProviders` 补上 #89 已支持的版本 1。没有新增宿主方法、通知或 SDK 版本。实现见 [#99](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/99)([@xiaoyumuxi](https://github.com/xiaoyumuxi));合入日期在合并后补入下方时间线。宿主须先声明 `toolDefinitions` 1,插件才可要求它。
- `toolDefinitions` 1 内的补充(API-23、API-19):`toolchains.settingsView` 的 `issues` 每项改为 `{index,status,group?}`:查询分组时 `group` 是工具所在分组的键,宿主从问题列表打开这个工具时可以一并展开它的分组,不必自己拼分组键;契约 README 同时写明 `issues` 一直不受查询影响、先错误后警告并各按名称排序。没有新增版本号、宿主方法、通知或 SDK 版本。实现见 [#102](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/102)([@xiaoyumuxi](https://github.com/xiaoyumuxi))。

## 按协议查首次出现

Expand Down Expand Up @@ -150,6 +148,7 @@

| PR | 修改人 | API 编号 | 协议 / 能力 | 改了什么 |
| --- | --- | --- | --- | --- |
| [#99](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/99) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-23、API-19 | **`toolDefinitions` 1** | 工具定义新增只影响显示位置的 `category`(`runtime`、`build`、`package`、`debug`、`lint`、`other`,默认 `other`)和 `audience`(`user` 默认,`plugin` 表示插件自用的运行时);用到任一字段的插件声明 `toolDefinitions: 1`,只支持 0 的宿主不会安装,其他插件继续写 0。新增 Core 命令 `toolchains.settingsView`:按宿主已有的解析原因、固定和未应用状态给设置页工具列表分类(`error`、`warning`、`ok`)、筛选、分组、折叠和计数,最多 20,000 个工具。`plugins.settings.navigation` 支持三级、每项可选 `limit`(超出的子项折叠成一行“全部 N 个”)以及每行的 `matched` 与 `path`。清单 schema 的 `requires.buildProviders` 补上 #89 已支持的版本 1。没有新增宿主方法、通知或 SDK 版本。宿主须先声明 `toolDefinitions` 1,插件才可要求它。 |
| [#97](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/97) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-29 | **`beforeLaunchTasks` 0** | 运行配置“启动前”的插件任务(对标 IntelliJ IDEA 的“添加新任务”,[1lck/Lithe-IDEA#2100](https://github.com/1lck/Lithe-IDEA/issues/2100)):构建系统新增 `beforeLaunchTasks`(最多 16 个),声明方式和 `runConfigurationTypes` 相同(`id`、`displayName`、可选 `description`、`icon`、最多 16 个 `fields` 和 `arguments` 模板),但任务总是运行到结束,不能写 `execution`,`arguments` 不能用 `${userArguments}`;任务 ID 与类型 ID 各自唯一。运行配置的 `beforeLaunch` 步骤除 `{configuration}` 外新增 `{task: {pluginID, buildSystemID, type, values}}`,任务在拥有这个步骤列表的配置的工作目录里运行,不带程序参数和环境变量;步骤对象不允许出现别的键。Core 新增命令 `runConfig.checkBeforeLaunchTask`(校验“添加新任务”小表单的值,返回要放进字段值的步骤)、`runConfig.beforeLaunchField`(给不用 `runConfig.editorForm` 的编辑器,例如构建运行的编辑器,返回已保存配置的 `beforeLaunch` 字段)和 `build.beforeLaunchTaskPlan`(把任务步骤展开成 argv 计划);`runConfig.editorForm` 的 `beforeLaunch` 字段新增 `tasks`(已安装插件声明的任务种类及其表单),字段值里的任务步骤是 `{task, name, summary, values}`,插件已卸载的是 `{task, name, summary, missing: true}`;`runConfig.beforeLaunch`、`runConfig.updateOptions`、`runConfig.saveEditorChanges` 新增请求字段 `runTypePlugins`,`runConfig.beforeLaunch` 的任务步骤返回 `{task, name, summary, workingDirectory}`,拒绝码新增 `taskNotDeclared` 和 `invalidTaskValues`(带 `task`),确认指纹也覆盖任务及其值和工作目录。`runConfigurationTypes` 的必填 `arguments` 字段留空现在会被拒绝(以前没有执行 `required`)。语言文件新增 `beforeLaunchTasks.<构建系统 ID>.<任务 ID>`;保存的值不合法时是 `plugin.build.invalidBeforeLaunchTask`(字段 `values.<id>`)。新增 fixture `before-launch-tasks/`。用到它的插件声明 `beforeLaunchTasks: 0`,不认识它的宿主不会安装。没有新增宿主方法或通知。 |
| [#96](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/96) | [@lithe-support[bot]](https://github.com/apps/lithe-support) | API-23 | **`managedRuntimes` 0** | 受管运行时:新增固定 HTTPS 归档与 SHA-256、平台选择、与插件版本无关的缓存身份,以及插件后端对外部/暂存依赖的资格检查契约。新增权限 `runtimes.install`、审查程序 `managedRuntime`、Core 命令 `plugins.managedRuntimes.plan` 与 `plugins.managedRuntimes.decodeResolution`;正常语言服务器启动可接收只读 `runtimes` 映射。原生 `lsp.startServer` 新增可选 `functionRelayEnabled`(默认 true),准备会话设为 false 隔离跨插件调用但保留宿主直接调用。无新增宿主 RPC 或 SDK 版本。宿主须先发布对应能力,插件才可要求它。 |
| [#94](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/94) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-29 | **`runConfigurationTypes` 0** | 插件声明自己的运行配置类型([1lck/Lithe-IDEA#2100](https://github.com/1lck/Lithe-IDEA/issues/2100)):构建系统新增 `runConfigurationTypes`(最多 16 个),每个类型有 `id`、`displayName`、可选的 `description`、`execution`(`application` 或 `task`)、`arguments` 模板和最多 16 个字段 `fields`(`text`、`choice`、`checkbox`、`file`、`directory`、`arguments`,可带 `default`、`required`、`placeholder`、`visibleWhen` 和每个字段自己的 `arguments`)。新模板变量 `${field:<id>}` 是整个参数,每个字段必须在类型参数或字段参数里恰好用一次(只控制显示、不带参数的字段除外);`${userArguments}` 恰好出现一次时,编辑器才显示程序参数。用户保存的配置类型是 `build.run-type`,`extensions.build` 记 `{pluginID, buildSystemID, type, values}`,仍存在 `.lithe/run/plugin/<插件 ID>.toml`。所有运行配置(含 Core 自带的)新增通用开关 `allowMultipleInstances`:关时再次启动先停掉正在运行的进程,开时宿主在旁边再起一个。Core 新增命令 `build.runConfigurationPlan`(把保存的配置展开成 argv 计划),`runConfig.configurationTypes`、`runConfig.editorForm`、`runConfig.saveConfiguration` 新增请求字段 `runTypePlugins`(清单和语言文件),语言文件新增 `runConfigurationTypes.<构建系统 ID>.<类型 ID>`。字段值不合法时是 `plugin.build.invalidRunConfiguration`(字段 `values.<id>`),语言文件不合法时是 `plugin.build.invalidLocalization`。新增 fixture `run-configuration-types/`。用到它的插件声明 `runConfigurationTypes: 0`,不认识它的宿主不会安装。没有新增宿主方法或通知。 |
Expand Down
Loading