mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-07 16:36:58 +00:00
Language smoke / Language smoke (typescript) (push) Failing after 3s
CI / Plugins (SDK, official, fixtures) (push) Failing after 58s
CI / Changes (push) Successful in 1s
CI / Rust (macos-latest) (push) Waiting to run
CI / Rust (windows-latest) (push) Waiting to run
CI / Rust (ubuntu-22.04) (push) Failing after 43s
CI / Cargo deny (push) Failing after 5s
Language smoke / Language smoke (java) (push) Failing after 7s
Language smoke / Language smoke (kotlin) (push) Failing after 6s
CI / Remote server (linux musl) (push) Failing after 6m45s
CI / E2E (push) Failing after 18m9s
Language smoke / Language smoke (go) (push) Failing after 7s
CI / Frontend (push) Successful in 26m13s
Language smoke / Language smoke (python) (push) Failing after 4s
Language smoke / Language smoke (rust) (push) Failing after 4s
Plugin API 1.3 adds what commit-message generators and before-commit checks need: - `menu = "commit.message"`: a plugin command, with the plugin's icon, in the toolbar above the commit message of the Commit tool window and the Commit dialog. - `commit.pending-commit()` (`vcs.read`): what Commit would commit right now, per file its repository, path, status and a `git diff` of only the included files and changed blocks against HEAD (1 MiB in all), plus the message, Amend and a revision. The diff is made by the same selection the commit uses, in a copy of the index, so the index and the working tree stay as they are; unsaved editors of the included files are saved first, as Commit does. Only in trusted projects. - `commit.set-commit-message(revision, message)` (`vcs.write`): replaces the message only while the draft is still at that revision, so text the user typed meanwhile is never overwritten (`stale`). - `[[contributes.commitChecks]]` and the optional `commit-checker` export (worlds `plugin-commit-checks` / `commit-checks`): checks listed in Commit Options (on by default, `vcs.commit.disabledPluginChecks` turns them off) and run after the IDE's own; their problems, optionally with a location, stop the commit until Commit Anyway. The window answers the host through `CommitRequested` / `plugin_answer_commit`, also for remote windows. The Rust SDK gains `host::pending_commit`, `host::set_commit_message`, `openidea_plugin::commit` and their mock; a `commit` test fixture exercises them. All components are rebuilt for the WIT change. Refs #1650
76 lines
3.3 KiB
Plaintext
76 lines
3.3 KiB
Plaintext
package openidea:[email protected];
|
|
|
|
/// The commit being prepared in the window the current command or event came
|
|
/// from (the Commit tool window, or the Commit dialog while it is open): the
|
|
/// changes it holds and its message.
|
|
interface commit {
|
|
use types.{error};
|
|
|
|
/// A file the commit changes.
|
|
record commit-change {
|
|
/// Absolute path of the working tree root of its repository.
|
|
repository: string,
|
|
/// Absolute path (after a rename, the new one).
|
|
path: string,
|
|
/// The path before a rename or copy.
|
|
old-path: option<string>,
|
|
/// `added`, `modified`, `deleted`, `renamed`, `copied` or
|
|
/// `type-changed` (more may be added).
|
|
status: string,
|
|
/// What the commit changes in the file, in `git diff` format against
|
|
/// HEAD: only the changed blocks included in the commit. `none` for
|
|
/// binary content.
|
|
diff: option<string>,
|
|
/// `diff` was cut at the size limit (1 MiB for all the changes).
|
|
truncated: bool,
|
|
}
|
|
|
|
/// What Commit would commit right now.
|
|
record commit-draft {
|
|
/// Changes whenever the message, the included changes or Amend do.
|
|
revision: u64,
|
|
message: string,
|
|
/// The commit replaces the last one (Amend); `changes` are still
|
|
/// against HEAD, so they don't include the last commit's own.
|
|
amend: bool,
|
|
changes: list<commit-change>,
|
|
}
|
|
|
|
/// The commit being prepared, as Commit would make it: the included
|
|
/// files and changed blocks only. Unsaved editors of the included files
|
|
/// are saved first, as Commit does; nothing is staged or committed.
|
|
/// `none` when the window's project has no repository. Fails with
|
|
/// `invalid` outside a command or event of a window, and in a project that
|
|
/// is not trusted. Requires `vcs.read`.
|
|
pending-commit: func() -> result<option<commit-draft>, error>;
|
|
/// Replaces the commit message, only if the draft is still at `revision`
|
|
/// (else `stale`, and nothing changes): text the user typed meanwhile is
|
|
/// never overwritten. The user reviews it and commits. Same windows as
|
|
/// `pending-commit`. Requires `vcs.write`.
|
|
set-commit-message: func(revision: u64, message: string) -> result<_, error>;
|
|
}
|
|
|
|
/// Before-commit checks (`[[contributes.commitChecks]]`), run when the user
|
|
/// commits, after the IDE's own checks, for the checks enabled in Commit
|
|
/// Options. Problems stop the commit and show beside the message until the
|
|
/// user changes it or chooses Commit Anyway. Requires `vcs.read`.
|
|
interface commit-checker {
|
|
use types.{error, location};
|
|
use invocation.{invocation};
|
|
use commit.{commit-draft};
|
|
|
|
/// Something the user should look at before committing.
|
|
record commit-problem {
|
|
/// One sentence, shown after the check's title.
|
|
message: string,
|
|
/// Where it is, opened from the problem; `none` for the commit as a
|
|
/// whole (its message, for instance).
|
|
location: option<location>,
|
|
}
|
|
|
|
/// Runs the declared check `check` on `draft`: no problems lets the commit
|
|
/// go on. A call that fails or runs out of time is reported as a problem
|
|
/// of the check.
|
|
check: func(check: string, draft: commit-draft, ctx: borrow<invocation>) -> result<list<commit-problem>, error>;
|
|
}
|