mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-18 16:08:55 +00:00
Plugin run configurations could not set environment variables, and Debug only worked when a source file in the arguments let the IDE infer a debugger, so a plugin could run `func start` for an Azure Functions app but not debug the worker it starts. API 1.9 adds the optional `launch-configurations` export, preferred over `run-configurations` when a component has both. Each configuration can add environment variables (only names the IDE's environment doesn't already have, like `process` commands) and name a debugger: launch the program under a language's debugger, or run it and attach to the first process of an Attach to Process kind that the run starts. Only the run's own descendants are candidates; the IDE waits up to a minute while the run lasts and otherwise leaves it running without the debugger. Remote projects resolve the process on the server. The SDK gets `LaunchConfigurations` / `launch_configurations`, the README and docs describe the export, and the bundled components and fixtures are rebuilt for 1.9.
94 lines
4.3 KiB
Plaintext
94 lines
4.3 KiB
Plaintext
package openidea:plugin@1.9.0;
|
|
|
|
/// Launches this plugin's configurations in the invoking window's Run tool window.
|
|
interface run {
|
|
use types.{error};
|
|
/// Starts an owned configuration, appending args. Debug requires a debugger.
|
|
/// Only from a window command/event. The returned id receives run-exited.
|
|
start: func(config: string, args: list<string>, debug: bool) -> result<string, error>;
|
|
}
|
|
|
|
/// Optional dynamic configurations, refreshed alongside run detectors.
|
|
interface run-configurations {
|
|
/// A configuration running an approved process in the project sandbox.
|
|
record run-configuration {
|
|
id: string,
|
|
name: string,
|
|
program: string,
|
|
args: list<string>,
|
|
cwd: option<string>,
|
|
test: bool,
|
|
framework: option<string>,
|
|
}
|
|
/// Returns the complete set for this project root.
|
|
configurations: func(project-root: string) -> list<run-configuration>;
|
|
}
|
|
|
|
/// Optional dynamic configurations with an environment and a debugger (API 1.9).
|
|
/// When a plugin exports both, the IDE uses this one instead of `run-configurations`.
|
|
interface launch-configurations {
|
|
use types.{extension};
|
|
/// A process the run starts, to attach the debugger to.
|
|
record attach-child {
|
|
/// Its debugger, as in Attach to Process: `dotnet`, `node`, `python`, `go` or `native`.
|
|
kind: string,
|
|
/// Only a process whose command line contains this text.
|
|
command-contains: option<string>,
|
|
}
|
|
/// How Debug starts the configuration.
|
|
variant debugger {
|
|
/// Starts `program` under the debugger of this language id (its `[debugger]`), e.g. `python`.
|
|
launch(string),
|
|
/// Runs the configuration as Run does, then attaches to the first matching process the
|
|
/// run starts (it waits for one up to 60 seconds).
|
|
attach-child(attach-child),
|
|
/// Later kinds; this IDE treats the configuration as having no debugger.
|
|
other(extension),
|
|
}
|
|
/// `run-configuration` with an environment and a debugger.
|
|
record launch-configuration {
|
|
id: string,
|
|
name: string,
|
|
program: string,
|
|
args: list<string>,
|
|
cwd: option<string>,
|
|
test: bool,
|
|
framework: option<string>,
|
|
/// Variables added to the run's environment (at most 64). A name the IDE's own
|
|
/// environment already has, such as `PATH`, is refused like in `process`.
|
|
env: list<tuple<string, string>>,
|
|
/// None: Debug infers the debugger from a source file in `args`, as before.
|
|
debugger: option<debugger>,
|
|
}
|
|
/// Returns the complete set for this project root.
|
|
configurations: func(project-root: string) -> list<launch-configuration>;
|
|
}
|
|
|
|
/// Optional parser for test configurations whose framework is plugin.
|
|
interface test-results {
|
|
use types.{location, extension};
|
|
/// A suite or test; parents must precede children and ids remain stable for a run.
|
|
record test-start { id: string, parent: option<string>, name: string, location: option<location> }
|
|
/// A successful test and optional elapsed milliseconds.
|
|
record test-passed { id: string, duration-ms: option<u32> }
|
|
/// A failed test, comparison and optional declaration location.
|
|
record test-failed {
|
|
id: string, duration-ms: option<u32>, message: string,
|
|
expected: option<string>, actual: option<string>, location: option<location>,
|
|
}
|
|
/// A skipped test and its explanation.
|
|
record test-skipped { id: string, reason: option<string> }
|
|
/// Output attached to a test or suite.
|
|
record test-output { id: string, text: string }
|
|
/// Incremental updates to the IDE's test tree. Unknown extensions are ignored.
|
|
variant test-event {
|
|
suite-started(test-start), test-started(test-start), passed(test-passed),
|
|
failed(test-failed), skipped(test-skipped), output(test-output), other(extension),
|
|
}
|
|
/// Parses one bounded output batch; failures fall back to built-in parsers.
|
|
parse: func(config: string, chunk: string) -> list<test-event>;
|
|
/// Selects test-tree name paths (parents then test), using the same config id as parse.
|
|
/// Returns the full replacement argument list, or none when filtering is unsupported.
|
|
select-tests: func(config: string, tests: list<list<string>>) -> option<list<string>>;
|
|
}
|