Порівняти коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
25424465c0 | ||
|
|
cbe4355b8d | ||
|
|
47d547e206 | ||
|
|
f42d10d86c | ||
|
|
86f390f2a9 | ||
|
|
78784837d1 |
No files matched your search
@@ -4106,7 +4106,7 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "ide-agent"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"encoding_rs",
|
||||
@@ -4129,7 +4129,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-analysis"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ast-grep-core",
|
||||
"ide-core",
|
||||
@@ -4143,7 +4143,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-android"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"serde",
|
||||
@@ -4154,7 +4154,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-build"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dirs 6.0.0",
|
||||
@@ -4170,7 +4170,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-clipboard"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"objc2 0.6.5",
|
||||
"objc2-app-kit 0.3.2",
|
||||
@@ -4179,7 +4179,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-core"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"encoding_rs",
|
||||
@@ -4196,7 +4196,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-coverage"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-run",
|
||||
@@ -4210,7 +4210,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-dap"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"ide-core",
|
||||
@@ -4231,7 +4231,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-db"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"bb8",
|
||||
"dirs 6.0.0",
|
||||
@@ -4258,7 +4258,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-docker"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"serde",
|
||||
@@ -4271,7 +4271,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-extension"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -4291,7 +4291,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-fonts"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-text",
|
||||
@@ -4303,7 +4303,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-github"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-vcs",
|
||||
@@ -4316,7 +4316,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-host"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -4378,7 +4378,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-http"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"parking_lot",
|
||||
@@ -4396,7 +4396,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-index"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4418,7 +4418,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jsonrpc"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"futures",
|
||||
@@ -4435,7 +4435,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-language"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4491,7 +4491,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-lsp"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"futures",
|
||||
@@ -4517,7 +4517,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-notebook"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"ide-core",
|
||||
@@ -4540,7 +4540,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-plugin"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"ide-core",
|
||||
@@ -4561,7 +4561,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-profiler"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-run",
|
||||
@@ -4574,7 +4574,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-remote"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"globset",
|
||||
"ide-core",
|
||||
@@ -4592,7 +4592,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-run"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"encoding_rs",
|
||||
@@ -4616,7 +4616,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-sdk"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"ide-core",
|
||||
@@ -4635,7 +4635,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-search"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"globset",
|
||||
@@ -4655,7 +4655,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-spell"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"parking_lot",
|
||||
@@ -4668,7 +4668,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-ssh"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"flate2",
|
||||
@@ -4689,7 +4689,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-syntax"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-language",
|
||||
@@ -4704,7 +4704,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-terminal"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"libc",
|
||||
@@ -4717,7 +4717,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-text"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"ide-core",
|
||||
@@ -4730,7 +4730,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-tools"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hex",
|
||||
@@ -4751,7 +4751,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vcs"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -4772,7 +4772,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vfs"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"chardetng",
|
||||
"dunce",
|
||||
@@ -4796,7 +4796,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-web"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"open",
|
||||
@@ -4812,7 +4812,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-workspace"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -6358,7 +6358,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openidea"
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
|
||||
@@ -5,7 +5,7 @@ members = ["crates/*", "src-tauri"]
|
||||
exclude = ["sdk", "plugins"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.38"
|
||||
version = "0.1.39"
|
||||
edition = "2024"
|
||||
rust-version = "1.96"
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -112,9 +112,10 @@ for (const theme of ["dark", "light"] as const) {
|
||||
});
|
||||
expect(geometry.scroll).toBe(geometry.client);
|
||||
expect(geometry.contained).toBe(true);
|
||||
expect(geometry.promptRadius).toBeLessThanOrEqual(4);
|
||||
expect(geometry.replyBackground).not.toBe("rgba(0, 0, 0, 0)");
|
||||
expect(geometry.replyBorder).toBe("1px");
|
||||
expect(geometry.promptRadius).toBeLessThanOrEqual(6);
|
||||
// Replies read as plain text on the panel.
|
||||
expect(geometry.replyBackground).toBe("rgba(0, 0, 0, 0)");
|
||||
expect(geometry.replyBorder).toBe("0px");
|
||||
expect(geometry.userOnRight).toBe(true);
|
||||
expect(geometry.approvalAligned).toBe(true);
|
||||
expect(geometry.authorBeforeWork).toBe(true);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "openidea",
|
||||
"private": true,
|
||||
"description": "An open-source IDE inspired by IntelliJ IDEA",
|
||||
"version": "0.1.38",
|
||||
"version": "0.1.39",
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
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>;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// What the pane beside the Services tree shows for a plugin's node.
|
||||
interface detail-types {
|
||||
/// A switch above a log; when on, `args` are appended and the program
|
||||
/// starts again.
|
||||
record log-toggle {
|
||||
id: string,
|
||||
label: string,
|
||||
args: list<string>,
|
||||
}
|
||||
|
||||
/// A program the IDE runs, its output followed in a log (ANSI stripped,
|
||||
/// the last 5000 lines) until it exits or the pane closes. Needs the
|
||||
/// plugin's `process:<program>` grant; runs in the project root.
|
||||
record process-log {
|
||||
program: string,
|
||||
args: list<string>,
|
||||
toggles: list<log-toggle>,
|
||||
}
|
||||
|
||||
/// The body of a tab.
|
||||
variant pane {
|
||||
/// A centred message: an empty state or why there is nothing to show.
|
||||
message(string),
|
||||
/// Read-only text the user can select and copy, at most 1 MiB.
|
||||
text(string),
|
||||
log(process-log),
|
||||
}
|
||||
|
||||
/// A tab of a node's pane; the IDE switches tabs without calling the plugin.
|
||||
record tab {
|
||||
id: string,
|
||||
label: string,
|
||||
body: pane,
|
||||
}
|
||||
}
|
||||
|
||||
/// The detail pane of the nodes of a plugin's `location = "services"` views.
|
||||
/// The nodes themselves, the toolbar and their events come from
|
||||
/// `view-provider` (`render` / `handle` of the view).
|
||||
interface detail-provider {
|
||||
use types.{error};
|
||||
use invocation.{invocation};
|
||||
use detail-types.{tab};
|
||||
|
||||
/// The tabs of node `key` of view `view` (at most 8), rendered when the
|
||||
/// node is selected and again after `views.refresh(view)`.
|
||||
detail: func(view: string, key: string, ctx: borrow<invocation>) -> result<list<tab>, error>;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// Optional export (world `plugin-diagnostics`): problems in the current,
|
||||
/// possibly unsaved document, for the languages declared with the
|
||||
/// `diagnostics` provider kind. Asked shortly after a document opens or
|
||||
/// changes, under the editor-provider budget; it can't ask the user.
|
||||
interface diagnostics-provider {
|
||||
use diagnostics.{diagnostic};
|
||||
|
||||
/// The document to check (the editor's text, unsaved edits included).
|
||||
record document {
|
||||
/// Absolute path.
|
||||
path: string,
|
||||
language: string,
|
||||
version: u64,
|
||||
text: string,
|
||||
}
|
||||
|
||||
/// The document's problems, at most 5,000; they replace what this
|
||||
/// provider reported before, and an empty list removes them.
|
||||
diagnostics: func(doc: document) -> list<diagnostic>;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// HTTP endpoints found in a project (`[[contributes.endpoints]]`).
|
||||
interface endpoints-provider {
|
||||
use types.{error, location};
|
||||
use invocation.{invocation};
|
||||
|
||||
/// One HTTP route.
|
||||
record endpoint {
|
||||
/// `none` accepts any HTTP method.
|
||||
method: option<string>,
|
||||
/// Path parameters use braces, e.g. `/photos/{id}`.
|
||||
path: string,
|
||||
/// Shown next to the route, e.g. `Rails`.
|
||||
framework: string,
|
||||
/// Display name, e.g. `PhotosController#show`.
|
||||
handler: option<string>,
|
||||
/// Where the route is declared, inside the project.
|
||||
location: location,
|
||||
}
|
||||
|
||||
/// The project's routes, complete. Called when the IDE first needs them and
|
||||
/// again after a file matching `files` changes; cached in between. Runs in
|
||||
/// the background: it can't ask the user.
|
||||
endpoints: func(ctx: borrow<invocation>) -> result<list<endpoint>, error>;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
/// Workbench events, delivered in batches to `event-handler.handle`.
|
||||
interface events {
|
||||
@@ -29,18 +29,25 @@ interface events {
|
||||
/// Delivers `kind` events from now on, for the rest of the session (also
|
||||
/// across idle reclaim: an event activates the plugin again). Declare
|
||||
/// `activation = ["on-event:<kind>"]` to get them before first use.
|
||||
/// Kinds: `file-opened`, `file-saved`, `editor-focused` (the focused editor
|
||||
/// Kinds: `file-opened`, `file-saved`, `files-changed` (batched disk changes
|
||||
/// as `other`, with created/modified/removed path lists in JSON), `editor-focused` (the focused editor
|
||||
/// changed), `vcs-changed` (a repository's state changed: commit,
|
||||
/// checkout, fetch…), `action-performed` (an IDE action ran) and
|
||||
/// `scheduled` (the `on-schedule` period elapsed); later IDEs add more,
|
||||
/// and an IDE that doesn't know one fails with `invalid`.
|
||||
/// Requires `events` (`events.input` for `action-performed`).
|
||||
subscribe: func(kind: string) -> result<_, error>;
|
||||
/// Replaces this kind's subscription with project-relative globs (OR).
|
||||
/// Empty globs pause delivery; `subscribe` restores unfiltered delivery.
|
||||
/// Kinds: file-opened, file-saved, files-changed. Requires `events`.
|
||||
subscribe-paths: func(kind: string, globs: list<string>) -> result<_, error>;
|
||||
unsubscribe: func(kind: string);
|
||||
}
|
||||
|
||||
/// Long-running work with a progress indicator. While a task is open, the
|
||||
/// call that began it may run for the background budget (60 s) instead of 5 s.
|
||||
/// call that began it may run for the background budget (60 s) instead of 5 s,
|
||||
/// and each `report` or `is-cancelled` renews that budget: work that keeps
|
||||
/// saying it is alive is not cut off, while work that goes quiet is.
|
||||
interface tasks {
|
||||
resource task {
|
||||
/// `done` of `total` units (`none`: indeterminate), with a short status.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
interface lifecycle {
|
||||
use types.{context, error};
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// Optional export (world `plugin-file-actions`): quick fixes and
|
||||
/// refactorings that create, rename or delete files, next to the text edits
|
||||
/// `providers.code-actions` offers. Declare the `code-actions` provider kind in
|
||||
/// `[[contributes.providers]]`; the host calls `code-actions` here with the same
|
||||
/// budget and lists the results with the others.
|
||||
interface file-actions {
|
||||
use types.{error, range, text-edit};
|
||||
|
||||
/// The document the actions are for (the editor's text while it is open).
|
||||
record document {
|
||||
/// Absolute path.
|
||||
path: string,
|
||||
language: string,
|
||||
version: u64,
|
||||
text: string,
|
||||
}
|
||||
|
||||
/// Text edits to one file.
|
||||
record file-edit {
|
||||
path: string,
|
||||
edits: list<text-edit>,
|
||||
}
|
||||
|
||||
/// A file change, applied before the action's text edits.
|
||||
variant file-operation {
|
||||
/// Fails when the file exists, unless `overwrite`.
|
||||
create(create-file),
|
||||
rename(rename-file),
|
||||
/// Deletes the file; undoing the action restores it.
|
||||
delete(delete-file),
|
||||
}
|
||||
|
||||
/// A new file with its text; missing parent directories are created.
|
||||
record create-file {
|
||||
path: string,
|
||||
text: string,
|
||||
overwrite: bool,
|
||||
}
|
||||
|
||||
/// Moves `path` to `new-path`.
|
||||
record rename-file {
|
||||
path: string,
|
||||
new-path: string,
|
||||
}
|
||||
|
||||
/// The file to delete.
|
||||
record delete-file {
|
||||
path: string,
|
||||
}
|
||||
|
||||
/// A code action that changes files. Paths are absolute or relative to the
|
||||
/// project root, and stay inside it: a path outside disables the action.
|
||||
record file-action {
|
||||
title: string,
|
||||
/// `quickfix`, `refactor`, …
|
||||
kind: option<string>,
|
||||
preferred: bool,
|
||||
/// Applied first, in order, as one workspace edit with `edits`: if
|
||||
/// any operation or edit fails, nothing is applied, and one undo
|
||||
/// reverses all of it.
|
||||
operations: list<file-operation>,
|
||||
/// Applied after the operations; may target files they create.
|
||||
edits: list<file-edit>,
|
||||
/// Opened once the action is applied.
|
||||
open: option<string>,
|
||||
/// The plugin's own reference: with it and no `operations` or `edits`,
|
||||
/// they are computed by `resolve` once the user picks the action.
|
||||
data: option<string>,
|
||||
}
|
||||
|
||||
/// Actions for `selection`, under the edit-path budget.
|
||||
code-actions: func(doc: document, selection: range) -> list<file-action>;
|
||||
/// The operations and edits of an action listed with `data` and nothing
|
||||
/// to apply, once the user picks it (the command budget applies, not the
|
||||
/// editor's 50 ms). The same four prompts as `providers.resolve-code-action`
|
||||
/// work here, in the editor's window and excluding the wait from the budget.
|
||||
resolve: func(doc: document, action: file-action) -> result<file-action, error>;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// Files outside the open projects: the configuration of the program a
|
||||
/// plugin integrates with, a tool installed elsewhere, a licence file.
|
||||
///
|
||||
/// A plugin's own WASI has no preopened directory. Every path outside its
|
||||
/// own `plugin-dir` is checked against its `fs.read:<path>` (reading) or
|
||||
/// `fs.write:<path>`
|
||||
/// (writing; it doesn't imply reading) grants; without one covering the path a
|
||||
/// call returns `denied` naming the capability the manifest has to declare. A
|
||||
/// file inside a project is `workspace.project.read-file` / `write-file`.
|
||||
/// `path` is absolute, or starts with `~/` for the user's home.
|
||||
interface fs {
|
||||
use types.{error};
|
||||
use workspace.{file-kind, file-stat};
|
||||
|
||||
/// The plugin's persistent private directory, created owner-only (0700,
|
||||
/// owner-only ACL on Windows), removed on uninstall. Reading and writing
|
||||
/// under it needs no fs.* grant; files created there are owner-only.
|
||||
plugin-dir: func() -> result<string, error>;
|
||||
|
||||
/// A text file, decoded as the editor decodes it (BOM and encoding
|
||||
/// detection), at most 16 MiB. Unsaved editor contents win, as they do
|
||||
/// for `project.read-file`.
|
||||
read-file: func(path: string) -> result<string, error>;
|
||||
|
||||
/// The bytes of a file (images, class files, archives), at most 16 MiB.
|
||||
read-bytes: func(path: string) -> result<list<u8>, error>;
|
||||
|
||||
/// Metadata of an existing path, as `project.stat` reports it; a missing
|
||||
/// path is `not-found`.
|
||||
stat: func(path: string) -> result<file-stat, error>;
|
||||
|
||||
/// An entry of a directory.
|
||||
record dir-entry {
|
||||
/// The entry's name, without its directory.
|
||||
name: string,
|
||||
kind: file-kind,
|
||||
}
|
||||
|
||||
/// The entries directly under a directory, sorted by name, at most 4096
|
||||
/// (like `find-files`); a file is `invalid`.
|
||||
read-dir: func(path: string) -> result<list<dir-entry>, error>;
|
||||
|
||||
/// Replaces the text of a file, or creates it, at most 16 MiB: in one step
|
||||
/// (a reader never sees half of it), keeping the file's encoding and BOM;
|
||||
/// a new file is UTF-8. `invalid` when the text can't be written in that
|
||||
/// encoding, the directory is missing, the path is a directory, or an
|
||||
/// editor holds unsaved changes for the file (save them first).
|
||||
write-file: func(path: string, text: string) -> result<_, error>;
|
||||
|
||||
/// Replaces the bytes of a file, or creates it, at most 16 MiB, in one
|
||||
/// step; fails like `write-file`.
|
||||
write-bytes: func(path: string, bytes: list<u8>) -> result<_, error>;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
/// Writes to the IDE log, tagged with the plugin id.
|
||||
interface log {
|
||||
@@ -33,9 +33,23 @@ interface ui {
|
||||
text(string),
|
||||
}
|
||||
|
||||
/// A notification button that runs one of the plugin's commands.
|
||||
record notification-action {
|
||||
/// Up to 256 bytes, one line.
|
||||
label: string,
|
||||
/// The id of a command the plugin declares.
|
||||
command: string,
|
||||
/// Passed to the command as its argument (up to 64 KiB).
|
||||
argument: option<string>,
|
||||
}
|
||||
|
||||
/// Shows a notification balloon in the window the current command or
|
||||
/// event came from (every window when there is none).
|
||||
show-notification: func(level: notification-level, title: string, body: string);
|
||||
/// `show-notification` with up to three action buttons. Choosing one
|
||||
/// dismisses the balloon and runs the command in its window. An invalid
|
||||
/// action or an undeclared command fails the call and shows nothing.
|
||||
notify: func(level: notification-level, title: string, body: string, actions: list<notification-action>) -> result<_, error>;
|
||||
/// Shows or updates the plugin's status bar item `id` in every window.
|
||||
set-status-item: func(id: string, item: status-item);
|
||||
remove-status-item: func(id: string);
|
||||
@@ -51,24 +65,36 @@ interface ui {
|
||||
copy-to-clipboard: func(text: string) -> result<_, error>;
|
||||
/// Opens an `http://` or `https://` URL in the user's default browser.
|
||||
open-url: func(url: string) -> result<_, error>;
|
||||
/// Shows a list in the window the current command or event came from and
|
||||
/// waits for the key of the chosen item, or `none` when the user dismisses
|
||||
/// it. Needs no capability. Returns `invalid` outside a command or event of
|
||||
/// a window (including in editor providers). Waiting doesn't count against
|
||||
/// the call's budget.
|
||||
/// Shows a list and waits for the chosen key, or `none` when dismissed.
|
||||
/// Works in a command/event of a window, or while resolving a selected code
|
||||
/// or file action in its editor's window; `invalid` otherwise.
|
||||
/// Needs no capability. Waiting doesn't count against the call's budget.
|
||||
pick: func(title: string, items: list<pick-item>) -> result<option<string>, error>;
|
||||
/// Native folder chooser; an absolute path, or `none` when dismissed.
|
||||
/// Only from a command or event of a window; waiting is excluded from the budget.
|
||||
pick-directory: func(title: string, initial: option<string>) -> result<option<string>, error>;
|
||||
/// Like `pick`, with any number of items chosen.
|
||||
pick-many: func(title: string, items: list<pick-item>) -> result<option<list<string>>, error>;
|
||||
/// Asks for a line of text, pre-filled with `value`; `none` when dismissed.
|
||||
/// Same rules as `pick`.
|
||||
input: func(prompt: string, value: option<string>) -> result<option<string>, error>;
|
||||
/// Asks for text over several lines, pre-filled with `value`; `none` when
|
||||
/// dismissed. Only from a command or event of a window; the dialog confirms
|
||||
/// on Cmd/Ctrl+Enter.
|
||||
input-multiline: func(prompt: string, value: option<string>) -> result<option<string>, error>;
|
||||
/// Asks for confirmation with OK and Cancel: `true` on OK, `false` on
|
||||
/// Cancel or Escape. Same rules as `pick`.
|
||||
confirm: func(title: string, body: string) -> result<bool, error>;
|
||||
/// The IDE's UI language as a BCP 47 tag (`en`, `fr`, `zh-CN`, …); it
|
||||
/// follows a change of language. For the text the plugin builds itself:
|
||||
/// the strings of its manifest and views are translated from
|
||||
/// `locales/<tag>.json`.
|
||||
locale: func() -> string;
|
||||
}
|
||||
|
||||
/// Persistent key-value storage of the plugin (survives restarts and idle
|
||||
/// reclaim; instance memory does not). Requires `storage`. At most 1 MiB.
|
||||
/// reclaim; instance memory does not). Requires `storage`. At most 64 MiB,
|
||||
/// counting UTF-8 bytes of keys and values; rejected writes preserve the data.
|
||||
interface storage {
|
||||
use types.{error};
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// Optional export (world `plugin-hover`): Markdown added to the hover of
|
||||
/// documents of the languages declared with the `hover` provider kind,
|
||||
/// including languages the plugin doesn't contribute. It shows below the
|
||||
/// language server's hover, under the edit-path budget.
|
||||
interface hover-provider {
|
||||
use types.{position, range};
|
||||
|
||||
/// The document hovered (the editor's text while it is open).
|
||||
record document {
|
||||
/// Absolute path.
|
||||
path: string,
|
||||
language: string,
|
||||
version: u64,
|
||||
text: string,
|
||||
}
|
||||
|
||||
/// What the plugin adds to the hover.
|
||||
record hover-content {
|
||||
/// At most 64 KiB.
|
||||
markdown: string,
|
||||
/// The text the hover describes; used when the server names none.
|
||||
range: option<range>,
|
||||
}
|
||||
|
||||
/// The hover at `at`, or `none` to add nothing.
|
||||
hover: func(doc: document, at: position) -> option<hover-content>;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
/// Cross-file associations a plugin publishes for the files it declares under
|
||||
/// `[[contributes.documentIndexers]]`. The host calls `index` in cancellable
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// Optional export (world `plugin-inlay-hints`): inline hints in documents of
|
||||
/// the languages declared with the `inlay-hints` provider kind, including
|
||||
/// languages the plugin doesn't contribute. They are shown next to the
|
||||
/// language server's hints.
|
||||
interface inlay-hints-provider {
|
||||
use types.{position, range};
|
||||
|
||||
/// The document the hints are for (the editor's text while it is open).
|
||||
record document {
|
||||
path: string,
|
||||
language: string,
|
||||
version: u64,
|
||||
text: string,
|
||||
}
|
||||
|
||||
/// A hint shown at `position`, before the character there.
|
||||
record inlay-hint {
|
||||
/// UTF-16 position (0-based line and column).
|
||||
position: position,
|
||||
/// The text shown, e.g. `GET /orders` or `: string`.
|
||||
label: string,
|
||||
/// `type` or `parameter` follow the Inlay Hints settings of that kind;
|
||||
/// anything else counts as `other`.
|
||||
kind: string,
|
||||
/// Shown when the pointer rests on the hint.
|
||||
tooltip: option<string>,
|
||||
/// A space before the label.
|
||||
padding-left: bool,
|
||||
/// A space after the label.
|
||||
padding-right: bool,
|
||||
}
|
||||
|
||||
/// The hints within `range` (the visible part of the document), under the
|
||||
/// edit-path budget. Hints outside `range` are dropped; at most 10,000 per
|
||||
/// call.
|
||||
inlay-hints: func(doc: document, range: range) -> list<inlay-hint>;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
/// Problems in files, shown in the editor and the Problems view.
|
||||
interface diagnostics {
|
||||
@@ -75,8 +75,10 @@ interface secrets {
|
||||
is-set: func(name: string) -> bool;
|
||||
}
|
||||
|
||||
/// One-off runs of programs granted with `process:<program>` (the file the
|
||||
/// user approved, checked before every run).
|
||||
/// Runs of programs granted with `process:<program>` (the file the user
|
||||
/// approved, checked before every run): once and awaited with `run`, once
|
||||
/// with an environment with `run-command`, or kept running behind a `child`
|
||||
/// handle started with `start`.
|
||||
interface process {
|
||||
use types.{error};
|
||||
use workspace.{project};
|
||||
@@ -89,8 +91,56 @@ interface process {
|
||||
stderr: string,
|
||||
}
|
||||
|
||||
/// What to run (API 1.3). `env` only adds variables: an existing name in
|
||||
/// the prepared child environment (including the login-shell PATH) is an
|
||||
/// error naming that key; nothing is replaced or removed. Names compare
|
||||
/// case-insensitively on Windows. At most 64 entries, nonempty names of
|
||||
/// at most 256 bytes without '=' or NUL, values at most 4 KiB without NUL.
|
||||
record command {
|
||||
program: string,
|
||||
args: list<string>,
|
||||
env: list<tuple<string, string>>,
|
||||
}
|
||||
|
||||
/// What a kept-running program printed since the last call, and its exit
|
||||
/// code once it ended (`none` while it still runs).
|
||||
record chunk {
|
||||
/// Up to 1 MiB per stream; unpolled output keeps the last 1 MiB.
|
||||
/// `poll` takes up to `max-bytes`, or one whole character when that
|
||||
/// limit is smaller. Incomplete characters wait for the next read.
|
||||
stdout: string,
|
||||
stderr: string,
|
||||
status: option<s32>,
|
||||
}
|
||||
|
||||
/// A program left running. Dropping the handle kills it if it still
|
||||
/// runs, so a plugin cannot leak one; a plugin has at most 8 at a time
|
||||
/// (the ninth `start` is `invalid`). They also end with the plugin:
|
||||
/// stopping, disabling or reclaiming it kills what it started.
|
||||
resource child {
|
||||
/// What it printed since the last call, and its status once it ends.
|
||||
poll: func(max-bytes: u32) -> result<chunk, error>;
|
||||
/// Waits up to `timeout-ms` for it to end (0 only checks), then
|
||||
/// reports what it printed since the last call.
|
||||
wait: func(timeout-ms: u32) -> result<chunk, error>;
|
||||
/// Writes to its stdin; fails once it ended or stdin was closed.
|
||||
write: func(text: string) -> result<_, error>;
|
||||
/// Closes stdin; fails once the program ended.
|
||||
close-stdin: func() -> result<_, error>;
|
||||
/// Kills it and reaps it, so its status is available afterwards.
|
||||
kill: func() -> result<_, error>;
|
||||
}
|
||||
|
||||
/// Runs `program` with `args` in `cwd`'s root (else the plugin's data
|
||||
/// directory) and waits; cancelled with the task or call. Call it inside
|
||||
/// a task for anything slow.
|
||||
run: func(program: string, args: list<string>, cwd: option<borrow<project>>, stdin: option<string>) -> result<output, error>;
|
||||
|
||||
/// The same as `run`, with append-only environment variables (API 1.3).
|
||||
run-command: func(cmd: command, cwd: option<borrow<project>>, stdin: option<string>) -> result<output, error>;
|
||||
|
||||
/// Starts `cmd` with piped stdin and stdout/stderr, and returns the
|
||||
/// handle to it without waiting (API 1.3). Closing the invoking window
|
||||
/// also ends its processes.
|
||||
start: func(cmd: command, cwd: option<borrow<project>>) -> result<child, error>;
|
||||
}
|
||||
@@ -3,20 +3,23 @@
|
||||
/// API"); a 2.0 keeps 1.0 running through an adapter in the host.
|
||||
///
|
||||
/// A plugin is a WebAssembly component targeting the `plugin` world (or
|
||||
/// `plugin-syntax`). It runs sandboxed: no filesystem, network, environment
|
||||
/// or processes beyond WASI's clocks and randomness; everything else goes
|
||||
/// through the imports below, gated by the capabilities granted in
|
||||
/// `plugin.toml` (a missing one returns `error::denied`).
|
||||
package openidea:[email protected];
|
||||
/// `plugin-syntax`). It runs sandboxed: no file system, network, environment
|
||||
/// or processes beyond WASI's clocks and randomness; files are read through
|
||||
/// `fs` and `workspace`, and everything else goes through the imports below,
|
||||
/// gated by the capabilities granted in `plugin.toml` (a missing one returns
|
||||
/// `error::denied`).
|
||||
package openidea:[email protected];
|
||||
|
||||
world plugin {
|
||||
import log;
|
||||
import ui;
|
||||
import storage;
|
||||
import fs;
|
||||
import workspace;
|
||||
import editor;
|
||||
import invocation;
|
||||
import vcs;
|
||||
import commit;
|
||||
import events;
|
||||
import tasks;
|
||||
import diagnostics;
|
||||
@@ -56,6 +59,43 @@ world plugin-indexing {
|
||||
export document-indexer;
|
||||
}
|
||||
|
||||
/// A plugin with semantic tokens (`semantic-tokens` under `[[contributes.providers]]`).
|
||||
world plugin-semantic-tokens {
|
||||
include plugin;
|
||||
export semantic-tokens-provider;
|
||||
}
|
||||
|
||||
/// A plugin adding to hovers (`hover` under `[[contributes.providers]]`).
|
||||
world plugin-hover {
|
||||
include plugin;
|
||||
export hover-provider;
|
||||
}
|
||||
|
||||
/// A plugin with inlay hints (`inlay-hints` under `[[contributes.providers]]`).
|
||||
world plugin-inlay-hints {
|
||||
include plugin;
|
||||
export inlay-hints-provider;
|
||||
}
|
||||
|
||||
/// A plugin whose views show in the Services tool window
|
||||
/// (`location = "services"`): their nodes' detail pane.
|
||||
world plugin-details {
|
||||
include plugin;
|
||||
export detail-provider;
|
||||
}
|
||||
|
||||
/// A plugin with before-commit checks (`[[contributes.commitChecks]]`).
|
||||
world plugin-commit-checks {
|
||||
include plugin;
|
||||
export commit-checker;
|
||||
}
|
||||
|
||||
/// A plugin with file-changing code actions (`file-actions`, next to `[[contributes.providers]]`).
|
||||
world plugin-file-actions {
|
||||
include plugin;
|
||||
export file-actions;
|
||||
}
|
||||
|
||||
/// Only the `syntax-provider` export: guests generate it next to `plugin`
|
||||
/// (the component tools merge both into one component).
|
||||
world syntax {
|
||||
@@ -76,3 +116,55 @@ world views-provider {
|
||||
world indexing {
|
||||
export document-indexer;
|
||||
}
|
||||
|
||||
/// Only the `semantic-tokens-provider` export, generated next to `plugin` like `syntax`.
|
||||
world semantic-tokens {
|
||||
export semantic-tokens-provider;
|
||||
}
|
||||
|
||||
/// Only the `hover-provider` export, generated next to `plugin` like `syntax`.
|
||||
world hover {
|
||||
export hover-provider;
|
||||
}
|
||||
|
||||
/// Only the `inlay-hints-provider` export, generated next to `plugin` like `syntax`.
|
||||
world inlay-hints {
|
||||
export inlay-hints-provider;
|
||||
}
|
||||
|
||||
/// Only the `detail-provider` export, generated next to `plugin` like `syntax`.
|
||||
world details {
|
||||
export detail-provider;
|
||||
}
|
||||
|
||||
/// Only the `commit-checker` export, generated next to `plugin` like `syntax`.
|
||||
world commit-checks {
|
||||
export commit-checker;
|
||||
}
|
||||
|
||||
/// Only the `file-actions` export, generated next to `plugin` like `syntax`.
|
||||
world file-actions-provider {
|
||||
export file-actions;
|
||||
}
|
||||
|
||||
/// A plugin with project HTTP endpoints (`[[contributes.endpoints]]`).
|
||||
world plugin-endpoints {
|
||||
include plugin;
|
||||
export endpoints-provider;
|
||||
}
|
||||
|
||||
/// Only the `endpoints-provider` export, generated next to `plugin` like `syntax`.
|
||||
world endpoints {
|
||||
export endpoints-provider;
|
||||
}
|
||||
|
||||
/// A plugin with diagnostics under `[[contributes.providers]]`.
|
||||
world plugin-diagnostics {
|
||||
include plugin;
|
||||
export diagnostics-provider;
|
||||
}
|
||||
|
||||
/// `diagnostics` is already the released host interface name.
|
||||
world editor-diagnostics {
|
||||
export diagnostics-provider;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
/// Editor features a plugin provides for the languages it declares under
|
||||
/// `[[contributes.providers]]` (the host calls only declared kinds). They run
|
||||
@@ -75,6 +75,9 @@ interface providers {
|
||||
code-actions: func(doc: document, selection: range) -> list<code-action>;
|
||||
/// The edits of an action `code-actions` returned with `data`, when the
|
||||
/// user picks it (the command budget applies, not the editor's 50 ms).
|
||||
/// `ui.pick`, `pick-many`, `input` and `confirm` ask in the editor's window;
|
||||
/// waiting is excluded from the budget. Other command/event-only APIs
|
||||
/// remain unavailable.
|
||||
resolve-code-action: func(doc: document, action: code-action) -> result<code-action, error>;
|
||||
definition: func(doc: document, at: position) -> list<location>;
|
||||
line-markers: func(doc: document) -> list<line-marker>;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package openidea:[email protected];
|
||||
|
||||
/// Optional export (world `plugin-semantic-tokens`): semantic colouring of
|
||||
/// documents of the languages declared with the `semantic-tokens` provider
|
||||
/// kind, including languages the plugin doesn't contribute. The tokens join
|
||||
/// the language server's and win where they overlap one.
|
||||
interface semantic-tokens-provider {
|
||||
use types.{range};
|
||||
|
||||
/// The document to colour (the editor's text while it is open).
|
||||
record document {
|
||||
/// Absolute path.
|
||||
path: string,
|
||||
language: string,
|
||||
version: u64,
|
||||
text: string,
|
||||
}
|
||||
|
||||
/// A token: part of one line.
|
||||
record semantic-token {
|
||||
range: range,
|
||||
/// An LSP token type in kebab-case (`method`, `property`, `type`, …).
|
||||
kind: string,
|
||||
/// LSP token modifiers in kebab-case (`static`, `deprecated`, …).
|
||||
modifiers: list<string>,
|
||||
}
|
||||
|
||||
/// The document's tokens, at most 65,536; asked again after each edit,
|
||||
/// under the edit-path budget.
|
||||
semantic-tokens: func(doc: document) -> list<semantic-token>;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
/// Shared types. Positions are 0-based lines and UTF-16 code unit columns,
|
||||
/// as in the editor and LSP.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
/// Declarative views: tool windows declared
|
||||
/// under `[[contributes.views]]` and custom editors under
|
||||
@@ -123,6 +123,7 @@ interface view-types {
|
||||
/// What a plugin's code can ask of its views.
|
||||
interface views {
|
||||
use types.{error};
|
||||
use detail-types.{process-log};
|
||||
|
||||
/// The view (or every custom editor of that id) shows outdated content:
|
||||
/// the IDE renders it again.
|
||||
@@ -136,9 +137,18 @@ interface views {
|
||||
/// `program` (pinned by a `process:<program>` grant) with `args` in the
|
||||
/// project root: long-running output (logs) and interactive sessions.
|
||||
open-terminal: func(title: string, program: string, args: list<string>) -> result<_, error>;
|
||||
/// Opens a read-only log tab in the editor area of the window the call
|
||||
/// came from, following `log`'s program (pinned by a `process:<program>`
|
||||
/// grant) in the project root, its toggles above the output: the tab a
|
||||
/// web view opens with `open-log-tab`. Reopening `key` focuses that tab.
|
||||
/// Only from a command or event of a window; `title` at most 256
|
||||
/// characters, `key` 128, at most 32 toggles.
|
||||
open-log-tab: func(key: string, title: string, log: process-log) -> result<_, error>;
|
||||
/// Opens `path` (project-relative or absolute, inside the project) in an
|
||||
/// editor of the window the call came from, the caret at `line` and
|
||||
/// `column` (0-based; UTF-16 column): a view's links to code.
|
||||
/// An absolute path inside the plugin's own fs.plugin-dir also works,
|
||||
/// without project.read or an open project, from a command or event.
|
||||
open-location: func(path: string, line: u32, column: u32) -> result<_, error>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,43 @@
|
||||
package openidea:plugin@1.2.0;
|
||||
package openidea:plugin@1.3.0;
|
||||
|
||||
interface workspace {
|
||||
use types.{error};
|
||||
use types.{error, location};
|
||||
|
||||
/// Requests File > Open in this command/event's window (or a new window),
|
||||
/// including the usual project trust prompt. Needs no capability.
|
||||
/// `path` is an absolute directory path on the UI machine.
|
||||
open-project: func(path: string, new-window: bool) -> result<_, error>;
|
||||
|
||||
/// The open project containing an absolute document path, or `none`.
|
||||
/// Reading the returned project still requires `project.read`.
|
||||
project-of: func(path: string) -> option<project>;
|
||||
|
||||
/// What a path inside a project is.
|
||||
enum file-kind {
|
||||
file,
|
||||
directory,
|
||||
symlink,
|
||||
other,
|
||||
}
|
||||
|
||||
/// Metadata of a path inside a project, as `stat` reports it.
|
||||
record file-stat {
|
||||
kind: file-kind,
|
||||
/// Bytes, for a file.
|
||||
size: u64,
|
||||
/// Seconds since the Unix epoch; `none` when the file system does
|
||||
/// not track it.
|
||||
modified: option<u64>,
|
||||
}
|
||||
|
||||
/// A symbol in the host's current in-memory project index (new in 1.3).
|
||||
record symbol-info {
|
||||
name: string,
|
||||
/// Host symbol kind, in camelCase (`class`, `method`, `enumMember`, …).
|
||||
kind: string,
|
||||
container: option<string>,
|
||||
location: location,
|
||||
}
|
||||
|
||||
/// A project open in the IDE.
|
||||
resource project {
|
||||
@@ -9,12 +45,40 @@ interface workspace {
|
||||
root: func() -> result<string, error>;
|
||||
/// Reads a UTF-8 text file inside the project (absolute, or relative
|
||||
/// to the root); paths leaving the root are refused. Unsaved editor
|
||||
/// contents win over the disk. Requires `project.read`.
|
||||
/// contents win over the disk. A missing path is `not-found`.
|
||||
/// Requires `project.read`.
|
||||
read-file: func(path: string) -> result<string, error>;
|
||||
/// Replaces the text of a file inside the project (absolute, or
|
||||
/// relative to the root), or creates it with missing parent
|
||||
/// directories; paths leaving the root are refused. Written in one
|
||||
/// step (a reader never sees half of it), keeping the file's encoding
|
||||
/// and BOM; a new file is UTF-8. An editor holding unsaved changes for
|
||||
/// the file makes it `invalid` (save them first). Requires
|
||||
/// `project.write`.
|
||||
write-file: func(path: string, text: string) -> result<_, error>;
|
||||
/// Whether `path` (absolute, or relative to the root) names an
|
||||
/// existing file or directory — including hidden and ignored ones,
|
||||
/// without reading any content. Paths leaving the root are refused.
|
||||
/// Requires `project.read`.
|
||||
exists: func(path: string) -> result<bool, error>;
|
||||
/// Metadata of an existing path inside the project (absolute, or
|
||||
/// relative to the root); a missing path is `not-found` and paths
|
||||
/// leaving the root are refused. Requires `project.read`.
|
||||
stat: func(path: string) -> result<file-stat, error>;
|
||||
/// Project files whose root-relative path matches `glob` (`**/*Mapper.xml`),
|
||||
/// at most `limit`, as absolute paths. Ignored and excluded files are
|
||||
/// skipped. Requires `project.read`.
|
||||
find-files: func(glob: string, limit: u32) -> result<list<string>, error>;
|
||||
/// Fuzzy symbol search (CamelHump and container-qualified queries) over the
|
||||
/// current index only; never starts or waits for a language server. Results
|
||||
/// may be incomplete while indexing and ranges reflect the indexed text,
|
||||
/// not necessarily unsaved edits. Empty queries return no symbols. Queries
|
||||
/// over 256 UTF-8 bytes are invalid; limit is capped at 1000 (zero is
|
||||
/// empty). Only paths readable under the root are returned; external
|
||||
/// content roots are excluded. Cancellation returns cancelled; exceeding
|
||||
/// the current call's deadline fails. A closed project is not-found.
|
||||
/// Requires `project.read`.
|
||||
symbols: func(query: string, limit: u32) -> result<list<symbol-info>, error>;
|
||||
}
|
||||
|
||||
/// Projects open in any window. Requires `project.read`.
|
||||
|
||||
|
До Ширина: | Висота: | Розмір: 2.3 KiB Після Ширина: | Висота: | Розмір: 2.6 KiB |
|
До Ширина: | Висота: | Розмір: 4.4 KiB Після Ширина: | Висота: | Розмір: 4.9 KiB |
|
До Ширина: | Висота: | Розмір: 677 B Після Ширина: | Висота: | Розмір: 718 B |
|
До Ширина: | Висота: | Розмір: 2.2 KiB Після Ширина: | Висота: | Розмір: 2.6 KiB |
|
До Ширина: | Висота: | Розмір: 3.0 KiB Після Ширина: | Висота: | Розмір: 3.5 KiB |
|
До Ширина: | Висота: | Розмір: 3.1 KiB Після Ширина: | Висота: | Розмір: 3.6 KiB |
|
До Ширина: | Висота: | Розмір: 5.7 KiB Після Ширина: | Висота: | Розмір: 6.7 KiB |
|
До Ширина: | Висота: | Розмір: 802 B Після Ширина: | Висота: | Розмір: 876 B |
|
До Ширина: | Висота: | Розмір: 6.2 KiB Після Ширина: | Висота: | Розмір: 7.2 KiB |
|
До Ширина: | Висота: | Розмір: 1.1 KiB Після Ширина: | Висота: | Розмір: 1.2 KiB |
|
До Ширина: | Висота: | Розмір: 1.5 KiB Після Ширина: | Висота: | Розмір: 1.8 KiB |
|
До Ширина: | Висота: | Розмір: 1.9 KiB Після Ширина: | Висота: | Розмір: 2.2 KiB |
|
До Ширина: | Висота: | Розмір: 1.2 KiB Після Ширина: | Висота: | Розмір: 1.3 KiB |
|
До Ширина: | Висота: | Розмір: 11 KiB Після Ширина: | Висота: | Розмір: 13 KiB |
|
До Ширина: | Висота: | Розмір: 8.8 KiB Після Ширина: | Висота: | Розмір: 9.9 KiB |
@@ -1 +1,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 100 100" role="img" aria-label="OpenIDEA"><g transform="translate(50 50) scale(1.8) translate(-50 -52)"><rect x="22" y="26" width="56" height="52" rx="12" fill="#D9582C"/><rect x="27" y="26" width="46" height="42" rx="9" fill="#1B1A1A"/><g transform="translate(50 46) scale(1.35) translate(-50 -46)"><circle cx="44" cy="47.4" r="4.1" fill="none" stroke="#EAE7E0" stroke-width="2.7"/><rect x="54.3" y="42" width="2.8" height="10.5" fill="#EAE7E0"/><rect x="51.2" y="42" width="5.9" height="2.5" fill="#EAE7E0"/><rect x="51.2" y="50" width="9.4" height="2.5" fill="#EAE7E0"/><circle cx="55.7" cy="38.4" r="1.8" fill="#EAE7E0"/></g></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 100 100" role="img" aria-label="OpenIDEA">
|
||||
<rect x="2" y="2" width="96" height="96" rx="22" fill="#EAE7E0"/>
|
||||
<g transform="translate(50 50) scale(1.5) translate(-50 -52)">
|
||||
<rect x="22" y="26" width="56" height="52" rx="12" fill="#D9582C"/>
|
||||
<rect x="27" y="26" width="46" height="42" rx="9" fill="#1B1A1A"/>
|
||||
<g transform="translate(50 46) scale(1.35) translate(-50 -46)">
|
||||
<circle cx="44" cy="47.4" r="4.1" fill="none" stroke="#EAE7E0" stroke-width="2.7"/>
|
||||
<rect x="54.3" y="42" width="2.8" height="10.5" fill="#EAE7E0"/>
|
||||
<rect x="51.2" y="42" width="5.9" height="2.5" fill="#EAE7E0"/>
|
||||
<rect x="51.2" y="50" width="9.4" height="2.5" fill="#EAE7E0"/>
|
||||
<circle cx="55.7" cy="38.4" r="1.8" fill="#EAE7E0"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
До Ширина: | Висота: | Розмір: 720 B Після Ширина: | Висота: | Розмір: 850 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 100 100" role="img" aria-label="OpenIDEA"><g transform="translate(50 50) scale(1.55) translate(-50 -52)"><rect x="22" y="26" width="56" height="52" rx="12" fill="#D9582C"/><rect x="27" y="26" width="46" height="42" rx="9" fill="#1B1A1A"/><circle cx="44" cy="47.4" r="4.1" fill="none" stroke="#EAE7E0" stroke-width="2.7"/><rect x="54.3" y="42" width="2.8" height="10.5" fill="#EAE7E0"/><rect x="51.2" y="42" width="5.9" height="2.5" fill="#EAE7E0"/><rect x="51.2" y="50" width="9.4" height="2.5" fill="#EAE7E0"/><circle cx="55.7" cy="38.4" r="1.8" fill="#EAE7E0"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 100 100" role="img" aria-label="OpenIDEA"><rect x="10" y="10" width="80" height="80" rx="18" fill="#EAE7E0"/><g transform="translate(50 50) scale(1.25) translate(-50 -52)"><rect x="22" y="26" width="56" height="52" rx="12" fill="#D9582C"/><rect x="27" y="26" width="46" height="42" rx="9" fill="#1B1A1A"/><circle cx="44" cy="47.4" r="4.1" fill="none" stroke="#EAE7E0" stroke-width="2.7"/><rect x="54.3" y="42" width="2.8" height="10.5" fill="#EAE7E0"/><rect x="51.2" y="42" width="5.9" height="2.5" fill="#EAE7E0"/><rect x="51.2" y="50" width="9.4" height="2.5" fill="#EAE7E0"/><circle cx="55.7" cy="38.4" r="1.8" fill="#EAE7E0"/></g></svg>
|
||||
|
До Ширина: | Висота: | Розмір: 654 B Після Ширина: | Висота: | Розмір: 721 B |
@@ -9,7 +9,7 @@ use specta::Type;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use tauri::ipc::Channel;
|
||||
use tauri::{AppHandle, State, WebviewWindow};
|
||||
use tauri::{AppHandle, State, WebviewWindow, Window};
|
||||
|
||||
/// Opens `path` in a new window (`new_window`) or tells the caller to open it
|
||||
/// itself (`current`). A project already open in some window is focused instead.
|
||||
@@ -211,8 +211,18 @@ pub struct CloseContext {
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn window_close_context(app: AppHandle, windows: State<'_, WindowsState>) -> CloseContext {
|
||||
CloseContext { quitting: windows.quitting(), windows: windows::project_window_labels(&app).len() as u32 }
|
||||
pub fn window_close_context(app: AppHandle, window: Window, windows: State<'_, WindowsState>) -> CloseContext {
|
||||
let all = windows::project_window_labels(&app);
|
||||
let pending: Vec<String> = windows::sorted_labels(
|
||||
windows.pending_closes().iter().map(String::as_str).filter(|l| all.iter().any(|a| a == l)),
|
||||
);
|
||||
// Members of a tab group asking to close together are one window closing: the first of them
|
||||
// is the last window left (it returns to the welcome screen); the others just close.
|
||||
let count = match pending.first() {
|
||||
Some(keeper) if pending.len() > 1 && keeper == window.label() => all.len() - pending.len() + 1,
|
||||
_ => all.len(),
|
||||
};
|
||||
CloseContext { quitting: windows.quitting(), windows: count as u32 }
|
||||
}
|
||||
|
||||
/// Quits: closes every window, each of which runs its own unsaved-changes check.
|
||||
|
||||
@@ -205,8 +205,13 @@ pub fn run() {
|
||||
Ok(())
|
||||
})
|
||||
.on_window_event(|window, event| match event {
|
||||
#[cfg(target_os = "linux")]
|
||||
tauri::WindowEvent::CloseRequested { .. } => linux_window_state::save_before_close(window.app_handle()),
|
||||
tauri::WindowEvent::CloseRequested { .. } => {
|
||||
#[cfg(target_os = "linux")]
|
||||
linux_window_state::save_before_close(window.app_handle());
|
||||
if let Some(w) = window.try_state::<WindowsState>() {
|
||||
w.close_requested(window.label());
|
||||
}
|
||||
}
|
||||
tauri::WindowEvent::Focused(true) => {
|
||||
application_focus::changed(window.app_handle(), true);
|
||||
if let Some(w) = window.try_state::<WindowsState>() {
|
||||
|
||||
@@ -214,6 +214,7 @@ pub fn close_tabs(app: &AppHandle, caller: &str, keep: &str, labels: Vec<String>
|
||||
/// The closing tab's project vetoed (its unsaved-changes prompt was cancelled): leave the rest open.
|
||||
pub fn cancel_close(app: &AppHandle, caller: &str) {
|
||||
let state = app.state::<WindowsState>();
|
||||
state.close_settled(caller);
|
||||
let mut batch = state.tab_closes.lock();
|
||||
if batch.as_ref().is_some_and(|b| b.pending.front().is_some_and(|l| l == caller)) {
|
||||
*batch = None;
|
||||
|
||||
@@ -140,6 +140,9 @@ pub struct WindowsState {
|
||||
last_focused: Mutex<Option<String>>,
|
||||
/// Set by Quit while windows close one by one.
|
||||
quitting: AtomicBool,
|
||||
/// Windows asked to close whose guards have not finished. AppKit closes a whole tab group at
|
||||
/// once, so its members ask together.
|
||||
close_requests: Mutex<Vec<String>>,
|
||||
/// Project tabs closing one by one (Close Other Tabs and friends).
|
||||
pub tab_closes: Mutex<Option<crate::window_groups::TabCloses>>,
|
||||
/// Relaunch once the quit completes (after installing an update).
|
||||
@@ -149,6 +152,21 @@ pub struct WindowsState {
|
||||
}
|
||||
|
||||
impl WindowsState {
|
||||
pub fn close_requested(&self, label: &str) {
|
||||
let mut requests = self.close_requests.lock();
|
||||
if !requests.iter().any(|l| l == label) {
|
||||
requests.push(label.to_owned());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close_settled(&self, label: &str) {
|
||||
self.close_requests.lock().retain(|l| l != label);
|
||||
}
|
||||
|
||||
pub fn pending_closes(&self) -> Vec<String> {
|
||||
self.close_requests.lock().clone()
|
||||
}
|
||||
|
||||
pub fn set_launch(&self, label: &str, launch: Launch) {
|
||||
self.launches.lock().insert(label.to_owned(), launch);
|
||||
}
|
||||
@@ -187,6 +205,7 @@ impl WindowsState {
|
||||
}
|
||||
|
||||
pub fn forget(&self, label: &str) {
|
||||
self.close_settled(label);
|
||||
self.launches.lock().remove(label);
|
||||
let mut last = self.last_focused.lock();
|
||||
if last.as_deref() == Some(label) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "OpenIDEA",
|
||||
"version": "0.1.38",
|
||||
"version": "0.1.39",
|
||||
"identifier": "ai.l0ng.openidea",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
@@ -189,6 +189,7 @@ async function onCloseRequested(deps: CloseDeps): Promise<boolean> {
|
||||
// screen (to open another one); closing the welcome screen, or quitting, closes the window.
|
||||
if (!ctx.quitting && ctx.windows <= 1 && (s.project || s.lightEdit)) {
|
||||
if (await confirmLeave(deps)) await closeProject();
|
||||
await commands.windowGroupCancelClose();
|
||||
return false;
|
||||
}
|
||||
const confirmTerminate = workflowSettings().run.confirmTerminate;
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { fuzzyMatch } from "@/ui";
|
||||
import { notifications } from "@/workbench/contributions";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { openRemoteProject } from "@/workbench/projectWindow";
|
||||
|
||||
interface RecentState {
|
||||
@@ -115,6 +116,14 @@ export async function removeRecent(path: string) {
|
||||
notifications().notify({ level: "error", title: "Cannot remove recent project", body: r.error.message });
|
||||
}
|
||||
|
||||
/** An open failure's kind and message, whether it is an `IpcError` or a raw rejected invoke. */
|
||||
function failure(e: unknown): { kind?: string; message: string } {
|
||||
if (e instanceof IpcError) return { kind: e.kind, message: e.message };
|
||||
if (e && typeof e === "object" && "message" in e)
|
||||
return { kind: (e as { kind?: string }).kind, message: String((e as { message: unknown }).message) };
|
||||
return { message: e instanceof Error ? e.message : String(e) };
|
||||
}
|
||||
|
||||
/** Opens a project from the recent list; offers to remove entries whose folder is gone. */
|
||||
export async function openRecent(project: Pick<RecentProject, "path" | "name">): Promise<boolean> {
|
||||
if (!isTauri()) {
|
||||
@@ -140,12 +149,21 @@ export async function openRecent(project: Pick<RecentProject, "path" | "name">):
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (isCancelled(e)) return false;
|
||||
const message = e instanceof Error ? e.message : String(e);
|
||||
const missing = e instanceof IpcError ? e.kind === "notFound" : /not found|no such/i.test(message);
|
||||
const { kind, message } = failure(e);
|
||||
if (kind === "notFound" || (!kind && /not found|no such/i.test(message))) {
|
||||
// A balloon can be switched off for this group and the welcome screen has no log to open.
|
||||
const remove = await confirm({
|
||||
title: tx`Project folder not found: ${project.name}`,
|
||||
message: project.path,
|
||||
ok: "Remove from Recent Projects",
|
||||
});
|
||||
if (remove) await removeRecent(project.path);
|
||||
return false;
|
||||
}
|
||||
notifications().notify({
|
||||
level: "error",
|
||||
title: missing ? `Project folder not found: ${project.name}` : `Cannot open ${project.name}`,
|
||||
body: missing ? project.path : message,
|
||||
title: `Cannot open ${project.name}`,
|
||||
body: message,
|
||||
key: `welcome.open:${project.path}`,
|
||||
actions: [{ label: "Remove from Recent Projects", run: () => void removeRecent(project.path) }],
|
||||
});
|
||||
|
||||