mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 17:02:17 +00:00
Adds the API 1.3 `endpoints-provider` export and `[[contributes.endpoints]]` (file globs, ^1.3, `project.read`). A plugin's routes join the Spring ones in Search Everywhere, `.http` URL completion and the declaration's Open in HTTP Client gutter action. The UI asks `plugin_endpoints` on demand; the host runs the plugin on a blocking thread, validates the whole list (bounds, project-relative locations, UTF-16 ranges) and caches it per project until a file matching the globs changes, then emits `EndpointsChanged`. A failed or invalid run keeps the last list; disabling, crashing or closing the project withdraws it, and late results can't restore it. Closes #1960. Co-authored-by: arnaud-ritti <[email protected]>
27 lines
956 B
Plaintext
27 lines
956 B
Plaintext
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>;
|
|
}
|