diff --git a/Cargo.lock b/Cargo.lock index 26c8f63b..d0486331 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4106,7 +4106,7 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" [[package]] name = "ide-agent" -version = "0.1.37" +version = "0.1.38" dependencies = [ "dunce", "encoding_rs", @@ -4129,7 +4129,7 @@ dependencies = [ [[package]] name = "ide-analysis" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ast-grep-core", "ide-core", @@ -4143,7 +4143,7 @@ dependencies = [ [[package]] name = "ide-android" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "serde", @@ -4154,7 +4154,7 @@ dependencies = [ [[package]] name = "ide-build" -version = "0.1.37" +version = "0.1.38" dependencies = [ "blake3", "dirs 6.0.0", @@ -4170,7 +4170,7 @@ dependencies = [ [[package]] name = "ide-clipboard" -version = "0.1.37" +version = "0.1.38" dependencies = [ "objc2 0.6.5", "objc2-app-kit 0.3.2", @@ -4179,7 +4179,7 @@ dependencies = [ [[package]] name = "ide-core" -version = "0.1.37" +version = "0.1.38" dependencies = [ "dunce", "encoding_rs", @@ -4196,7 +4196,7 @@ dependencies = [ [[package]] name = "ide-coverage" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "ide-run", @@ -4210,7 +4210,7 @@ dependencies = [ [[package]] name = "ide-dap" -version = "0.1.37" +version = "0.1.38" dependencies = [ "futures", "ide-core", @@ -4230,7 +4230,7 @@ dependencies = [ [[package]] name = "ide-db" -version = "0.1.37" +version = "0.1.38" dependencies = [ "bb8", "dirs 6.0.0", @@ -4257,7 +4257,7 @@ dependencies = [ [[package]] name = "ide-docker" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "serde", @@ -4270,7 +4270,7 @@ dependencies = [ [[package]] name = "ide-extension" -version = "0.1.37" +version = "0.1.38" dependencies = [ "base64 0.22.1", "blake3", @@ -4290,7 +4290,7 @@ dependencies = [ [[package]] name = "ide-fonts" -version = "0.1.37" +version = "0.1.38" dependencies = [ "objc2-core-foundation", "objc2-core-text", @@ -4302,7 +4302,7 @@ dependencies = [ [[package]] name = "ide-github" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "ide-vcs", @@ -4315,7 +4315,7 @@ dependencies = [ [[package]] name = "ide-host" -version = "0.1.37" +version = "0.1.38" dependencies = [ "base64 0.22.1", "criterion", @@ -4376,7 +4376,7 @@ dependencies = [ [[package]] name = "ide-http" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "parking_lot", @@ -4394,7 +4394,7 @@ dependencies = [ [[package]] name = "ide-index" -version = "0.1.37" +version = "0.1.38" dependencies = [ "blake3", "criterion", @@ -4416,7 +4416,7 @@ dependencies = [ [[package]] name = "ide-jsonrpc" -version = "0.1.37" +version = "0.1.38" dependencies = [ "encoding_rs", "futures", @@ -4433,7 +4433,7 @@ dependencies = [ [[package]] name = "ide-language" -version = "0.1.37" +version = "0.1.38" dependencies = [ "blake3", "criterion", @@ -4489,7 +4489,7 @@ dependencies = [ [[package]] name = "ide-lsp" -version = "0.1.37" +version = "0.1.38" dependencies = [ "dunce", "futures", @@ -4515,7 +4515,7 @@ dependencies = [ [[package]] name = "ide-notebook" -version = "0.1.37" +version = "0.1.38" dependencies = [ "futures", "ide-core", @@ -4538,7 +4538,7 @@ dependencies = [ [[package]] name = "ide-plugin" -version = "0.1.37" +version = "0.1.38" dependencies = [ "blake3", "ide-core", @@ -4559,7 +4559,7 @@ dependencies = [ [[package]] name = "ide-profiler" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "ide-run", @@ -4572,7 +4572,7 @@ dependencies = [ [[package]] name = "ide-remote" -version = "0.1.37" +version = "0.1.38" dependencies = [ "globset", "ide-core", @@ -4590,7 +4590,7 @@ dependencies = [ [[package]] name = "ide-run" -version = "0.1.37" +version = "0.1.38" dependencies = [ "dunce", "encoding_rs", @@ -4613,7 +4613,7 @@ dependencies = [ [[package]] name = "ide-sdk" -version = "0.1.37" +version = "0.1.38" dependencies = [ "dunce", "ide-core", @@ -4632,7 +4632,7 @@ dependencies = [ [[package]] name = "ide-search" -version = "0.1.37" +version = "0.1.38" dependencies = [ "criterion", "globset", @@ -4652,7 +4652,7 @@ dependencies = [ [[package]] name = "ide-spell" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "parking_lot", @@ -4665,7 +4665,7 @@ dependencies = [ [[package]] name = "ide-ssh" -version = "0.1.37" +version = "0.1.38" dependencies = [ "dirs 6.0.0", "flate2", @@ -4687,7 +4687,7 @@ dependencies = [ [[package]] name = "ide-syntax" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "ide-language", @@ -4702,7 +4702,7 @@ dependencies = [ [[package]] name = "ide-terminal" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "libc", @@ -4715,7 +4715,7 @@ dependencies = [ [[package]] name = "ide-text" -version = "0.1.37" +version = "0.1.38" dependencies = [ "criterion", "ide-core", @@ -4728,7 +4728,7 @@ dependencies = [ [[package]] name = "ide-tools" -version = "0.1.37" +version = "0.1.38" dependencies = [ "flate2", "hex", @@ -4749,7 +4749,7 @@ dependencies = [ [[package]] name = "ide-vcs" -version = "0.1.37" +version = "0.1.38" dependencies = [ "blake3", "dunce", @@ -4770,7 +4770,7 @@ dependencies = [ [[package]] name = "ide-vfs" -version = "0.1.37" +version = "0.1.38" dependencies = [ "chardetng", "dunce", @@ -4792,7 +4792,7 @@ dependencies = [ [[package]] name = "ide-web" -version = "0.1.37" +version = "0.1.38" dependencies = [ "ide-core", "open", @@ -4808,7 +4808,7 @@ dependencies = [ [[package]] name = "ide-workspace" -version = "0.1.37" +version = "0.1.38" dependencies = [ "blake3", "dunce", @@ -6357,7 +6357,7 @@ dependencies = [ [[package]] name = "openidea" -version = "0.1.37" +version = "0.1.38" dependencies = [ "base64 0.22.1", "blake3", diff --git a/Cargo.toml b/Cargo.toml index 04da822d..73910c92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = ["crates/*", "src-tauri"] exclude = ["sdk", "plugins"] [workspace.package] -version = "0.1.37" +version = "0.1.38" edition = "2024" rust-version = "1.96" license = "Apache-2.0" diff --git a/package.json b/package.json index 82767df5..1fb159a4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "openidea", "private": true, "description": "An open-source IDE inspired by IntelliJ IDEA", - "version": "0.1.37", + "version": "0.1.38", "license": "Apache-2.0", "type": "module", "scripts": { diff --git a/sdk/rust/openidea-plugin/tests/api/released/events.wit b/sdk/rust/openidea-plugin/tests/api/released/events.wit index 7da95eac..0685cdf6 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/events.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/events.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; /// Workbench events, delivered in batches to `event-handler.handle`. interface events { diff --git a/sdk/rust/openidea-plugin/tests/api/released/exports.wit b/sdk/rust/openidea-plugin/tests/api/released/exports.wit index 80837743..311a6119 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/exports.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/exports.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; interface lifecycle { use types.{context, error}; diff --git a/sdk/rust/openidea-plugin/tests/api/released/host.wit b/sdk/rust/openidea-plugin/tests/api/released/host.wit index c7ac7f91..357a9f53 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/host.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/host.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; /// Writes to the IDE log, tagged with the plugin id. interface log { @@ -17,16 +17,54 @@ interface ui { command: option, } + record pick-item { + /// Returned when the item is chosen. + key: string, + label: string, + description: option, + } + + /// A context key's value, as `when` clauses compare it. + variant context-value { + flag(bool), + /// A finite number. + number(f64), + /// At most 1024 bytes. + text(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); /// 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); + /// Sets the plugin's context key `key`, which `when` clauses test as + /// `plugin..`, in the window the current command or event came + /// from (every window when there is none). A window's value takes + /// precedence over the global one. `key` is 1-64 of `A-Za-z0-9_-`; at most + /// 100 keys; they go away when the plugin stops. + set-context: func(key: string, value: context-value) -> result<_, error>; + /// Removes the key `set-context` set in the same scope. + remove-context: func(key: string); /// Copies `text` to the system clipboard. Requires `clipboard`. 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. + pick: func(title: string, items: list) -> result, error>; + /// Like `pick`, with any number of items chosen. + pick-many: func(title: string, items: list) -> result>, error>; + /// Asks for a line of text, pre-filled with `value`; `none` when dismissed. + /// Same rules as `pick`. + input: func(prompt: string, value: option) -> result, 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; } /// Persistent key-value storage of the plugin (survives restarts and idle diff --git a/sdk/rust/openidea-plugin/tests/api/released/indexing.wit b/sdk/rust/openidea-plugin/tests/api/released/indexing.wit new file mode 100644 index 00000000..e9edc27d --- /dev/null +++ b/sdk/rust/openidea-plugin/tests/api/released/indexing.wit @@ -0,0 +1,60 @@ +package openidea:plugin@1.2.0; + +/// Cross-file associations a plugin publishes for the files it declares under +/// `[[contributes.documentIndexers]]`. The host calls `index` in cancellable +/// background batches (on project open, then for changed files), keeps the +/// project-wide graph, and answers Go to Declaration and gutter markers from +/// it without calling the plugin again. Requires `project.read`; trusted +/// projects only. +interface document-indexer { + use types.{range}; + + /// A symbol the host's syntax support found in the document. + record symbol { + name: string, + /// class, interface, method, field, … as in the structure view. + kind: string, + /// The enclosing symbol's name. + container: option, + range: range, + } + + /// The document to index: the editor's text while it is open, else the file's. + record document { + /// Absolute path. + path: string, + text: string, + symbols: list, + } + + /// A range of the document tied to a key the plugin chooses + /// (`com.example.UserMapper#findById`, say). Keys are compared as is. + record anchor { + key: string, + range: range, + } + + /// Keys starting with `prefix` also resolve as if they started with + /// `target`; both end with `#`. A mapper that extends another finds the + /// inherited statements this way. + record alias { + prefix: string, + target: string, + } + + /// What one document contributes; replaces its previous edges. + record edges { + /// Where keys are declared. + definitions: list, + /// Ranges that go to the definitions of their key (Go to Declaration, + /// Ctrl/⌘-click). Elsewhere the language server answers as usual. + references: list, + aliases: list, + /// Gutter icons on their first line that go to the definitions of their key. + markers: list, + } + + /// At most 4,096 definitions and references and 256 aliases per document; + /// a document over the limits is reported as not indexed. + index: func(doc: document) -> edges; +} diff --git a/sdk/rust/openidea-plugin/tests/api/released/io.wit b/sdk/rust/openidea-plugin/tests/api/released/io.wit index b93ea079..89bbaadb 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/io.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/io.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; /// Problems in files, shown in the editor and the Problems view. interface diagnostics { diff --git a/sdk/rust/openidea-plugin/tests/api/released/plugin.wit b/sdk/rust/openidea-plugin/tests/api/released/plugin.wit index e9fc0ac8..12d2dc71 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/plugin.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/plugin.wit @@ -7,7 +7,7 @@ /// 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:plugin@1.1.0; +package openidea:plugin@1.2.0; world plugin { import log; @@ -50,6 +50,12 @@ world plugin-views { export view-provider; } +/// A plugin with a document indexer (`[[contributes.documentIndexers]]`). +world plugin-indexing { + include plugin; + export document-indexer; +} + /// Only the `syntax-provider` export: guests generate it next to `plugin` /// (the component tools merge both into one component). world syntax { @@ -65,3 +71,8 @@ world editor-providers { world views-provider { export view-provider; } + +/// Only the `document-indexer` export, generated next to `plugin` like `syntax`. +world indexing { + export document-indexer; +} diff --git a/sdk/rust/openidea-plugin/tests/api/released/providers.wit b/sdk/rust/openidea-plugin/tests/api/released/providers.wit index 17c1123a..00cb62a7 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/providers.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/providers.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; /// Editor features a plugin provides for the languages it declares under /// `[[contributes.providers]]` (the host calls only declared kinds). They run diff --git a/sdk/rust/openidea-plugin/tests/api/released/types.wit b/sdk/rust/openidea-plugin/tests/api/released/types.wit index de35cadf..9a59769a 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/types.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/types.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; /// Shared types. Positions are 0-based lines and UTF-16 code unit columns, /// as in the editor and LSP. diff --git a/sdk/rust/openidea-plugin/tests/api/released/views.wit b/sdk/rust/openidea-plugin/tests/api/released/views.wit index 8a67e222..945b600f 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/views.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/views.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; /// Declarative views: tool windows declared /// under `[[contributes.views]]` and custom editors under @@ -127,6 +127,9 @@ interface views { /// The view (or every custom editor of that id) shows outdated content: /// the IDE renders it again. refresh: func(view: string); + /// Brings one of the plugin's own views to the front in the window the + /// current command or event came from; `invalid` outside one. + reveal: func(view: string) -> result<_, error>; /// Sends a message to the script of a view's `html` body. post-message: func(view: string, message: string) -> result<_, error>; /// Opens a terminal tab in the window the call came from, running diff --git a/sdk/rust/openidea-plugin/tests/api/released/workspace.wit b/sdk/rust/openidea-plugin/tests/api/released/workspace.wit index 18004047..aa7214fb 100644 --- a/sdk/rust/openidea-plugin/tests/api/released/workspace.wit +++ b/sdk/rust/openidea-plugin/tests/api/released/workspace.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.1.0; +package openidea:plugin@1.2.0; interface workspace { use types.{error}; @@ -59,6 +59,11 @@ interface invocation { project: func() -> option; /// The window's focused editor. editor: func() -> option; + /// The files and folders the command was run on (a multi-selection in + /// a file tree, for instance), as absolute paths. + /// Empty when it was not run on any, or when the menu was for a tab + /// without a file (a virtual document). + selected-paths: func() -> list; } } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3616e184..687908a3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "OpenIDEA", - "version": "0.1.37", + "version": "0.1.38", "identifier": "ai.l0ng.openidea", "build": { "beforeDevCommand": "pnpm dev",