дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-01 06:42:54 +02:00
Порівняти коміти
13
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
148e7cea49 | ||
|
|
1d5d33cf76 | ||
|
|
2bbba9b945 | ||
|
|
14f143b703 | ||
|
|
f2a372428c | ||
|
|
89524bd583 | ||
|
|
f90d94538d | ||
|
|
a4ad387085 | ||
|
|
f8a148c06d | ||
|
|
aa1a027162 | ||
|
|
b30716e22c | ||
|
|
7fb21003f3 | ||
|
|
ad8d32d9c7 |
No files matched your search
@@ -1696,16 +1696,39 @@ impl DebugManager {
|
||||
}
|
||||
|
||||
pub async fn stack_trace(&self, s: DebugSessionId, thread_id: i64) -> IdeResult<Vec<StackFrame>> {
|
||||
const MAX_FRAMES: u64 = 400;
|
||||
let session = self.session(s)?;
|
||||
session.check_thread(thread_id)?;
|
||||
let body = session
|
||||
.conn
|
||||
.request_timeout(
|
||||
let request = |start: u64, levels: u64| {
|
||||
session.conn.request_timeout(
|
||||
"stackTrace",
|
||||
json!({ "threadId": thread_id, "startFrame": 0, "levels": 400 }),
|
||||
json!({ "threadId": thread_id, "startFrame": start, "levels": levels }),
|
||||
REQUEST_TIMEOUT,
|
||||
)
|
||||
.await?;
|
||||
};
|
||||
let frames_of = |mut body: Value| match body.get_mut("stackFrames").map(Value::take) {
|
||||
Some(Value::Array(frames)) => frames,
|
||||
_ => Vec::new(),
|
||||
};
|
||||
let raw = match request(0, MAX_FRAMES).await {
|
||||
Ok(body) => frames_of(body),
|
||||
// java-debug fails the whole request when one frame's source lookup throws (on Windows,
|
||||
// a CGLIB proxy's `<generated>` source against `sourcePaths`): the frames come one at a
|
||||
// time instead, without the ones it cannot describe.
|
||||
// ponytail: one request per frame; page around the failing ones if deep stacks get slow.
|
||||
Err(first @ DapError::Failed { .. }) => {
|
||||
let Ok(top) = request(0, 1).await else { return Err(first.into()) };
|
||||
let total = top.get("totalFrames").and_then(Value::as_u64).unwrap_or(MAX_FRAMES).min(MAX_FRAMES);
|
||||
let mut raw = frames_of(top);
|
||||
for start in 1..total {
|
||||
if let Ok(body) = request(start, 1).await {
|
||||
raw.extend(frames_of(body));
|
||||
}
|
||||
}
|
||||
raw
|
||||
}
|
||||
Err(e) => return Err(e.into()),
|
||||
};
|
||||
let kotlin_lsp = session.kotlin_lsp_quirks().is_some();
|
||||
let frame = |f: &Value| {
|
||||
let mut frame = frame_from(f);
|
||||
@@ -1717,7 +1740,7 @@ impl DebugManager {
|
||||
}
|
||||
frame
|
||||
};
|
||||
Ok(body.get("stackFrames").and_then(Value::as_array).map(|f| f.iter().map(frame).collect()).unwrap_or_default())
|
||||
Ok(raw.iter().map(frame).collect())
|
||||
}
|
||||
|
||||
pub async fn scopes(&self, s: DebugSessionId, frame_id: i64) -> IdeResult<Vec<Scope>> {
|
||||
|
||||
@@ -126,6 +126,8 @@ struct Script {
|
||||
child_request: Option<Value>,
|
||||
ignore_configuration_done: bool,
|
||||
source_path: Option<String>,
|
||||
/// Fail each `stackTrace` request whose frames include this one (java-debug, one frame's source lookup throwing).
|
||||
failing_frame: Option<u64>,
|
||||
/// Report this process id in the adapter's `process` event (the program being debugged).
|
||||
debuggee_pid: Option<u32>,
|
||||
/// java-debug's spelling of the same event.
|
||||
@@ -206,6 +208,7 @@ impl Default for Script {
|
||||
child_request: None,
|
||||
ignore_configuration_done: false,
|
||||
source_path: None,
|
||||
failing_frame: None,
|
||||
debuggee_pid: None,
|
||||
java_process_id: false,
|
||||
output_after_terminate: false,
|
||||
@@ -520,6 +523,20 @@ async fn fake_adapter<S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(stream
|
||||
ok!(msg, json!({"threads": [{"id": 1, "name": "MainThread"}]}));
|
||||
}
|
||||
}
|
||||
"stackTrace" if let Some(bad) = script.failing_frame => {
|
||||
let start = msg["arguments"]["startFrame"].as_u64().unwrap();
|
||||
let end = (start + msg["arguments"]["levels"].as_u64().unwrap()).min(3);
|
||||
if (start..end).contains(&bad) {
|
||||
send!(
|
||||
json!({"type": "response", "request_seq": msg["seq"], "command": "stackTrace", "success": false, "message": "Illegal char <<> at index 21: C:\\p\\com\\x\\<generated>"})
|
||||
);
|
||||
} else {
|
||||
let frames: Vec<Value> = (start..end)
|
||||
.map(|i| json!({"id": 10 + i, "name": format!("f{i}"), "line": 1, "column": 1}))
|
||||
.collect();
|
||||
ok!(msg, json!({"stackFrames": frames, "totalFrames": 3}));
|
||||
}
|
||||
}
|
||||
"stackTrace" => ok!(
|
||||
msg,
|
||||
json!({"stackFrames": [
|
||||
@@ -2332,6 +2349,21 @@ async fn kotlin_official_release_ten_no_delay_runs() {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn stack_trace_leaves_out_a_frame_the_adapter_cannot_describe() {
|
||||
let h = harness(Script { failing_frame: Some(1), ..Script::default() });
|
||||
let id = h.start(config()).await.unwrap();
|
||||
let frames = h.manager.stack_trace(id, 1).await.unwrap();
|
||||
assert_eq!(frames.iter().map(|f| f.name.as_str()).collect::<Vec<_>>(), ["f0", "f2"]);
|
||||
h.manager.stop(id).await.unwrap();
|
||||
|
||||
let h = harness(Script { failing_frame: Some(0), ..Script::default() });
|
||||
let id = h.start(config()).await.unwrap();
|
||||
let error = h.manager.stack_trace(id, 1).await.unwrap_err();
|
||||
assert!(error.message.contains("<generated>"), "{error:?}");
|
||||
h.manager.stop(id).await.unwrap();
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tokio::test]
|
||||
async fn netcoredbg_windows_source_paths_round_trip() {
|
||||
|
||||
@@ -34,7 +34,7 @@ use std::path::{Component, Path, PathBuf};
|
||||
|
||||
pub const MANIFEST_FILE: &str = "plugin.toml";
|
||||
/// The plugin API (engine) version this host implements.
|
||||
pub const ENGINE_VERSION: &str = "1.17.0";
|
||||
pub const ENGINE_VERSION: &str = "1.18.0";
|
||||
/// The 0.1 API, still accepted for contribution-only packages and 0.1 components.
|
||||
pub const LEGACY_API: &str = "0.1";
|
||||
/// Marketplace categories, in the order they are shown.
|
||||
|
||||
@@ -446,9 +446,15 @@ pub fn stop_run() -> Tool {
|
||||
"Stops the running command of an agent tab, the way the Run tool window's Stop does: it asks the \
|
||||
process tree to exit and, with `force`, kills it. Waits up to `timeout` milliseconds (default {STOP_TIMEOUT_MS}) \
|
||||
for it to end and returns the tab's status (`stoppedByAgent` once it ended). A process that ignores the request \
|
||||
keeps `stopping`: call again with `force`. The tab stays open with its output."
|
||||
keeps `stopping`: call again with `force`. The tab stays open with its output.
|
||||
|
||||
Pass `runId` instead of `name` to stop a run `execute_run_configuration` started and left running; the result is \
|
||||
its `state` (`stopped` or `stopping`) and `exitCode` when it has one."
|
||||
),
|
||||
|call| async move {
|
||||
if let Some(id) = call.opt_i64("runId")? {
|
||||
return stop_configuration_run(&call, id).await;
|
||||
}
|
||||
let run = find(&call)?;
|
||||
let id = run.live_process().ok_or_else(|| IdeError::invalid(format!("`{}` is not running", run.name)))?;
|
||||
let force = call.flag("force", false)?;
|
||||
@@ -467,11 +473,48 @@ keeps `stopping`: call again with `force`. The tab stays open with its output."
|
||||
},
|
||||
)
|
||||
.write()
|
||||
.param(Param::required("name", ParamType::String, NAME))
|
||||
.param(Param::optional("name", ParamType::String, NAME))
|
||||
.param(Param::optional("runId", ParamType::Integer, "`runId` from `execute_run_configuration`, instead of `name`"))
|
||||
.param(Param::optional("force", ParamType::Boolean, "Kill the process tree instead of asking it to exit"))
|
||||
.param(Param::optional("timeout", ParamType::Integer, "Milliseconds to wait for the command to end"))
|
||||
}
|
||||
|
||||
/// `stop_run` for a run `execute_run_configuration` started (#6127).
|
||||
async fn stop_configuration_run(call: &Call, raw: i64) -> IdeResult<Output> {
|
||||
use super::configs::{forget_started, run_exit, started_by_mcp, wait_exit};
|
||||
if call.opt_str("name")?.is_some() {
|
||||
return Err(IdeError::invalid("pass either `name` or `runId`, not both"));
|
||||
}
|
||||
let id = u32::try_from(raw)
|
||||
.ok()
|
||||
.map(ide_core::RunId)
|
||||
.filter(|id| started_by_mcp(*id))
|
||||
.ok_or_else(|| IdeError::not_found(format!("no run {raw} started by execute_run_configuration")))?;
|
||||
let host = call.host();
|
||||
let deadline = std::time::Instant::now() + timeout(call, STOP_TIMEOUT_MS)?;
|
||||
let exit = match run_exit(&host, id) {
|
||||
Some(exit) => Some(exit),
|
||||
None => {
|
||||
crate::ops::run::run_stop(&host, call.window(), id)?;
|
||||
if call.flag("force", false)? {
|
||||
// A second Stop kills the tree.
|
||||
crate::ops::run::run_stop(&host, call.window(), id)?;
|
||||
}
|
||||
wait_exit(call, id, Some(deadline)).await?
|
||||
}
|
||||
};
|
||||
if exit.is_some() {
|
||||
forget_started(id);
|
||||
}
|
||||
let mut out = Map::new();
|
||||
out.insert("runId".into(), id.0.into());
|
||||
out.insert("state".into(), if exit.is_some() { "stopped" } else { "stopping" }.into());
|
||||
if let Some(Some(code)) = exit {
|
||||
out.insert("exitCode".into(), code.into());
|
||||
}
|
||||
Output::json(Value::Object(out))
|
||||
}
|
||||
|
||||
pub fn tools() -> Vec<Tool> {
|
||||
vec![run_command(), wait_for_run(), read_run_output(), get_run_status(), send_run_input(), stop_run(), list_runs()]
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ use ide_core::{IdeError, IdeResult, RunId, Severity};
|
||||
use ide_run::{OutputChunk, RunConfig};
|
||||
use parking_lot::Mutex;
|
||||
use serde_json::{Map, Value, json};
|
||||
use std::collections::HashSet;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, LazyLock};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
const DEFAULT_TIMEOUT_MS: usize = 10_000;
|
||||
@@ -281,7 +282,19 @@ workingDirectory, envs).",
|
||||
}
|
||||
|
||||
/// Polls how run `id` ended: `None` while running, else its exit code (if known).
|
||||
fn run_exit(host: &crate::Host, id: RunId) -> Option<Option<i32>> {
|
||||
/// The runs `execute_run_configuration` started: `stop_run` takes their `runId`, and only theirs,
|
||||
/// not the user's own runs.
|
||||
static STARTED: LazyLock<Mutex<HashSet<RunId>>> = LazyLock::new(Default::default);
|
||||
|
||||
pub(super) fn started_by_mcp(id: RunId) -> bool {
|
||||
STARTED.lock().contains(&id)
|
||||
}
|
||||
|
||||
pub(super) fn forget_started(id: RunId) {
|
||||
STARTED.lock().remove(&id);
|
||||
}
|
||||
|
||||
pub(super) fn run_exit(host: &crate::Host, id: RunId) -> Option<Option<i32>> {
|
||||
match host.processes.exit_code(id) {
|
||||
Ok(exit) => exit,
|
||||
// Remote (SSH) runs, or a finished run already forgotten: the run list knows whether it runs.
|
||||
@@ -294,7 +307,7 @@ fn run_exit(host: &crate::Host, id: RunId) -> Option<Option<i32>> {
|
||||
|
||||
/// Waits for run `id` to exit, until `deadline`: `None` when it is still running. Cancelling
|
||||
/// the call stops the run.
|
||||
async fn wait_exit(call: &Call, id: RunId, deadline: Option<Instant>) -> IdeResult<Option<Option<i32>>> {
|
||||
pub(super) async fn wait_exit(call: &Call, id: RunId, deadline: Option<Instant>) -> IdeResult<Option<Option<i32>>> {
|
||||
let host = call.host();
|
||||
loop {
|
||||
if let Some(exit) = run_exit(&host, id) {
|
||||
@@ -741,7 +754,8 @@ Behavior:
|
||||
Returns the execution result including current output snapshot, optional exit code, and optional `fullOutputPath`.
|
||||
In OpenIDEA the user is asked first for every call; `programArguments` replace the configuration's \
|
||||
arguments (appended to a command that is one shell line, such as `npm run dev`); the run does not appear in the Run \
|
||||
tool window; output files are private and deleted after a day.",
|
||||
tool window: while it is still running, the result carries `runId`, which `stop_run` stops; output files are private \
|
||||
and deleted after a day.",
|
||||
|call| async move {
|
||||
let target = execution_target(
|
||||
call.opt_str("configurationName")?,
|
||||
@@ -807,14 +821,24 @@ one by one",
|
||||
}
|
||||
};
|
||||
|
||||
STARTED.lock().insert(info.id);
|
||||
let exit = match limit {
|
||||
Some(limit) if !limit.is_zero() => wait_exit(&call, info.id, Some(Instant::now() + limit)).await?,
|
||||
_ => None,
|
||||
};
|
||||
if exit.is_some() {
|
||||
STARTED.lock().remove(&info.id);
|
||||
}
|
||||
let c = collector.lock();
|
||||
let mut result = Map::new();
|
||||
if let Some(Some(code)) = exit {
|
||||
result.insert("exitCode".into(), code.into());
|
||||
match exit {
|
||||
Some(Some(code)) => {
|
||||
result.insert("exitCode".into(), code.into());
|
||||
}
|
||||
Some(None) => {}
|
||||
None => {
|
||||
result.insert("runId".into(), info.id.0.into());
|
||||
}
|
||||
}
|
||||
result.insert("output".into(), c.preview().into());
|
||||
// An exited run whose whole output is in `output` needs no file.
|
||||
|
||||
@@ -81,8 +81,8 @@ pub async fn doc_set_line_ending(host: &Host, window: &str, doc: DocId, line_end
|
||||
|
||||
/// Structure view: LSP document symbols when available (with tree-sitter
|
||||
/// visibility and type-alias kinds), tree-sitter otherwise.
|
||||
/// Tree-sitter answers come from the per-document tree cache (incremental
|
||||
/// re-parse); large documents get no syntax structure.
|
||||
/// Normal files reuse the per-document tree cache. Large Markdown files use
|
||||
/// the syntax parser's size limit for heading outlines.
|
||||
#[command(trust = always)]
|
||||
pub async fn doc_outline(host: &Host, window: &str, doc: DocId) -> IdeResult<Vec<OutlineItem>> {
|
||||
let project = host.project(window)?;
|
||||
@@ -118,7 +118,7 @@ pub async fn doc_outline(host: &Host, window: &str, doc: DocId) -> IdeResult<Vec
|
||||
}
|
||||
items
|
||||
}
|
||||
None if snap.large => Vec::new(),
|
||||
None if snap.large && snap.language.as_str() != "markdown" => Vec::new(),
|
||||
None => syntax(),
|
||||
})
|
||||
})
|
||||
|
||||
@@ -95,6 +95,7 @@ pub fn register_builtin_points(
|
||||
registry.register(Arc::new(UiPoint::new(p::VIEWS, ui.clone(), p::view)))?;
|
||||
registry.register(Arc::new(UiPoint::new(p::CUSTOM_EDITORS, ui.clone(), p::custom_editor)))?;
|
||||
registry.register(Arc::new(UiPoint::new(p::EDITOR_PANELS, ui.clone(), p::editor_panel)))?;
|
||||
registry.register(Arc::new(UiPoint::new(p::OVERLAYS, ui.clone(), p::overlay)))?;
|
||||
registry.register(Arc::new(UiPoint::new(p::MARKER_ICONS, ui.clone(), p::marker_icon)))?;
|
||||
registry.register(Arc::new(UiPoint::new(p::FILE_ICONS, ui.clone(), p::file_icon)))?;
|
||||
registry.register(Arc::new(UiPoint::new(p::FILE_TEMPLATES, ui.clone(), p::file_template)))?;
|
||||
|
||||
@@ -44,6 +44,15 @@
|
||||
//! width = 110 # pixels, 40–400
|
||||
//! when = "plugin.<id>.enabled" # optional
|
||||
//!
|
||||
//! [[contributes.overlays]]
|
||||
//! id = "stage"
|
||||
//! web = "web/stage.html" # floats over the workbench, never takes the focus (API 1.18)
|
||||
//! width = 320 # pixels, 40–800; the page can resize it within those bounds
|
||||
//! height = 240
|
||||
//! anchor = "bottom-right" # top-left … bottom-right (nine); the page can move it
|
||||
//! when = "plugin.<id>.showing" # optional
|
||||
//! interactive = true # optional; false lets every click through to the IDE
|
||||
//!
|
||||
//! [[contributes.fileIcons]]
|
||||
//! id = "drawing"
|
||||
//! patterns = ["*.excalidraw"]
|
||||
@@ -82,8 +91,9 @@ pub const SETTINGS: &str = "settings";
|
||||
pub const VIEWS: &str = "views";
|
||||
pub const CUSTOM_EDITORS: &str = "customEditors";
|
||||
pub const EDITOR_PANELS: &str = "editorPanels";
|
||||
pub const OVERLAYS: &str = "overlays";
|
||||
/// The points whose declarations can name a `web` page (served, messaged, sent view events).
|
||||
pub const WEB_POINTS: [&str; 3] = [VIEWS, CUSTOM_EDITORS, EDITOR_PANELS];
|
||||
pub const WEB_POINTS: [&str; 4] = [VIEWS, CUSTOM_EDITORS, EDITOR_PANELS, OVERLAYS];
|
||||
pub const FILE_ICONS: &str = "fileIcons";
|
||||
pub const MARKER_ICONS: &str = "markerIcons";
|
||||
pub const FILE_TEMPLATES: &str = "fileTemplates";
|
||||
@@ -887,6 +897,69 @@ pub(super) fn editor_panel(pkg: &Package, decl: toml::Value) -> Result<UiDecl, S
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct OverlayDecl {
|
||||
id: String,
|
||||
web: String,
|
||||
width: u32,
|
||||
height: u32,
|
||||
#[serde(default = "default_overlay_anchor")]
|
||||
anchor: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
when: Option<String>,
|
||||
#[serde(default = "default_true")]
|
||||
interactive: bool,
|
||||
}
|
||||
|
||||
fn default_overlay_anchor() -> String {
|
||||
"bottom-right".into()
|
||||
}
|
||||
|
||||
fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Where an overlay can sit in the window (the page may move it to another).
|
||||
pub const OVERLAY_ANCHORS: [&str; 9] = [
|
||||
"top-left",
|
||||
"top-center",
|
||||
"top-right",
|
||||
"middle-left",
|
||||
"center",
|
||||
"middle-right",
|
||||
"bottom-left",
|
||||
"bottom-center",
|
||||
"bottom-right",
|
||||
];
|
||||
const OVERLAY_SIZE: std::ops::RangeInclusive<u32> = 40..=800;
|
||||
|
||||
/// `[[contributes.overlays]]` (API 1.18): a web page floating over the workbench at
|
||||
/// one of nine anchors, shown while `when` holds. It never takes the keyboard focus,
|
||||
/// sits under dialogs and popups, and sees nothing of the IDE, so it needs no
|
||||
/// capability.
|
||||
pub(super) fn overlay(pkg: &Package, decl: toml::Value) -> Result<UiDecl, String> {
|
||||
let d: OverlayDecl = decode(OVERLAYS, decl)?;
|
||||
pkg.manifest.needs_api(&format!("contributes.{OVERLAYS}"), 18)?;
|
||||
validate_item_id(&d.id, "overlay id")?;
|
||||
let what = format!("overlay {:?}", d.id);
|
||||
for (name, value) in [("width", d.width), ("height", d.height)] {
|
||||
if !OVERLAY_SIZE.contains(&value) {
|
||||
return Err(format!("{what}: `{name}` is {}–{} pixels", OVERLAY_SIZE.start(), OVERLAY_SIZE.end()));
|
||||
}
|
||||
}
|
||||
if !OVERLAY_ANCHORS.contains(&d.anchor.as_str()) {
|
||||
return Err(format!("{what}: `anchor` is one of {}", OVERLAY_ANCHORS.join(", ")));
|
||||
}
|
||||
if let Some(when) = &d.when {
|
||||
validate_when(when).map_err(|e| format!("{what}: {e}"))?;
|
||||
}
|
||||
let files = super::web::web_files(pkg, &d.web, &what)?;
|
||||
let mut out = UiDecl::new(d.id.clone(), d.id.clone(), json(&d)?);
|
||||
out.files = files;
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
struct FileIconDecl {
|
||||
@@ -1518,6 +1591,53 @@ web = "web/view.html"
|
||||
assert!(check(VIEWS, &view_with(r#"["https://example.com"]"#), &ask).unwrap_err().contains("capability"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overlays_validate_api_size_anchor_when_and_page() {
|
||||
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../ide-plugin/tests/fixtures/overlay");
|
||||
// A Windows checkout may have CRLF line ends; the edits below match on `\n`.
|
||||
let source = std::fs::read_to_string(root.join("plugin.toml")).unwrap().replace("\r\n", "\n");
|
||||
let check = |source: &str| {
|
||||
let manifest = ide_extension::Manifest::parse(source)?;
|
||||
let decl = manifest.declarations(OVERLAYS).into_iter().next().unwrap();
|
||||
overlay(&Package::new(manifest, root.clone()), decl)
|
||||
};
|
||||
let valid = check(&source).unwrap();
|
||||
assert_eq!(valid.key, "probe");
|
||||
assert_eq!(
|
||||
valid.json,
|
||||
serde_json::json!({
|
||||
"id": "probe", "web": "web/index.html", "width": 260, "height": 140,
|
||||
"anchor": "bottom-right", "interactive": true,
|
||||
})
|
||||
);
|
||||
assert_eq!(valid.files, [PathBuf::from("web/index.html")]);
|
||||
let placed =
|
||||
check(&source.replace("height = 140", "height = 140\nanchor = \"top-center\"\ninteractive = false"));
|
||||
let placed = placed.unwrap();
|
||||
assert_eq!(placed.json["anchor"], "top-center");
|
||||
assert_eq!(placed.json["interactive"], false);
|
||||
let when = source.replace("height = 140", "height = 140\nwhen = \"plugin.overlay.showing\"");
|
||||
assert_eq!(check(&when).unwrap().json["when"], "plugin.overlay.showing");
|
||||
for size in ["40", "800"] {
|
||||
assert!(check(&source.replace("width = 260", &format!("width = {size}"))).is_ok(), "{size}");
|
||||
}
|
||||
for (bad, error) in [
|
||||
(source.replace("^1.18", "^1.17"), "1.18"),
|
||||
(source.replace("width = 260", "width = 39"), "40–800"),
|
||||
(source.replace("height = 140", "height = 801"), "`height`"),
|
||||
(source.replace("height = 140\n", ""), "height"),
|
||||
(source.replace("height = 140", "height = 140\nanchor = \"left\""), "anchor"),
|
||||
(source.replace("height = 140", "height = 140\nwhen = \"a &&\""), "when"),
|
||||
(source.replace("height = 140", "height = 140\nfocus = true"), "focus"),
|
||||
(source.replace("web/index.html", "index.html"), "directory of its own"),
|
||||
(source.replace("web/index.html", "web/missing.html"), "no such file"),
|
||||
(source.replace(r#"id = "probe""#, r#"id = "Pro Be""#), "id"),
|
||||
] {
|
||||
let err = check(&bad).unwrap_err();
|
||||
assert!(err.contains(error), "{bad}\n→ {err}");
|
||||
}
|
||||
}
|
||||
|
||||
fn package_with_catalogs(files: &[(&str, &str)]) -> (tempfile::TempDir, Package) {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
std::fs::create_dir(dir.path().join(LOCALES_DIR)).unwrap();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
mod common;
|
||||
|
||||
use ide_core::{ChangeSet, TextChange};
|
||||
use ide_core::{ChangeSet, Pos, Range, SymbolKind, TextChange};
|
||||
use ide_host::{Host, catalogue::TrustClass, ops};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
@@ -51,6 +51,33 @@ async fn edits_loose_files_without_project_services() {
|
||||
assert!(!Arc::ptr_eq(&project, &light));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn large_markdown_has_structure_after_embedded_images() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let path = tmp.path().join("paper.md");
|
||||
let image = format!("\n\n", "A".repeat(64 * 1024));
|
||||
let text = format!("# Paper\n\n{}```text\n## Inside code\n```\n\n## Results\n", image.repeat(84));
|
||||
std::fs::write(&path, text).unwrap();
|
||||
let host = host(&tmp.path().join("app"));
|
||||
host.open_light("main", &path).unwrap();
|
||||
|
||||
let doc = ops::doc::doc_open(&host, "main", path).await.unwrap();
|
||||
assert!(doc.large);
|
||||
let outline = ops::doc::doc_outline(&host, "main", doc.id).await.unwrap();
|
||||
|
||||
assert_eq!(outline.len(), 1);
|
||||
let paper = &outline[0];
|
||||
assert_eq!(paper.kind, SymbolKind::Key);
|
||||
assert_eq!(paper.name, "Paper");
|
||||
assert_eq!(paper.selection_range, Range::new(Pos::new(0, 2), Pos::new(0, 7)));
|
||||
assert_eq!(paper.children.len(), 1);
|
||||
let results = &paper.children[0];
|
||||
assert_eq!(results.kind, SymbolKind::Key);
|
||||
assert_eq!(results.name, "Results");
|
||||
assert_eq!(results.selection_range, Range::new(Pos::new(174, 3), Pos::new(174, 10)));
|
||||
assert!(results.children.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn light_windows_ignore_project_scoped_settings() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -775,6 +775,42 @@ async fn execute_reports_output_exit_code_and_requires_confirmation() {
|
||||
assert!(result["output"].as_str().unwrap().contains("captured-output"));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn a_configuration_left_running_is_stopped_by_its_run_id() {
|
||||
let h = Harness::new();
|
||||
h.trust().await;
|
||||
let config = ide_run::RunConfig {
|
||||
id: "server".into(),
|
||||
name: "Server".into(),
|
||||
kind: "shell".into(),
|
||||
command: if cfg!(windows) { "ping -n 60 127.0.0.1" } else { "sleep 60" }.into(),
|
||||
args: vec![],
|
||||
cwd: None,
|
||||
env: Default::default(),
|
||||
detected: false,
|
||||
is_test: false,
|
||||
debug_adapter: None,
|
||||
allow_parallel: false,
|
||||
extras: Default::default(),
|
||||
};
|
||||
ide_run::save_user_configs(&h.root, &[config]).unwrap();
|
||||
h.host.mcp_requests.set_ready("main", true);
|
||||
let run = h.json("execute_run_configuration", json!({"configurationName":"Server","waitForExit":false}));
|
||||
let allow = async {
|
||||
let id = h.request().await;
|
||||
h.host.mcp_requests.answer("main", id, true, None).unwrap();
|
||||
};
|
||||
let (result, ()) = tokio::join!(run, allow);
|
||||
assert!(result.get("exitCode").is_none());
|
||||
let id = result["runId"].as_u64().expect("a run left running carries its id");
|
||||
|
||||
let user_run = id + 1000;
|
||||
assert!(h.error("stop_run", json!({"runId": user_run})).await.contains("started by execute_run_configuration"));
|
||||
let stopped = h.json("stop_run", json!({"runId": id, "force": true, "timeout": 10000})).await;
|
||||
assert_eq!(stopped["state"], "stopped", "{stopped}");
|
||||
assert!(h.error("stop_run", json!({"runId": id})).await.contains("started by execute_run_configuration"));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
#[ignore = "requires rust-analyzer, like language_smoke::rust"]
|
||||
async fn rust_references_and_rename_through_mcp() {
|
||||
|
||||
@@ -59,7 +59,7 @@ use views_bindings::exports::openidea::plugin::view_provider as wit_view;
|
||||
use views_bindings::openidea::plugin::view_types as wit_vt;
|
||||
|
||||
/// The API version of the world above, `major.minor` of [`host_api`].
|
||||
pub const API_VERSION: &str = "1.17";
|
||||
pub const API_VERSION: &str = "1.18";
|
||||
const EPOCH_TICK: Duration = Duration::from_millis(10);
|
||||
pub(crate) const MAX_TEXT: usize = 1 << 20;
|
||||
/// The most text, and the most PNG bytes, `ui.read-clipboard` returns.
|
||||
|
||||
@@ -95,7 +95,7 @@ fn the_sdk_carries_the_hosts_wit() {
|
||||
|
||||
#[test]
|
||||
fn the_version_check_runs_compatible_components_and_explains_the_rest() {
|
||||
let host = v("1.17.0");
|
||||
let host = v("1.18.0");
|
||||
for ok in [
|
||||
"1.0.0",
|
||||
"1.3.0",
|
||||
@@ -113,15 +113,16 @@ fn the_version_check_runs_compatible_components_and_explains_the_rest() {
|
||||
"1.15.0",
|
||||
"1.16.0",
|
||||
"1.17.0",
|
||||
"1.18.0",
|
||||
"1.0.0-rc.1",
|
||||
] {
|
||||
assert_eq!(check_api(&v(ok), &host), Ok(()), "{ok}");
|
||||
}
|
||||
let newer = check_api(&v("1.18.0"), &host).unwrap_err();
|
||||
assert!(newer.contains("1.18") && newer.contains("update OpenIDEA"), "{newer}");
|
||||
let newer = check_api(&v("1.19.0"), &host).unwrap_err();
|
||||
assert!(newer.contains("1.19") && newer.contains("update OpenIDEA"), "{newer}");
|
||||
assert!(check_api(&v("2.0.0"), &host).unwrap_err().contains("update OpenIDEA"));
|
||||
let older = check_api(&v("0.2.0"), &host).unwrap_err();
|
||||
assert!(older.contains("rebuild it with the 1.17 SDK"), "{older}");
|
||||
assert!(older.contains("rebuild it with the 1.18 SDK"), "{older}");
|
||||
// 0.x: every minor is its own API.
|
||||
assert_eq!(check_api(&v("0.2.0"), &v("0.2.5")), Ok(()));
|
||||
assert!(check_api(&v("0.1.0"), &v("0.2.0")).is_err());
|
||||
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
98e9c2b886df177bafb68a712fc1efadc4f3a7b82e8425cd1b3f4c2355bdb785
|
||||
80e4575f24617a74ffbe378e65fc4c94a787fdf4af0af2bb803b32ea05ee733b
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
bb77bc0963451ca4259591bf68c72ae3eb70b1c6f855fa29dfc84d2be675404c
|
||||
193aaf067d10c138d450e03439d92b38b33fb3df163be578d8fb7714c0fb5b8a
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
f381b0e20520bccf5acd46b95641f5542885184352e52ec2fed3fd53665c353b
|
||||
7d9a2c8ec95815f6eda56b255532ed5507cfd9b9f4857429c02b46ee565ac73f
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
f72a53e7b800b8c5408c7ac67034821f814da7b1d66f527949450431bcf52e02
|
||||
9a5bb4274c8c96e2ca1de9b910631dca21894e4bb15c861aab30fb063b509008
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
3cd2f02738b07d9a6294025cbcc6e906716d3e91db50a6f39485df9b1d6a4ead
|
||||
2d09ba041deac4ddb91a9f1a5cca5b0593cec03af511d6714c741b95538458cc
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
d77b80884163628791b292acc59324d3b9a7c2236034b88f87e8f56af5929a48
|
||||
6eaacf2bf54a370a1317c5fdc1e66913ad445d8bd28a6a9d493b9f24ac67db30
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
5a79d35e9fc1560a39b6459312a14c27c73739fd385f6c2568f9b1c1bf8fe4a1
|
||||
c46d5ec0847f4a15344d5820a9552101f72b186ece670e87344f9d38631c445d
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
264be0e527b0cc200e2d97e982b7b297ef6181a7669506ccf09159531f91124d
|
||||
4c7f16dab179e3cf4cf7336a10aa7172ea24be7f7a51c2aa4e9706709594955d
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
6230dce145f2cce3033c4797566cbbff8c98e5d8c85d41f9342693b19a10b638
|
||||
1c6aa7527ff3cca00774b732150d49424b7aab42e5eb55c458d08bae84ed9361
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
3d7d853fa40ce14ae6781dbf5607153c4f38b2663a31f1ca29a753e8eba79f03
|
||||
aa5f02ba0fd04e8076a954f4f8a373aca36589bca6a4423874037ec9d91e20e9
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
a128c5f640b42d323059a7be1bd2e89cb9de1ea1ea635b5af4e9f69b66bfd04c
|
||||
f1850efd177d0c8c81028f5c0aef6ca93c8b64bbc4a076ea3ca28786b918eb4a
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
9e00f4bcad39a99f05c35ac66962a574f7edd5713f1aa404ef72fd7ef945d1e8
|
||||
63e34c58c4d4459a6e6fbc58ac24d7109d5b891333612078e97c60101857ae4f
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
7e0ae6bfc8217c37a68e9010920a5bd3478f654b6cfaf3f54e0ef5aacae546b8
|
||||
41d96facedea486aaf0d3c8c6e51b6b1ae99fe06e441fe1314397a0288de2e8b
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
97c4d6aaf88d552d736021e21bb1f1e1594800ceb771644eb1f3356c0efbc42a
|
||||
1198aa38409c43a6eb8a911245c7eba026d516c9fbf023b015a02b3e626c077d
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
5a65f921bb1f0ed0f0f10811f8960d9ea9e7ded59d5172356e7cc93f05b4bd5e
|
||||
6f0537694f331d6dcb78c57b1b7abba101ad95f467b9452331a8346013699649
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
2d148151a9b0a2ab4c479183e3d2ab07d0432d8645dbf95c0e04385ef25830d8
|
||||
26381e6f8271a154f9ff61f284eb136b586a1b59433f344c6668831036acc4b4
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
63136a78f4279b140c74ff07146b79ca2ce6c7a4fffd6176e811828aad911e0e
|
||||
0fd8c92f74050593e02ffc304181f9ddc2902996312bc63a9aafc1f35480775a
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
e6bf5c74e18ab47577c1e88294fa4961fe8a1e56fb3e34fec5154dab74dfd805
|
||||
381a9c30d98f10c7b1d51628528bf2326036e505b3ff054855517f884fbe05ec
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
ad5a9fef07a6e9db8fe0375d0ba9d2e92247c28303876ac52db2dbf938bf96ae
|
||||
02e5d5a85c1126572344baaaba661880fb5d373e1e243c3bafd79c306bd01460
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
fdbcd1afce0d106be463ef43d31245fcb4b9e84287ede78fb8abe740ea28b247
|
||||
2dcabe9069a235e5b1b410eda2e2b532210d4984e05cc20b78d1e4997c635308
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
c9eb17c9f7e334b05bc5104204fb12a88dceafe36dbd04510e439539f2a1d464
|
||||
7818c157ef1410b36470628b7847690e8715f35a2e93af079aaf4651f6fd0549
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
14ba72bbc8013b8e2a7f87e85a7046edc4fb4a2256f3fae3ac735241096e4428
|
||||
128d6c8c12db56d04630665329643eab59bcd17a019841b4d20173268b793663
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
91b190eb62077bde52916a09d76a474584725e73cf3acf45613aecbc8c37c421
|
||||
6a6b8707f24bcb8f1360533c0d29a43fbb40be26b791a7ddf9544065cc734df9
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
90b20d5ec2d36fa585e3f921672b6477c9691f184151f7059dd429fd7ccc09cf
|
||||
a881c6712ab7e7c67534b65f564e5780d3cac8a10650f7913200b33d17600b8b
|
||||
@@ -5,9 +5,9 @@ wit_bindgen::generate!({
|
||||
inline: "
|
||||
package fixture:misbehave;
|
||||
world misbehave {
|
||||
include openidea:plugin/plugin-syntax@1.17.0;
|
||||
export openidea:plugin/providers@1.17.0;
|
||||
export openidea:plugin/file-actions@1.17.0;
|
||||
include openidea:plugin/plugin-syntax@1.18.0;
|
||||
export openidea:plugin/providers@1.18.0;
|
||||
export openidea:plugin/file-actions@1.18.0;
|
||||
}
|
||||
",
|
||||
path: "../../../../../wit",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
id = "overlay"
|
||||
name = "Overlay Probe"
|
||||
version = "0.1.0"
|
||||
description = "Test fixture for [[contributes.overlays]]: a card floating over the workbench that moves itself around with openidea.overlay.place, no code."
|
||||
engines.openidea = "^1.18"
|
||||
|
||||
[[contributes.overlays]]
|
||||
id = "probe"
|
||||
web = "web/index.html"
|
||||
width = 260
|
||||
height = 140
|
||||
@@ -0,0 +1,44 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
html, body { margin: 0; height: 100%; background: transparent; }
|
||||
.card {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 10px;
|
||||
background: var(--openidea-bg-elevated);
|
||||
border: 1px solid var(--openidea-border);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
|
||||
font: var(--openidea-font-size) var(--openidea-font-ui);
|
||||
color: var(--openidea-fg);
|
||||
}
|
||||
button { font: inherit; margin: 8px 6px 0 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<strong>Overlay probe</strong>
|
||||
<div id="where"></div>
|
||||
<button id="move" type="button">Next anchor</button>
|
||||
<button id="grow" type="button">Toggle size</button>
|
||||
</div>
|
||||
<script>
|
||||
const anchors = ["top-left", "top-center", "top-right", "middle-right", "bottom-right", "bottom-center", "bottom-left", "middle-left", "center"];
|
||||
let at = anchors.indexOf("bottom-right");
|
||||
let big = false;
|
||||
const show = (p) => { document.getElementById("where").textContent = `${p.anchor}, ${p.width}×${p.height}`; };
|
||||
openidea.overlay.get().then(show);
|
||||
document.getElementById("move").onclick = () => {
|
||||
at = (at + 1) % anchors.length;
|
||||
openidea.overlay.place({ anchor: anchors[at] }).then(show);
|
||||
};
|
||||
document.getElementById("grow").onclick = () => {
|
||||
big = !big;
|
||||
openidea.overlay.place(big ? { width: 360, height: 220 } : { width: 260, height: 140 }).then(show);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
0f7fc3035725b0262925b9e062bb72bf1e875eab4aa1eb040df4c1708db7c4bd
|
||||
402e15d6bcc050160cf24e4a2e7f4c05de12961e1461c856f8d78560a3eac059
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
0dc9ad2f7c8c73c92e36cf709e5275d13ed4f5067b1322f0a76160ff92bf8bdc
|
||||
faf3ef90a388276bdf4f392a1049809361068230155893cb0a4250fb1da08063
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
6e17ea89659c70e925075d2825d34c61252ab511ccb2bdbad7af29d76b97b84e
|
||||
e719093d97accc6044110e49284f385c7dbe803024ea2e3cb9484128a589001e
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
2d221e76206dac71941d749626700537e003642fc862934e832366f73b862831
|
||||
8effd8434f237afc9afda64c0d65673f13b6435a145afab0442a48b00b902273
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
b6ac119e4a85cf0c53bce81d1fe70a3c086c7c3764f1cbc6bd19878da124cc97
|
||||
1ccfc02135460f131e62dc4f9c8f2d400a4f866ccb8fb7d82c0eabaf0925fa2c
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
c71e5ea2112f545be3b3c1afadd20c46f931632ee78feeb06e0945a550bc76d3
|
||||
d8ce268712e42fc00843db24731dbb75d65b1192ad588a812401eba11599402d
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
1b29775537e80017a5d1e5999bbc611204c696f0951818664533b51e3903f3d6
|
||||
044b352b81cb95f71b5f7f546d630d2bd8cf246fadc6ac1999aa080562b8d85a
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
92b03822689a82c8479751af6b6dfd593ad7a1f0a8e55071819520fdccd90570
|
||||
6a33758c892776e4e005e29bc5137a69421daaea01f3fa2c8c52cc18ece78e29
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
a8a8b4b2fd8f506f22734d07aa3375dca027aae9eac1d4b243997482c46561c1
|
||||
8d8c7fe694b260e79494e20cc264c0d6f2be3d1a765ed15db4f0356bcecb39a0
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
51b39ce770af475df93655210932a43616d43653209ade5c5402183f4b63950a
|
||||
0fbed85e334349fcd1a0aa8e2cbbaa50d2d6fef159271089e181d86bcfdc0d51
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
0bc832accea72dae9df6e95c985ee5ac330cb9b8fb6a0608d9ddeabcd9668610
|
||||
8d1b14ad05e5d64e1b0664f6454579fa49d7aee20d4bac34b5eb8c5ed4450092
|
||||
@@ -8,8 +8,7 @@ use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
/// Files above this size open with expensive features (LSP, tree-sitter
|
||||
/// structure, folding) disabled.
|
||||
/// Files above this size open with reduced editor features.
|
||||
pub const LARGE_FILE_THRESHOLD: u64 = 5 * 1024 * 1024;
|
||||
/// Files above this size open read-only.
|
||||
pub const READ_ONLY_THRESHOLD: u64 = 50 * 1024 * 1024;
|
||||
|
||||
@@ -29,8 +29,8 @@ pub struct DocumentInfo {
|
||||
/// (archive entries, JDT sources with an editable attachment encoding,
|
||||
/// Git revisions); false for server-generated content (decompiled code).
|
||||
pub can_reload_encoding: bool,
|
||||
/// Larger than `ide_vfs::LARGE_FILE_THRESHOLD`: language servers, syntax
|
||||
/// structure and folding are disabled; the editor should drop heavy features.
|
||||
/// Marks files above `ide_vfs::LARGE_FILE_THRESHOLD` for reduced editor
|
||||
/// features such as disabling language servers and folding.
|
||||
#[specta(optional)]
|
||||
pub large: bool,
|
||||
/// Effective `.editorconfig` properties, when any section applies.
|
||||
|
||||
@@ -152,7 +152,9 @@ double click and Enter with `event.table_activate()` (API 1.3, absolute 0-based
|
||||
Bodies, fields and events added by later APIs travel as `Other { kind, data }`: an IDE that
|
||||
doesn't know a body says it needs updating, and leaves out a field type it doesn't know.
|
||||
Item right-click menus use `viewItem.context` (see
|
||||
[Commands and actions](/en/plugins/guides/commands#menus)).
|
||||
[Commands and actions](/en/plugins/guides/commands#menus)). A command that menu offers for the selected item,
|
||||
run from its shortcut (or Find Action) while the view has the keyboard focus, gets that
|
||||
item's key as its argument, as from the menu; none when nothing is selected.
|
||||
|
||||
## Custom editors
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ Each contribution point is a table (`[contributes.settings]`) or an array of tab
|
||||
| `customEditors` | `id`, `title`, `patterns`, `priority`, `layout?`, `web?` | without `web` | [Views and decorations](/en/plugins/guides/views) |
|
||||
| `markerIcons` | `id`, `icon`, `iconDark?`, `markers?`, `tooltip?` (API 1.3): gutter marker icons | no | [Language features](/en/plugins/guides/language-features) |
|
||||
| `editorPanels` | `id`, `web`, `width`, `when?` (API 1.9; needs `editor.read`) | no | [README: Editor panels](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#editor-panels) |
|
||||
| `overlays` | `id`, `web`, `width`, `height`, `anchor?`, `when?`, `interactive?` (API 1.18) | no | [README: Overlays](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#overlays) |
|
||||
| `fileIcons` | `id`, `patterns`, `icon`, `iconDark?` | no | [Icon themes](/en/plugins/guides/icon-themes) |
|
||||
| `fileTemplates` | `id`, `name`, `extension`, `path`; API 1.3: `fileName`, `variables` | no | [File actions](/en/plugins/guides/file-actions) |
|
||||
| `snippets` | `language`, `path` (API 1.4) | no | [Language features](/en/plugins/guides/language-features) |
|
||||
|
||||
@@ -31,7 +31,8 @@ The plugin API has one version number: the version of the WIT package in [`wit/`
|
||||
| 1.14.0 | In development on `main` | Optional `hover-actions` export: left-edge line actions revealed by line-edge hover, with an anchor line and inclusive trigger range; `[[contributes.javaAgents]]` `vmOptions` / `jdk`: JVM flags (optionally JetBrains Runtime–only) before `-javaagent:`; `ui.set-status-item-menu` / `set-window-status-item-menu`: a menu on a status bar item |
|
||||
| 1.15.0 | In development on `main` | `caret-moved` event; declarative `[[contributes.skills]]` (`path = "skills/<name>/SKILL.md"`) for bundling agent skills in plugins |
|
||||
| 1.16.0 | OpenIDEA 0.1.52 | Optional `completion-list-provider` export: completion marked incomplete is asked again while typing on, without re-asking the language server or other plugins; `decorations.set-markdown`: line-end decorations whose hover is a Markdown card |
|
||||
| 1.17.0 | In development on `main` | `decorations.set-styled`: editor decorations with their own `#rrggbb` / `#rrggbbaa` foreground and background, for colors outside the theme palette |
|
||||
| 1.17.0 | OpenIDEA 0.1.53 | `decorations.set-styled`: editor decorations with their own `#rrggbb` / `#rrggbbaa` foreground and background, for colors outside the theme palette |
|
||||
| 1.18.0 | In development on `main` | `[[contributes.overlays]]`: a package web page floating over the workbench that never takes the keyboard focus, placed and resized through `openidea.overlay` |
|
||||
|
||||
The full list of what each version added is in [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md).
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ register_plugin!(TodoFinder, views);
|
||||
双击和回车用 `event.table_activate()`(API 1.3,从 0 开始的绝对行号)。
|
||||
|
||||
后续 API 新增的主体、字段和事件以 `Other { kind, data }` 传递:IDE 不认识某种主体时会提示需要更新,
|
||||
不认识的字段类型则直接省略。条目右键菜单使用 `viewItem.context`(见 [命令与动作](/zh/plugins/guides/commands) 中的“菜单”一节)。
|
||||
不认识的字段类型则直接省略。条目右键菜单使用 `viewItem.context`(见 [命令与动作](/zh/plugins/guides/commands) 中的“菜单”一节)。视图有键盘焦点时,用快捷键(或查找动作)运行选中条目的右键菜单里有的命令,命令参数是该条目的 key,与从菜单运行相同;未选中条目时没有参数。
|
||||
|
||||
## 自定义编辑器
|
||||
|
||||
|
||||
@@ -100,35 +100,36 @@ optional = ["net:api.openai.com", "secrets"]
|
||||
|
||||
每个贡献点是一张表(`[contributes.settings]`)或一个表数组(`[[contributes.commands]]`)。插件启用后贡献立即生效,不需要等代码加载。
|
||||
|
||||
| 贡献点 | 声明字段 | 需要代码 | 指南 |
|
||||
| ------------------- | ---------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `commands` | `id`、`title`、`category?`、`when?`、`icon?` | 执行时需要 | [命令与动作](/zh/plugins/guides/commands) |
|
||||
| `menus` | `menu`、`command`、`when?`、`view?`、`submenu?` | 否 | [命令与动作](/zh/plugins/guides/commands) |
|
||||
| `keymaps` | `command`、`key`、`mac?`、`when?`(仅 Escape) | 否 | [命令与动作](/zh/plugins/guides/commands) |
|
||||
| `statusBar` | `id`、`text`、`tooltip?`、`command?`、`align?`、`priority?` | 否 | [视图与装饰](/zh/plugins/guides/views) |
|
||||
| `settings` | `schema`(JSON 文件)或 `pages`(API 1.3)、`title?` | 否 | [生命周期与事件](/zh/plugins/lifecycle) |
|
||||
| `secrets` | `name`、`label`、`description?` | 使用时需要 | [权限与能力](/zh/plugins/capabilities) |
|
||||
| `providers` | `kinds`、`languages` | 是 | [语言功能](/zh/plugins/guides/language-features) |
|
||||
| `documentIndexers` | `extensions` | 是 | [索引](/zh/plugins/guides/indexing) |
|
||||
| `endpoints` | `files`(API 1.3) | 是 | [README:Project HTTP endpoints](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#project-http-endpoints-api-13) |
|
||||
| `searchCategories` | `id`、`title`(API 1.13) | 是 | [自定义搜索分类](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#custom-search-everywhere-categories-api-111) |
|
||||
| `views` | `id`、`title`、`icon?`、`location`、`web?`、`group?`、`when?` | 无 `web` 时需要 | [视图与装饰](/zh/plugins/guides/views) |
|
||||
| `customEditors` | `id`、`title`、`patterns`、`priority`、`layout?`、`web?` | 无 `web` 时需要 | [视图与装饰](/zh/plugins/guides/views) |
|
||||
| `markerIcons` | `id`、`icon`、`iconDark?`、`markers?`、`tooltip?`(API 1.3):装订区标记图标 | 否 | [语言功能](/zh/plugins/guides/language-features) |
|
||||
| `editorPanels` | `id`、`web`、`width`、`when?`(API 1.9;需要 `editor.read`) | 否 | [README:Editor panels](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#editor-panels) |
|
||||
| `fileIcons` | `id`、`patterns`、`icon`、`iconDark?` | 否 | [图标主题](/zh/plugins/guides/icon-themes) |
|
||||
| `fileTemplates` | `id`、`name`、`extension`、`path`;API 1.3:`fileName`、`variables` | 否 | [文件操作](/zh/plugins/guides/file-actions) |
|
||||
| `snippets` | `language`、`path`(API 1.4) | 否 | [语言功能](/zh/plugins/guides/language-features) |
|
||||
| `commitChecks` | `id`、`title` | 是 | [README:Commits](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#commits) |
|
||||
| `serverCommands` | `server`、`command`、`run`(API 1.9) | 是 | [README:Commands a server hands to the client](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#commands-a-server-hands-to-the-client) |
|
||||
| `runDetectors` | `id`、`name`、`files`、`command`、`args?`、`test?`、`framework?` | 否 | [运行目标](/zh/plugins/guides/run-targets) |
|
||||
| `runConfigurations` | `files`(API 1.4) | 是 | [运行目标](/zh/plugins/guides/run-targets) |
|
||||
| `javaAgents` | `path`、`args?`(API 1.10);`vmOptions?`、`jdk?`(API 1.14) | 否 | [README:Java agents](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#java-agents-api-110) |
|
||||
| `skills` | `path`(`skills/<name>/SKILL.md`,API 1.15) | 否 | [README:API 1.15](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#api-115) |
|
||||
| `mcpTools` | `name`、`description`、`inputSchema`、`readOnly`、`destructive`(API 1.4) | 是 | [MCP 工具](/zh/plugins/guides/mcp) |
|
||||
| `themes` | `path`、`editor-scheme?` | 否 | [主题](/zh/plugins/guides/themes) |
|
||||
| `iconThemes` | `id`、`label`、`path` | 否 | [图标主题](/zh/plugins/guides/icon-themes) |
|
||||
| `languages` | `path`(`languages/<id>.toml` 格式的文件) | 否 | [添加语言](/zh/languages/adding) |
|
||||
| 贡献点 | 声明字段 | 需要代码 | 指南 |
|
||||
| ------------------- | ------------------------------------------------------------------------------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `commands` | `id`、`title`、`category?`、`when?`、`icon?` | 执行时需要 | [命令与动作](/zh/plugins/guides/commands) |
|
||||
| `menus` | `menu`、`command`、`when?`、`view?`、`submenu?` | 否 | [命令与动作](/zh/plugins/guides/commands) |
|
||||
| `keymaps` | `command`、`key`、`mac?`、`when?`(仅 Escape) | 否 | [命令与动作](/zh/plugins/guides/commands) |
|
||||
| `statusBar` | `id`、`text`、`tooltip?`、`command?`、`align?`、`priority?` | 否 | [视图与装饰](/zh/plugins/guides/views) |
|
||||
| `settings` | `schema`(JSON 文件)或 `pages`(API 1.3)、`title?` | 否 | [生命周期与事件](/zh/plugins/lifecycle) |
|
||||
| `secrets` | `name`、`label`、`description?` | 使用时需要 | [权限与能力](/zh/plugins/capabilities) |
|
||||
| `providers` | `kinds`、`languages` | 是 | [语言功能](/zh/plugins/guides/language-features) |
|
||||
| `documentIndexers` | `extensions` | 是 | [索引](/zh/plugins/guides/indexing) |
|
||||
| `endpoints` | `files`(API 1.3) | 是 | [README:Project HTTP endpoints](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#project-http-endpoints-api-13) |
|
||||
| `searchCategories` | `id`、`title`(API 1.13) | 是 | [自定义搜索分类](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#custom-search-everywhere-categories-api-111) |
|
||||
| `views` | `id`、`title`、`icon?`、`location`、`web?`、`group?`、`when?` | 无 `web` 时需要 | [视图与装饰](/zh/plugins/guides/views) |
|
||||
| `customEditors` | `id`、`title`、`patterns`、`priority`、`layout?`、`web?` | 无 `web` 时需要 | [视图与装饰](/zh/plugins/guides/views) |
|
||||
| `markerIcons` | `id`、`icon`、`iconDark?`、`markers?`、`tooltip?`(API 1.3):装订区标记图标 | 否 | [语言功能](/zh/plugins/guides/language-features) |
|
||||
| `editorPanels` | `id`、`web`、`width`、`when?`(API 1.9;需要 `editor.read`) | 否 | [README:Editor panels](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#editor-panels) |
|
||||
| `overlays` | `id`、`web`、`width`、`height`、`anchor?`、`when?`、`interactive?`(API 1.18) | 否 | [README:Overlays](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#overlays) |
|
||||
| `fileIcons` | `id`、`patterns`、`icon`、`iconDark?` | 否 | [图标主题](/zh/plugins/guides/icon-themes) |
|
||||
| `fileTemplates` | `id`、`name`、`extension`、`path`;API 1.3:`fileName`、`variables` | 否 | [文件操作](/zh/plugins/guides/file-actions) |
|
||||
| `snippets` | `language`、`path`(API 1.4) | 否 | [语言功能](/zh/plugins/guides/language-features) |
|
||||
| `commitChecks` | `id`、`title` | 是 | [README:Commits](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#commits) |
|
||||
| `serverCommands` | `server`、`command`、`run`(API 1.9) | 是 | [README:Commands a server hands to the client](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#commands-a-server-hands-to-the-client) |
|
||||
| `runDetectors` | `id`、`name`、`files`、`command`、`args?`、`test?`、`framework?` | 否 | [运行目标](/zh/plugins/guides/run-targets) |
|
||||
| `runConfigurations` | `files`(API 1.4) | 是 | [运行目标](/zh/plugins/guides/run-targets) |
|
||||
| `javaAgents` | `path`、`args?`(API 1.10);`vmOptions?`、`jdk?`(API 1.14) | 否 | [README:Java agents](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#java-agents-api-110) |
|
||||
| `skills` | `path`(`skills/<name>/SKILL.md`,API 1.15) | 否 | [README:API 1.15](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#api-115) |
|
||||
| `mcpTools` | `name`、`description`、`inputSchema`、`readOnly`、`destructive`(API 1.4) | 是 | [MCP 工具](/zh/plugins/guides/mcp) |
|
||||
| `themes` | `path`、`editor-scheme?` | 否 | [主题](/zh/plugins/guides/themes) |
|
||||
| `iconThemes` | `id`、`label`、`path` | 否 | [图标主题](/zh/plugins/guides/icon-themes) |
|
||||
| `languages` | `path`(`languages/<id>.toml` 格式的文件) | 否 | [添加语言](/zh/languages/adding) |
|
||||
|
||||
条目 id(命令、视图、主题等)匹配 `[a-z0-9][a-z0-9._-]*`,不超过 64 个字符。菜单、快捷键和状态栏项只能引用插件自己声明的命令;在 IDE 内部,命令的操作 id 是 `plugin.<plugin id>.<command id>`。
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ description: "engines.openidea、插件 API 从 1.0 到 1.13 的各个版本,
|
||||
| 1.14.0 | `main` 上开发中 | 可选 `hover-actions` 导出:行内侧 hover 显示的左侧操作,带锚定行和包含式触发行范围; `[[contributes.javaAgents]]` 的 `vmOptions` / `jdk`:在 `-javaagent:` 之前注入 JVM 参数(可选仅 JetBrains Runtime);`ui.set-status-item-menu` / `set-window-status-item-menu`:状态栏项菜单 |
|
||||
| 1.15.0 | `main` 上开发中 | `caret-moved` 事件;声明式 `[[contributes.skills]]`(`path = "skills/<name>/SKILL.md"`),在插件包中打包代理技能 |
|
||||
| 1.16.0 | OpenIDEA 0.1.52 | 可选 `completion-list-provider` 导出:标记为不完整的补全在继续输入时再次询问,不会重新询问语言服务器和其他插件;`decorations.set-markdown`:悬停显示 Markdown 卡片的行尾装饰 |
|
||||
| 1.17.0 | `main` 上开发中 | `decorations.set-styled`:自带 `#rrggbb` / `#rrggbbaa` 前景色和背景色的编辑器装饰,用于主题调色板之外的颜色 |
|
||||
| 1.17.0 | OpenIDEA 0.1.53 | `decorations.set-styled`:自带 `#rrggbb` / `#rrggbbaa` 前景色和背景色的编辑器装饰,用于主题调色板之外的颜色 |
|
||||
| 1.18.0 | `main` 上开发中 | `[[contributes.overlays]]`:悬浮在工作台上方、从不抢占键盘焦点的插件网页,可通过 `openidea.overlay` 移动和调整大小 |
|
||||
|
||||
每个版本新增内容的完整列表见 [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md)。
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("shows why the frames did not load and retries them", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 940, height: 740 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const stateModule = "/src/features/debugger/state.ts";
|
||||
const workbenchModule = "/src/workbench/contributions.ts";
|
||||
const { adoptSession, handleDebugEvent } = await import(/* @vite-ignore */ stateModule);
|
||||
const { toolWindowService } = await import(/* @vite-ignore */ workbenchModule);
|
||||
const handlers = window.__ipc.handlers;
|
||||
let failures = 1;
|
||||
handlers.debug_stack_trace = () => {
|
||||
if (failures-- > 0)
|
||||
throw { kind: "protocol", message: "debug adapter did not answer `stackTrace` in time", detail: null };
|
||||
return [{ id: 7, name: "OrderController.place(Order)", path: null, line: 41, column: 0, presentationHint: null }];
|
||||
};
|
||||
handlers.debug_threads = () => [{ id: 9, name: "http-nio-8080-exec-9" }];
|
||||
handlers.debug_scopes = () => [];
|
||||
adoptSession(98, { name: "Orders", adapter: "java-debug", status: "running" });
|
||||
toolWindowService().show("debug", true);
|
||||
handleDebugEvent(98, {
|
||||
kind: "stopped",
|
||||
threadId: 9,
|
||||
allThreadsStopped: false,
|
||||
reason: "breakpoint",
|
||||
description: null,
|
||||
});
|
||||
});
|
||||
|
||||
const frames = page.getByRole("region", { name: "Debug", exact: true }).getByRole("listbox", { name: "Frames" });
|
||||
const error = frames.getByRole("alert");
|
||||
await expect(error).toContainText("Could not load the frames: debug adapter did not answer `stackTrace` in time");
|
||||
await page.screenshot({ path: test.info().outputPath("frames-error.png") });
|
||||
await error.getByRole("button", { name: "Retry" }).click();
|
||||
await expect(frames.getByText("OrderController.place(Order)", { exact: true })).toBeVisible();
|
||||
await expect(error).toBeHidden();
|
||||
expect(await ipcCalls(page, "debug_stack_trace")).toEqual([
|
||||
{ session: 98, threadId: 9 },
|
||||
{ session: 98, threadId: 9 },
|
||||
]);
|
||||
});
|
||||
@@ -36,7 +36,7 @@ sdk/rust/openidea-plugin/ # the Rust SDK (host API, Plugin trait, mock host)
|
||||
crates/ide-plugin/tests/fixtures/ # test plugins: hello, jobs, language-toy, misbehave, semantic-tokens, hover, commit, inlay-hints, decorations
|
||||
```
|
||||
|
||||
The plugin API is defined in [`wit/`](../wit/) (`openidea:[email protected]7.0`, world
|
||||
The plugin API is defined in [`wit/`](../wit/) (`openidea:[email protected]8.0`, world
|
||||
`plugin`).
|
||||
|
||||
## 1. Quick start
|
||||
@@ -157,6 +157,7 @@ work), but 0.1 code no longer runs: rebuild it against the 1.0 SDK.
|
||||
| `views` | `id`, `title`, `icon?` (an icon name or a package SVG), `location` (`left`, `right`, `bottom`, `services`), `web?` (_Web views_), `frames?` (API 1.16), `group?`, `when?` (API 1.3) | without `web` |
|
||||
| `customEditors` | `id`, `title`, `patterns` (file names), `priority` (`default`, `option`), `layout?`, `web?`, `frames?`, `binary?` (API 1.16) | without `web` |
|
||||
| `editorPanels` | `id`, `web`, `width` (pixels, 40–400), `when?`, `frames?` (API 1.16) — needs `editor.read` (API 1.9; _Editor panels_) | no |
|
||||
| `overlays` | `id`, `web`, `width`, `height` (pixels, 40–800), `anchor?`, `when?`, `interactive?` — floats over the workbench, never takes the focus (API 1.18; _Overlays_) | no |
|
||||
| `fileIcons` | `id`, `patterns` (file names), `icon` (SVG), `iconDark?` — whatever icon theme is in use | no |
|
||||
| `fileTemplates` | `id`, `name`, `extension`, `path`; API 1.3: `fileName`, `variables = [{ name, prompt }]` — New menu | no |
|
||||
| `commitChecks` | `id`, `title` — a before-commit check in Commit Options (see _Commits_) | yes |
|
||||
@@ -170,7 +171,11 @@ its first `:`, so `pod` for `pod:default/nginx`; the whole key when it has no
|
||||
`:`). Only the menu's `when` sees them, not the command's own `when`; a command
|
||||
whose `when` is false shows greyed out. Other menus refuse `view`, a web view
|
||||
has no item menu, and no menu opens when no declaration matches the item.
|
||||
The menu is new in API 1.2, so a plugin using it declares
|
||||
A command run without an argument (its shortcut, Find Action) while one of the
|
||||
plugin's views has the keyboard focus gets the selected item's key too, when
|
||||
that item's `viewItem.context` menu offers the command: a shortcut acts on the
|
||||
selected item like the menu entry. With nothing selected, the focus elsewhere or
|
||||
the command not in the item's menu, it gets none. The menu is new in API 1.2, so a plugin using it declares
|
||||
`engines.openidea = "^1.2"`. For example:
|
||||
|
||||
```toml
|
||||
@@ -427,9 +432,19 @@ are always available. Calling a gated function without its capability returns
|
||||
|
||||
## 3. Writing code (Rust SDK)
|
||||
|
||||
### API 1.18
|
||||
|
||||
API 1.18.0 is in development on `main`. Use `engines.openidea = "^1.18"` and the
|
||||
matching SDK. Plugins for 1.17 and earlier keep working. New in 1.18:
|
||||
|
||||
- **Overlays (`[[contributes.overlays]]`).** A web page of the package floats over
|
||||
the workbench at one of nine anchors while its `when` holds, without ever taking
|
||||
the keyboard focus — a mascot, a reaction, a timer. The page moves and resizes
|
||||
itself with `openidea.overlay`. No code or capability needed. See [Overlays](#overlays).
|
||||
|
||||
### API 1.17
|
||||
|
||||
API 1.17.0 is in development on `main`. Use `engines.openidea = "^1.17"` and the
|
||||
API 1.17.0 shipped with OpenIDEA 0.1.53. Use `engines.openidea = "^1.17"` and the
|
||||
matching SDK. Plugins for 1.16 and earlier keep working. New in 1.17:
|
||||
|
||||
- [Editor decorations](#editor-and-project-snapshots-api-14):
|
||||
@@ -2286,6 +2301,46 @@ line's length until it lays the line out; `onLayout` follows when it does.
|
||||
`crates/ide-plugin/tests/fixtures/editor-panel` is a minimal minimap (each line
|
||||
2 px, its frame draggable, problems marked at its right edge, folded lines left out, the selected lines and the caret's line tinted, VCS changes at its left edge) to install and try.
|
||||
|
||||
#### Overlays
|
||||
|
||||
With API 1.18 (`engines.openidea = "^1.18"`), a web page can float over the
|
||||
workbench — over the editor, tool windows and all — without ever taking the
|
||||
keyboard focus: a mascot reacting to your work, a timer, a reaction GIF. It needs
|
||||
no code and no capability, since it sees nothing of the IDE:
|
||||
|
||||
```toml
|
||||
[[contributes.overlays]]
|
||||
id = "stage"
|
||||
web = "web/stage.html" # the same rules as a web view's page
|
||||
width = 320 # pixels, 40–800
|
||||
height = 240
|
||||
anchor = "bottom-right" # optional: top-left, top-center, top-right, middle-left,
|
||||
# center, middle-right, bottom-left, bottom-center, bottom-right
|
||||
when = "plugin.<id>.showing" # optional: the plugin's own key through `host::set_context`
|
||||
interactive = true # optional: false lets every click through to the IDE
|
||||
```
|
||||
|
||||
The overlay is in the window while `when` holds (always, without one), clear of
|
||||
the title and status bars, under dialogs, popups and notifications. Its frame is
|
||||
out of the tab order and is never focused when it appears, so typing carries on in
|
||||
the editor; a click in an interactive overlay goes to its page, as any click does.
|
||||
With `interactive = false` the frame lets every click through. The frame is
|
||||
transparent: draw only what should show. When the page can't be loaded (the
|
||||
plugin was disabled meanwhile), the overlay shows nothing.
|
||||
|
||||
The page gets `openidea.overlay` (only an overlay's page has it), besides
|
||||
`postMessage` / `onMessage` to the plugin's code and the theme:
|
||||
|
||||
| `openidea.overlay` | What it does |
|
||||
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `get()` | `{ anchor, width, height }`: where the overlay is and its size, the declaration's until the page changes them |
|
||||
| `place({ anchor?, width?, height? })` | Moves the overlay to another anchor and/or resizes it (sizes clamped to 40–800 and to the window); resolves with `get()`, rejects an unknown anchor |
|
||||
|
||||
The placement lasts while the overlay is shown; the next time `when` holds it
|
||||
starts again from the declaration. To fit a picture, the page measures it and
|
||||
places the overlay at that size. `crates/ide-plugin/tests/fixtures/overlay` is a
|
||||
minimal card that moves itself around the window.
|
||||
|
||||
### Web frame PTYs (API 1.3)
|
||||
|
||||
Packages requiring `engines.openidea = "^1.3"` can exchange JSON strings through
|
||||
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
25da773f6dee3c966c529d526415bbbd763c5c144660b1e2744737f2bfe0fb65
|
||||
9707d34e02d000e032f3e63490367d516304938baf700d513ddc7d80498aabd1
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
e42622d525d315a5a5d186197e17624ec713ec1d9a47a0dbc67abfeb61854971
|
||||
7ad3b999327aa429b7e6a6f526fe80b8d1b183c3e2d88f1a0abb32ea89aa4e8f
|
||||
Бінарний файл не відображається.
Loaded 100 of 224 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Заблокувати користувача