Порівняти коміти

..
Автор SHA1 Повідомлення Дата
arookieofc f8c372929c chore: fix README formatting for oxfmt check 2026-11-10 13:18:33 +08:00
arookieofc 4568272dc3 fix(boot): ignore ResizeObserver loop also when delivered as an Error (#2468)
WebKit (Tauri on Linux) can report the benign loop notification with
an Error object attached, which bypassed the bare-message guard and
showed a fatal startup dialog. Match on the engine-generated message
instead; no genuine startup failure carries these strings.
2026-11-10 13:10:00 +08:00
33 змінених файлів з 85 додано та 622 видалено

No files matched your search

+2 -9
Переглянути файл
@@ -55,9 +55,8 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [typescript, python, rust, go, java, kotlin, php, c, cpp]
# C/C++ debug with GDB, whose DAP interpreter needs 14+: 22.04 ships 12.1, 24.04 ships 15.
runs-on: ${{ (matrix.language == 'c' || matrix.language == 'cpp') && 'ubuntu-24.04' || 'ubuntu-22.04' }}
language: [typescript, python, rust, go, java, kotlin, php]
runs-on: ubuntu-22.04
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
@@ -76,12 +75,6 @@ jobs:
- if: matrix.language == 'typescript'
run: npm install --global "@vtsls/language-server@$VTSLS" "typescript@$TYPESCRIPT"
# The smoke builds the c-app fixture and debugs it with GDB's own DAP interpreter.
- if: matrix.language == 'c' || matrix.language == 'cpp'
run: |
sudo apt-get update
sudo apt-get install -y gdb
- if: matrix.language == 'python'
uses: actions/setup-python@v5
with: { python-version: "3.12" }
+3 -197
Переглянути файл
@@ -103,14 +103,6 @@ fn builtin(adapter: &str) -> Option<DebuggerConfig> {
"lldb-dap" => {
cfg("lldb-dap", &[], "stdio", "Install LLVM's lldb-dap (brew install llvm; on macOS `xcrun -f lldb-dap`)")
}
// GDB's own DAP interpreter, stdio transport. The DAP support it needs shipped in GDB 14
// (`prepare_gdb` refuses older ones with the required version in the message).
"gdb" => cfg(
"gdb",
&["-i", "dap"],
"stdio",
"Install GDB 14 or newer (apt install gdb, dnf install gdb, brew install gdb)",
),
"rdbg" => cfg("rdbg", &["-O", "--port", PORT_PLACEHOLDER, "-c"], "tcp", "gem install debug"),
// A jdtls bundle: the session is started through jdtls and reached via `debugServer`.
"java-debug" => cfg(
@@ -137,7 +129,6 @@ pub fn default_type(adapter: &str) -> Option<&'static str> {
"delve" => "go",
"netcoredbg" => "coreclr",
"lldb-dap" => "lldb-dap",
"gdb" => "gdb",
"java-debug" => "java",
_ => return None,
})
@@ -344,89 +335,6 @@ pub async fn prepare_debugpy(spec: &mut AdapterSpec) -> IdeResult<()> {
)))
}
/// GDB's DAP interpreter (`-i dap`) shipped in GDB 14; older ones exit with
/// "Interpreter `dap' unrecognized".
const GDB_MIN_MAJOR: u32 = 14;
/// `(major, minor)` of the first version number in the output of `gdb --version`
/// (`GNU gdb (GDB) 14.2`, `GNU gdb (Ubuntu 12.1-0ubuntu1~22.04.2) 12.1`, `GNU gdb
/// (GDB) 15.0.50.20240403-0ubuntu1`). `None` when no standalone version number is there.
pub fn parse_gdb_version(output: &str) -> Option<(u32, u32)> {
let line = output.lines().next()?;
// Distribution names can contain versions, e.g. `(GDB; SUSE Linux Enterprise 15) 14.2`.
let line = line.rsplit_once(')').map_or(line, |(_, version)| version);
let b = line.as_bytes();
let mut i = 0;
while i < b.len() {
if !b[i].is_ascii_digit() {
i += 1;
continue;
}
let start = i;
while i < b.len() && b[i].is_ascii_digit() {
i += 1;
}
let major: u32 = line[start..i].parse().ok()?;
let mut minor = 0;
if i + 1 < b.len() && b[i] == b'.' && b[i + 1].is_ascii_digit() {
i += 1;
let ms = i;
while i < b.len() && b[i].is_ascii_digit() {
i += 1;
}
minor = line[ms..i].parse().unwrap_or(0);
}
// A version stands alone: `mingw32-gdb13.exe`'s embedded digits are part of a word.
if start > 0 && (b[start - 1].is_ascii_alphabetic() || b[start - 1] == b'_') {
continue;
}
return Some((major, minor));
}
None
}
/// Probe the already resolved and verified executable with its launch environment.
async fn gdb_version(binary: &Path, spec: &AdapterSpec) -> IdeResult<Option<(u32, u32)>> {
let mut probe = Command::new(binary);
if let Some(path) = adapter_path(&spec.env) {
probe.env("PATH", path);
}
ide_core::process::prepare(probe.as_std_mut());
let probe = probe
.arg("--version")
.current_dir(&spec.cwd)
.envs(spec.env.iter().cloned())
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::null())
.kill_on_drop(true)
.output();
let Ok(Ok(out)) = tokio::time::timeout(Duration::from_secs(15), probe).await else {
return Ok(None);
};
Ok(parse_gdb_version(&String::from_utf8_lossy(&out.stdout)))
}
/// Refuse old GDB versions and report whether launch must follow configurationDone.
/// GDB 15 starts the inferior in launch; 14 and 16+ start it at configurationDone.
async fn prepare_gdb(spec: &AdapterSpec, binary: &Path) -> IdeResult<bool> {
let Some((major, minor)) = gdb_version(binary, spec).await? else {
return Ok(false);
};
if major >= GDB_MIN_MAJOR {
return Ok(major == 15);
}
let mut msg = format!(
"debugging with GDB needs GDB {GDB_MIN_MAJOR} or newer (found {major}.{minor}): \
this one has no DAP interpreter (`gdb -i dap`)"
);
if let Some(hint) = &spec.install_hint {
msg.push_str(". ");
msg.push_str(hint);
}
Err(IdeError::unavailable(msg))
}
/// An adapter that is a plugin of another program (java-debug, a jdtls bundle) rather
/// than a program: it has no process of its own and is reached through `debugServer`.
pub fn is_plugin_bundle(command: &str) -> bool {
@@ -460,8 +368,6 @@ pub type BoxWriter = Box<dyn AsyncWrite + Unpin + Send>;
/// A connected adapter: byte streams plus the process (if we spawned one).
pub struct AdapterIo {
/// GDB 15 starts running inside `launch`; configure breakpoints before sending it.
pub launch_after_configuration: bool,
pub reader: BoxReader,
pub writer: BoxWriter,
pub child: Option<Child>,
@@ -513,7 +419,6 @@ impl AdapterLauncher for ProcessLauncher {
let stream = connect_with_retries(host, port, None, timeout).await?;
let (r, w) = stream.into_split();
return Ok(AdapterIo {
launch_after_configuration: false,
reader: Box::new(r),
writer: Box::new(w),
child: None,
@@ -537,7 +442,6 @@ impl AdapterLauncher for ProcessLauncher {
let _ = stream.set_nodelay(true);
let (r, w) = stream.into_split();
return Ok(AdapterIo {
launch_after_configuration: false,
reader: Box::new(r),
writer: Box::new(w),
child: None,
@@ -566,15 +470,9 @@ impl AdapterLauncher for ProcessLauncher {
.ok_or_else(|| missing(&spec))?
}
};
let launch_after_configuration =
if spec.adapter == "gdb" && spec.target.is_none() { prepare_gdb(&spec, &binary).await? } else { false };
let base_args = substitute_root(&spec.args, &spec.cwd);
match spec.transport {
Transport::Stdio => {
let mut io = spawn_adapter(&spec, &binary, &base_args, None, CONNECT_TIMEOUT).await?;
io.launch_after_configuration = launch_after_configuration;
Ok(io)
}
Transport::Stdio => spawn_adapter(&spec, &binary, &base_args, None, CONNECT_TIMEOUT).await,
Transport::Tcp => {
// An embedded adapter started without `${port}` listens on its usual
// address; every other TCP adapter gets a port chosen here so it can be
@@ -591,10 +489,7 @@ impl AdapterLauncher for ProcessLauncher {
};
let args = substitute_port(&base_args, port);
match spawn_adapter(&spec, &binary, &args, Some(port), start_timeout).await {
Ok(mut io) => {
io.launch_after_configuration = launch_after_configuration;
return Ok(io);
}
Ok(io) => return Ok(io),
Err(e) => {
if fixed.is_none() && attempt < PORT_ATTEMPTS && is_port_race(&e) {
tracing::warn!(
@@ -657,7 +552,6 @@ async fn spawn_adapter(
let stdin = child.stdin.take().ok_or_else(|| IdeError::internal("adapter stdin unavailable"))?;
let stdout = child.stdout.take().ok_or_else(|| IdeError::internal("adapter stdout unavailable"))?;
Ok(AdapterIo {
launch_after_configuration: false,
reader: Box::new(stdout),
writer: Box::new(stdin),
child: Some(child),
@@ -689,7 +583,6 @@ async fn spawn_adapter(
};
let (r, w) = stream.into_split();
Ok(AdapterIo {
launch_after_configuration: false,
reader: Box::new(r),
writer: Box::new(w),
child: Some(child),
@@ -847,102 +740,15 @@ mod tests {
#[test]
fn builtins_cover_common_adapters() {
for name in ["codelldb", "debugpy", "js-debug", "delve", "netcoredbg", "java-debug", "gdb"] {
for name in ["codelldb", "debugpy", "js-debug", "delve", "netcoredbg", "java-debug"] {
let cfg = builtin(name).unwrap();
assert!(cfg.install_hint.is_some());
}
let delve = resolve(&builtin("delve").unwrap(), PathBuf::from("/"));
assert_eq!(delve.transport, Transport::Tcp);
// GDB's own DAP interpreter over stdio, with the required version in its hint.
let gdb = builtin("gdb").unwrap();
assert_eq!(gdb.command, "gdb");
assert_eq!(gdb.args, ["-i", "dap"]);
assert_eq!(gdb.transport, "stdio");
assert!(gdb.install_hint.as_deref().is_some_and(|h| h.contains("14")), "{gdb:?}");
assert_eq!(default_type("gdb"), Some("gdb"));
assert!(builtin("nope").is_none());
}
/// The first version number of `gdb --version`'s first line, however the distro decorates it.
#[test]
fn parses_gdb_versions() {
for (out, want) in [
("GNU gdb (GDB) 14.2\nCopyright (C) 2023 Free Software Foundation", Some((14, 2))),
("GNU gdb (GDB) 15.0.50.20240403-0ubuntu1\n", Some((15, 0))),
("GNU gdb (Ubuntu 12.1-0ubuntu1~22.04.2) 12.1", Some((12, 1))),
("GNU gdb (Debian 13.1-3) 13.1", Some((13, 1))),
("GNU gdb (GDB) Fedora Linux 16.3-1.fc41", Some((16, 3))),
("GNU gdb (GDB; SUSE Linux Enterprise 15) 14.2", Some((14, 2))),
("GNU gdb (GDB; SUSE Linux Enterprise 15) 11.1", Some((11, 1))),
("mingw32-gdb13.exe (GDB) 13.2", Some((13, 2))),
("GNU gdb 14", Some((14, 0))),
("no version here", None),
("", None),
] {
assert_eq!(parse_gdb_version(out), want, "{out}");
}
}
#[tokio::test]
async fn gdb_probe_never_executes_a_changed_pinned_program() {
let dir = tempfile::tempdir().unwrap();
let fake = dir.path().join(if cfg!(windows) { "gdb.cmd" } else { "gdb" });
std::fs::write(&fake, "approved").unwrap();
let pin = ProgramPin::approve(&fake).unwrap();
#[cfg(windows)]
std::fs::write(&fake, "@echo off\r\necho ran>probe-ran\r\necho GNU gdb (GDB) 15.1\r\n").unwrap();
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
std::fs::write(&fake, "#!/bin/sh\ntouch probe-ran\necho 'GNU gdb (GDB) 15.1'\n").unwrap();
std::fs::set_permissions(&fake, std::fs::Permissions::from_mode(0o755)).unwrap();
}
let mut spec = resolve(&builtin("gdb").unwrap(), dir.path().to_owned());
spec.command = fake.to_string_lossy().into_owned();
spec.pinned = Some(pin);
let error = ProcessLauncher.launch(spec, None).await.err().expect("changed program is refused");
assert_eq!(error.kind, ide_core::error::ErrorKind::PermissionDenied);
assert!(!dir.path().join("probe-ran").exists(), "the version probe executed an unapproved program");
}
#[tokio::test]
async fn gdb_probe_uses_the_verified_program_and_launch_environment_once() {
use tokio::io::AsyncReadExt;
let dir = tempfile::tempdir().unwrap();
let fake = dir.path().join(if cfg!(windows) { "gdb.cmd" } else { "gdb" });
#[cfg(windows)]
std::fs::write(&fake, "@echo off\r\nif \"%~1\"==\"--version\" (\r\n echo probe>>probes\r\n echo GNU gdb ^(GDB^) %GDB_TEST_VERSION%\r\n) else (\r\n echo adapter\r\n)\r\n").unwrap();
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
std::fs::write(&fake, "#!/bin/sh\nif [ \"$1\" = --version ]; then\n echo probe >> probes\n echo \"GNU gdb (GDB) $GDB_TEST_VERSION\"\nelse\n echo adapter\nfi\n").unwrap();
std::fs::set_permissions(&fake, std::fs::Permissions::from_mode(0o755)).unwrap();
}
let pin = ProgramPin::approve(&fake).unwrap();
for (version, deferred) in [("12.1", false), ("14.2", false), ("15.1", true), ("16.3", false)] {
let mut spec = resolve(&builtin("gdb").unwrap(), dir.path().to_owned());
// Only the approved path is executable; the symbolic command must never be probed.
spec.command = "definitely-not-a-real-binary-openidea".into();
spec.pinned = Some(pin.clone());
spec.env.push(("GDB_TEST_VERSION".into(), version.into()));
let result = ProcessLauncher.launch(spec, None).await;
if version == "12.1" {
let error = result.err().expect("GDB 12 has no DAP interpreter");
assert_eq!(error.kind, ide_core::error::ErrorKind::Unavailable);
assert!(error.message.contains("GDB 14 or newer"), "{}", error.message);
assert!(error.message.contains("12.1"), "{}", error.message);
} else {
let mut io = result.unwrap();
assert_eq!(io.launch_after_configuration, deferred, "{version}");
let mut output = String::new();
io.reader.read_to_string(&mut output).await.unwrap();
assert_eq!(output.trim(), "adapter");
io.child.as_mut().unwrap().wait().await.unwrap();
}
}
assert_eq!(std::fs::read_to_string(dir.path().join("probes")).unwrap().lines().count(), 4);
}
#[test]
fn free_port_is_nonzero() {
assert_ne!(free_port().unwrap(), 0);
+12 -46
Переглянути файл
@@ -782,18 +782,6 @@ impl DebugManager {
if let Some(server) = &debug_server {
spec.server_host = server.host.clone();
}
if config.adapter == "gdb" && config.request == "launch" && debug_server.is_none() {
// GDB's DAP env replaces the entire inferior environment. Ordinary run overrides
// instead belong on the adapter process, which the inferior inherits. Explicit
// launch JSON keeps GDB's replacement semantics.
let explicit_env = config.extra_json.as_deref().is_some_and(|extra| {
serde_json::from_str::<Value>(extra).is_ok_and(|extra| extra.get("env").is_some())
});
if !explicit_env {
spec.env.extend(config.env.iter().map(|(k, v)| (k.clone(), v.clone())));
arguments.as_object_mut().unwrap().remove("env");
}
}
if let Some(cargo) = arguments.as_object_mut().and_then(|o| o.remove("cargo")) {
let cargo_args: Vec<String> = cargo
.get("args")
@@ -909,7 +897,6 @@ impl DebugManager {
e
}
})?;
let launch_after_configuration = io.launch_after_configuration && request == "launch";
let stderr = io.stderr.clone();
let (conn, incoming) = {
let stderr = stderr.clone();
@@ -952,7 +939,7 @@ impl DebugManager {
let configured = tokio::select! {
biased;
_ = session.startup_cancel.cancelled() => return Err(IdeError::cancelled()),
result = self.configure(&session, arguments, launch_after_configuration) => result,
result = self.configure(&session, arguments) => result,
};
match configured {
Ok(()) => Ok(id),
@@ -993,7 +980,7 @@ impl DebugManager {
}
}
async fn configure(&self, s: &Arc<Session>, mut arguments: Value, launch_in_config: bool) -> IdeResult<()> {
async fn configure(&self, s: &Arc<Session>, mut arguments: Value) -> IdeResult<()> {
if s.adapter == kotlin::ADAPTER {
let project = arguments
.get("projectRoot")
@@ -1059,28 +1046,16 @@ impl DebugManager {
// Launch/attach may wait for a slow runtime or a remote target. Let the adapter report
// failure; Stop cancels configuration and a closed connection fails the pending reply.
// Many adapters answer only after `configurationDone`, so don't wait for the reply yet.
// GDB 15 is the exception: its `launch` starts the program itself (14 runs at
// `configurationDone`, 16+ defers the launch there), so its launch waits below.
let mut launch = if launch_in_config {
None
} else {
let reply = s.conn.send_request(request, arguments.clone())?;
Some(Box::pin(async move { reply.await.unwrap_or(Err(DapError::Closed)) }))
};
let launch = s.conn.send_request(request, arguments)?;
let mut launch = Box::pin(async move { launch.await.unwrap_or(Err(DapError::Closed)) });
let mut initialized = s.initialized.subscribe();
let mut launch_result = None;
let got_initialized = match launch.as_mut() {
Some(launch) => tokio::select! {
r = initialized.wait_for(|v| *v) => { r.map_err(|_| DapError::Closed)?; true }
r = launch => {
r?;
launch_result = Some(());
false
}
},
None => {
initialized.wait_for(|v| *v).await.map_err(|_| DapError::Closed)?;
true
let got_initialized = tokio::select! {
r = initialized.wait_for(|v| *v) => { r.map_err(|_| DapError::Closed)?; true }
r = &mut launch => {
r?;
launch_result = Some(());
false
}
};
if !got_initialized {
@@ -1138,17 +1113,8 @@ impl DebugManager {
}
}
s.configured.store(true, Ordering::Release);
match launch.as_mut() {
Some(launch) => {
if launch_result.is_none() {
launch.await?;
}
}
None => {
// GDB 15: the breakpoints are in, so its `run` cannot miss them.
let reply = s.conn.send_request(request, arguments)?;
reply.await.unwrap_or(Err(DapError::Closed))?;
}
if launch_result.is_none() {
launch.await?;
}
if let Some(relay) = s.kotlin_relay.lock().as_mut() {
relay.release();
+18 -102
Переглянути файл
@@ -126,10 +126,6 @@ struct Script {
pending_startup: Option<bool>,
startup_error: Option<&'static str>,
close_during_startup: bool,
/// GDB 15 semantics: `initialized` right after `initialize`, the program starts at
/// `launch`, and a `configurationDone` sent while it runs is refused with `notStopped`.
gdb15_starts_at_launch: bool,
launch_after_configuration: bool,
}
impl Default for Script {
@@ -149,8 +145,6 @@ impl Default for Script {
pending_startup: None,
startup_error: None,
close_during_startup: false,
gdb15_starts_at_launch: false,
launch_after_configuration: false,
}
}
}
@@ -165,12 +159,10 @@ impl AdapterLauncher for FakeLauncher {
let (client, server) = tokio::io::duplex(1 << 16);
let log = self.log.clone();
let script = self.script.clone();
let launch_after_configuration = script.launch_after_configuration;
tokio::spawn(fake_adapter(server, log, script));
let (r, w) = tokio::io::split(client);
Box::pin(async move {
Ok(AdapterIo {
launch_after_configuration,
reader: Box::new(r),
writer: Box::new(w),
child: None,
@@ -188,7 +180,6 @@ async fn fake_adapter<S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(stream
let mut seq = 1000;
let mut pending_launch: Option<i64> = None;
let mut held: Vec<Value> = Vec::new();
let mut running = false;
macro_rules! send {
($v:expr) => {{
let mut v: Value = $v;
@@ -209,37 +200,24 @@ async fn fake_adapter<S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(stream
continue;
}
match msg["command"].as_str().unwrap_or_default() {
"initialize" => {
ok!(
msg,
json!({
"supportsConfigurationDoneRequest": true,
"supportsCompletionsRequest": true,
"supportsTerminateRequest": script.supports_terminate,
"supportsSetVariable": true,
"supportsFunctionBreakpoints": true,
"supportsDataBreakpoints": true,
"supportsStepInTargetsRequest": true,
"supportsRestartFrame": true,
"exceptionBreakpointFilters": [
{"filter": "raised", "label": "Raised"},
{"filter": "uncaught", "label": "Uncaught", "default": true, "description": "Uncaught exceptions"},
],
})
);
if script.gdb15_starts_at_launch {
// GDB 15 announces itself before it sees `launch` (which a client that
// defers it sends late).
send!(json!({"type": "event", "event": "initialized"}));
}
}
"initialize" => ok!(
msg,
json!({
"supportsConfigurationDoneRequest": true,
"supportsCompletionsRequest": true,
"supportsTerminateRequest": script.supports_terminate,
"supportsSetVariable": true,
"supportsFunctionBreakpoints": true,
"supportsDataBreakpoints": true,
"supportsStepInTargetsRequest": true,
"supportsRestartFrame": true,
"exceptionBreakpointFilters": [
{"filter": "raised", "label": "Raised"},
{"filter": "uncaught", "label": "Uncaught", "default": true, "description": "Uncaught exceptions"},
],
})
),
"launch" | "attach" => {
if script.gdb15_starts_at_launch {
// GDB 15 starts the program here and answers `launch` right away.
running = true;
ok!(msg, Value::Null);
continue;
}
if script.close_during_startup {
return;
}
@@ -311,14 +289,6 @@ async fn fake_adapter<S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(stream
ok!(msg, json!({"value": format!("{}!", msg["arguments"]["value"].as_str().unwrap()), "type": "int"}))
}
"configurationDone" => {
if script.gdb15_starts_at_launch && running {
// GDB 15 answers `configurationDone` with `notStopped` while the program
// it started at `launch` is still running.
send!(
json!({"type": "response", "request_seq": msg["seq"], "command": "configurationDone", "success": false, "message": "notStopped"})
);
continue;
}
if !script.ignore_configuration_done {
ok!(msg, Value::Null);
}
@@ -540,60 +510,6 @@ async fn stop_cancels_pending_launch_and_attach() {
}
}
/// GDB 15 must receive breakpoints and configurationDone before launch.
#[tokio::test(start_paused = true)]
async fn gdb_15_launch_waits_for_the_configuration() {
for deferred in [false, true] {
let h =
harness(Script { gdb15_starts_at_launch: true, launch_after_configuration: deferred, ..Script::default() });
let result = h.start(LaunchConfig { adapter: "gdb".into(), ..config() }).await;
if deferred {
let id = result.expect("GDB 15 defers its launch past the configuration");
let commands = h.commands();
let pos = |c: &str| commands.iter().position(|x| x == c).unwrap();
assert!(pos("launch") > pos("configurationDone"), "{commands:?}");
h.manager.stop(id).await.unwrap();
} else {
let error = result.unwrap_err();
assert!(error.message.contains("configurationDone failed: notStopped"), "{}", error.message);
}
}
}
#[tokio::test(start_paused = true)]
async fn gdb_attach_keeps_the_normal_configuration_order() {
let h = harness(Script { launch_after_configuration: true, ..Script::default() });
let id = h.start(LaunchConfig { adapter: "gdb".into(), request: "attach".into(), ..config() }).await.unwrap();
let commands = h.commands();
let pos = |c: &str| commands.iter().position(|x| x == c).unwrap();
assert!(pos("attach") < pos("configurationDone"), "{commands:?}");
h.manager.stop(id).await.unwrap();
}
#[tokio::test(start_paused = true)]
async fn gdb_run_environment_overrides_preserve_inheritance() {
for explicit in [None, Some(r#"{"env":{"ONLY":"explicit"}}"#)] {
let h = harness(Script::default());
let id = h
.start(LaunchConfig { adapter: "gdb".into(), extra_json: explicit.map(str::to_owned), ..config() })
.await
.unwrap();
let session = h.manager.session(id).unwrap();
{
let log = h.log.lock();
let args = &log.iter().find(|m| m["command"] == "launch").unwrap()["arguments"];
if explicit.is_some() {
assert_eq!(args["env"], json!({"ONLY": "explicit"}));
assert!(session.spec.env.is_empty());
} else {
assert!(args.get("env").is_none(), "GDB must inherit its process environment");
assert!(session.spec.env.contains(&("A".into(), "1".into())));
}
}
h.manager.stop(id).await.unwrap();
}
}
#[tokio::test(start_paused = true)]
async fn startup_still_reports_adapter_failure_and_connection_closure() {
for request in ["launch", "attach"] {
@@ -601,6 +517,7 @@ async fn startup_still_reports_adapter_failure_and_connection_closure() {
let error = h.start(LaunchConfig { request: request.into(), ..config() }).await.unwrap_err();
assert_eq!(error.message, format!("{request} failed: interpreter could not start"));
assert!(h.manager.sessions(None).is_empty());
let h = harness(Script { close_during_startup: true, ..Script::default() });
let error = h.start(LaunchConfig { request: request.into(), ..config() }).await.unwrap_err();
assert!(error.message.contains("debug adapter `debugpy` exited during startup"), "{error}");
@@ -2045,7 +1962,6 @@ async fn rdbg_drains_test_output_after_dap_closes_before_killing_the_process() {
});
let (reader, writer) = tokio::io::split(client);
Ok(AdapterIo {
launch_after_configuration: false,
reader: Box::new(reader),
writer: Box::new(writer),
child: Some(child),
-20
Переглянути файл
@@ -151,16 +151,6 @@ fn cases(dir: &Path) -> Vec<Case> {
field: None,
config: launch("lldb-dap", &c.join("main"), &c, serde_json::json!({"env": ["OPENIDEA_FIXTURE=1"]})),
},
// GDB's own DAP interpreter needs GDB 14+; older ones are skipped by `installed`.
Case {
adapter: "gdb",
source: c.join("main.c"),
loop_line: 13,
after_loop: 15,
function: "parse",
field: None,
config: launch("gdb", &c.join("main"), &c, serde_json::json!({})),
},
]);
out
}
@@ -240,16 +230,6 @@ fn installed(adapter: &str) -> bool {
"js-debug" => "js-debug-adapter",
"delve" => "dlv",
"java-debug" => return true,
// Only a GDB with the DAP interpreter (14+) counts as installed.
"gdb" => {
return std::process::Command::new("gdb").arg("--version").output().is_ok_and(|out| {
String::from_utf8_lossy(&out.stdout)
.lines()
.next()
.and_then(adapter::parse_gdb_version)
.is_some_and(|(major, _)| major >= 14)
});
}
other => other,
};
adapter::resolve_binary(cmd, Path::new("/")).is_some()
+1 -3
Переглянути файл
@@ -992,9 +992,7 @@ mod tests {
let put = |product: &str, file: &str, seconds| {
let path = root.join(product).join(file);
write(&path, b"<application/>");
std::fs::File::options()
.write(true)
.open(path)
std::fs::File::open(path)
.unwrap()
.set_modified(std::time::UNIX_EPOCH + std::time::Duration::from_secs(seconds))
.unwrap();
+3 -3
Переглянути файл
@@ -250,7 +250,7 @@ async fn plugin_run_targets_register_prompt_route_revalidate_and_withdraw() {
f.host.set_plugin_host(&plugins);
let package = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../ide-plugin/tests/fixtures/execution");
plugins.install_from_dir(&package, &Consent::all()).unwrap();
let tool = f.root.with_file_name("wrapper");
let tool = f._tmp.path().join("wrapper");
std::fs::write(&tool, "#!/bin/sh\nprintf 'cwd=%s\\n' \"$PWD\"\nprintf '<%s>\\n' \"$@\"\n").unwrap();
std::fs::set_permissions(&tool, std::fs::Permissions::from_mode(0o755)).unwrap();
let invocation =
@@ -370,7 +370,7 @@ async fn run_target_api15_overrides_and_frozen_api14_registration() {
let engine = PluginEngine::new().unwrap();
let legacy = engine.compile(&fixtures.join("run-target-api14/dist/plugin.wasm")).unwrap();
assert_eq!(engine.check_component(&legacy).unwrap().unwrap().to_string(), "1.4.0");
let tool = f.root.with_file_name("wrapper");
let tool = f._tmp.path().join("wrapper");
std::fs::write(&tool, "#!/bin/sh\nexit 0\n").unwrap();
std::fs::set_permissions(&tool, std::fs::Permissions::from_mode(0o755)).unwrap();
let invocation =
@@ -456,7 +456,7 @@ async fn run_target_validation_gates_launches_and_preserves_selection() {
f.host.set_plugin_host(&plugins);
let fixture = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../ide-plugin/tests/fixtures/execution");
plugins.install_from_dir(&fixture, &Consent::all()).unwrap();
let tool = f.root.with_file_name("wrapper");
let tool = f._tmp.path().join("wrapper");
std::fs::write(&tool, "#!/bin/sh\ntouch spawned\n").unwrap();
std::fs::set_permissions(&tool, std::fs::Permissions::from_mode(0o755)).unwrap();
plugins.choose_program("execution", "process:execution-tool", Some(&f.root), Some(&tool)).unwrap();
+7 -7
Переглянути файл
@@ -616,16 +616,16 @@ async fn api14_stage3_remote_terminal_pins_and_exit_events_stay_on_the_execution
assert_eq!(settings["run"]["defaultTarget"], "");
let config = json!({"id":"wrapped-php", "name":"Wrapped PHP", "kind":"php", "command":"php", "args":["x.php", "literal ; $(touch bad)"], "env":{}, "detected":false, "isTest":false, "target":id});
invoke(&peer, "run_start", json!({"config":config, "onOutput":{"$channel":38}})).await.unwrap();
let wrapped = "<wrapped>\n<--cwd=/container>\n<php>\n<x.php>\n<literal ; $(touch bad)>\n";
until("remote wrapped run", 5, || std::fs::read_to_string(project.join("wrapped.txt")).is_ok_and(|s| s == wrapped))
.await;
until("remote wrapped run", 5, || project.join("wrapped.txt").exists()).await;
assert_eq!(
std::fs::read_to_string(project.join("wrapped.txt")).unwrap(),
"<wrapped>\n<--cwd=/container>\n<php>\n<x.php>\n<literal ; $(touch bad)>\n"
);
assert!(!project.join("bad").exists());
let composer = json!({"id":"composer", "name":"Composer", "kind":"shell", "command":"composer", "args":["install"], "env":{}, "detected":false, "isTest":false, "target":id});
invoke(&peer, "run_start", json!({"config":composer, "onOutput":{"$channel":39}})).await.unwrap();
until("remote composer override", 5, || {
std::fs::read_to_string(project.join("composer.txt")).is_ok_and(|s| s == "<composer>\n<install>\n")
})
.await;
until("remote composer override", 5, || project.join("composer.txt").exists()).await;
assert_eq!(std::fs::read_to_string(project.join("composer.txt")).unwrap(), "<composer>\n<install>\n");
invoke(
&peer,
"plugin_run_command",
+1 -1
Переглянути файл
@@ -98,7 +98,7 @@ fn jar_applications_from_every_configuration_location() {
"-jar",
"../dist/server app.jar",
"--config",
&format!("{}/server config.yml", dir.path().to_string_lossy()),
&format!("{root}/server config.yml"),
""
])
);
-1
Переглянути файл
@@ -13,7 +13,6 @@ something to show.
| `go-app/` | Go 1.22+ | `go run ./cmd/server` | `go test ./...` | `OPENIDEA_FAIL=1 go test ./...` | unused `fmt.Sprintf` result in `internal/store/store.go` |
| `kotlin-gradle/` | JDK 21, Gradle 8 (no wrapper) | `gradle run` | `gradle test` | `gradle test -PopenideaFail` | unused variable in `App.kt` |
| `java-app/` | JDK 21, Maven 3.9 | `mvn compile exec:java` | `mvn test` | `mvn test -DopenideaFail=true` | unused variable in `App.java` |
| `c-app/` | gcc / g++ 12+, make, GDB 14+ | `make all` | — | — | — |
| `php-app/` | PHP 8.5, Composer | `composer quote` | `vendor/bin/pest` | `OPENIDEA_FAIL=1 vendor/bin/pest` | unused variable in `ThresholdCustoms.php` |
| `polyglot/` | Go, TS, Python, C, shell, SQL, TOML/YAML/JSON, proto, Terraform | `make` | `make test` | — | unused variable in `native/hash.c` |
-19
Переглянути файл
@@ -1,19 +0,0 @@
# Debugging the entry points with GDB, picked in the configuration's Debug adapter
# control (explicit choice: the C/C++ default stays lldb-dap). GDB 14+ has the
# DAP interpreter; `make all` builds `bin/` first.
[[configurations]]
id = "user:app-c"
name = "app-c (GDB)"
kind = "shell"
command = "bin/app-c"
debug-adapter = "gdb"
env = { OPENIDEA_GDB_FIXTURE = "present" }
[[configurations]]
id = "user:app-cpp"
name = "app-cpp (GDB)"
kind = "shell"
command = "bin/app-cpp"
debug-adapter = "gdb"
env = { OPENIDEA_GDB_FIXTURE = "present" }
-18
Переглянути файл
@@ -1,18 +0,0 @@
CFLAGS = -g -O0 -std=c11
CXXFLAGS = -g -O0 -std=c++17
.PHONY: all app-c app-cpp clean
all: app-c app-cpp
app-c: bin
$(CC) $(CFLAGS) -o bin/app-c src/main.c
app-cpp: bin
$(CXX) $(CXXFLAGS) -o bin/app-cpp src/main.cpp
bin:
mkdir -p bin
clean:
rm -rf bin
-33
Переглянути файл
@@ -1,33 +0,0 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* FNV-1a 64-bit, one byte at a time: enough of a call stack to inspect. */
static uint64_t mix(uint64_t h, unsigned char byte) {
h ^= byte;
h *= 1099511628211ULL;
return h;
}
static uint64_t hash(uint64_t h, const char *s) {
for (; *s; s++) {
h = mix(h, (unsigned char)*s);
}
return h;
}
int main(void) {
const char *fixture = getenv("OPENIDEA_GDB_FIXTURE");
int environment_ok = getenv("PATH") != NULL && fixture != NULL && strcmp(fixture, "present") == 0;
const char *words[] = {"openidea", "gdb", "dap"};
uint64_t hashes[3];
for (int i = 0; i < 3; i++) {
hashes[i] = hash(1469598103934665603ULL, words[i]);
}
uint64_t value = hashes[0];
// Set a breakpoint here (QA: debugger) and inspect `value`.
value = hash(1469598103934665603ULL, words[2]);
printf("%s %016llx\n", words[2], (unsigned long long)value);
return environment_ok ? 0 : 1;
}
-23
Переглянути файл
@@ -1,23 +0,0 @@
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
static std::string banner(const std::string &project, int n) {
return project + " #" + std::to_string(n);
}
int main() {
const char *fixture = std::getenv("OPENIDEA_GDB_FIXTURE");
int environment_ok = std::getenv("PATH") != nullptr && fixture != nullptr && std::strcmp(fixture, "present") == 0;
std::vector<std::string> log;
for (int i = 1; i <= 3; i++) {
log.push_back(banner("openidea", i));
}
std::string line;
// Set a breakpoint here (QA: debugger) and inspect `line`.
line = banner("openidea", 3);
std::cout << line << "\n";
return environment_ok ? 0 : 1;
}
+3 -2
Переглянути файл
@@ -17,8 +17,9 @@ const config: KnipConfig = {
// Plugins' web pages are projects of their own (own package.json, checked by plugins/build.sh and CI).
ignore: ["plugins/**/web-src/**"],
ignoreExportsUsedInFile: true,
// System tools used by formatting and language smoke fixtures.
ignoreBinaries: ["rustfmt", "composer", "make"],
// lint-staged formats Rust files with the toolchain's rustfmt; the PHP smoke tests install
// their fixture with Composer.
ignoreBinaries: ["rustfmt", "composer"],
compilers: {
// Fonts come in through `@import` in global.css.
css: (text: string) => [...text.matchAll(/(?<=@)import[^;]+/g)].join("\n"),
+6 -4
Переглянути файл
@@ -90,11 +90,13 @@
if (target?.tagName === "SCRIPT" || (target?.tagName === "LINK" && target.rel === "modulepreload")) {
show(`Could not load startup script: ${target.src || target.href}`);
} else if (event.error || event.message) {
// ResizeObserver defers undelivered notifications to the next frame; startup can continue.
// ResizeObserver defers undelivered notifications to the next frame; startup can
// continue. Blink reports the loop as a bare message, WebKit (Tauri on Linux) as an
// Error object — ignore both. No genuine startup failure carries these engine strings.
const message = event.error?.message ?? event.message;
if (
!event.error &&
(event.message === "ResizeObserver loop completed with undelivered notifications." ||
event.message === "ResizeObserver loop limit exceeded")
message === "ResizeObserver loop completed with undelivered notifications." ||
message === "ResizeObserver loop limit exceeded"
)
return;
show(event.error || `${event.message}\n${event.filename || ""}:${event.lineno || 0}:${event.colno || 0}`);
+4 -49
Переглянути файл
@@ -1,9 +1,7 @@
/**
* Debugging each language's `fixtures/` project the way the editor does: a breakpoint on the
* entry point's "Set a breakpoint here" line, Debug from the file's context (or a saved
* configuration, when the debugger is an explicit choice), then the paused frame, its
* variables, evaluation, Step Over and Resume, with the debugger the IDE installs (GDB:
* the toolchain's own, 14+ for its DAP interpreter).
* entry point's "Set a breakpoint here" line, Debug from the file's context, then the paused
* frame, its variables, evaluation, Step Over and Resume, with the debugger the IDE installs.
*/
import { execFileSync } from "node:child_process";
import { cpSync, mkdtempSync, readFileSync, realpathSync, rmSync } from "node:fs";
@@ -35,10 +33,6 @@ interface Case {
setup?: (root: string) => void;
/** The IDE's tool that debugs it. */
debugger: string;
/** A system tool that ships with the toolchain (the IDE does not install it). */
system?: boolean;
/** A saved configuration to debug (the debugger is its explicit choice), instead of the file's context. */
configId?: string;
/** The entry point, debugged from its context. */
file: string;
/** A variable of the paused frame. */
@@ -95,28 +89,6 @@ const CASES: Record<string, Case> = {
variable: "library",
evaluate: ["library", /Library/],
},
// GDB's own DAP interpreter (GDB 14+), the configuration's explicit debugger choice:
// the C/C++ default stays lldb-dap. GDB 15.0.50.20240403-0ubuntu1 says `15`.
c: {
fixture: "c-app",
setup: (root) => execFileSync("make", ["app-c"], { cwd: root, stdio: "ignore" }),
debugger: "gdb",
system: true,
configId: "user:app-c",
file: "src/main.c",
variable: "value",
evaluate: ["print value", / = [0-9]/],
},
cpp: {
fixture: "c-app",
setup: (root) => execFileSync("make", ["app-cpp"], { cwd: root, stdio: "ignore" }),
debugger: "gdb",
system: true,
configId: "user:app-cpp",
file: "src/main.cpp",
variable: "line",
evaluate: ["print line", / = /],
},
php: {
fixture: "php-app",
setup: (root) =>
@@ -242,12 +214,7 @@ const pausedOrEnded = () => {
async function smoke(language: string) {
const c = CASES[language]!;
const root = await open(c);
if (c.system) {
// GDB ships with the toolchain (14+ for its DAP interpreter); the IDE does not install it.
execFileSync(c.debugger, ["--version"], { stdio: "pipe" });
} else {
await install(c.debugger);
}
await install(c.debugger);
const path = join(root, c.file);
const content = readFileSync(path, "utf8");
@@ -255,13 +222,7 @@ async function smoke(language: string) {
const line = marker + 1;
addBreakpoint(path, line);
if (c.configId) {
const config = (await call(commands.runConfigs())).find((cfg) => cfg.id === c.configId);
expect(config, c.configId).toBeTruthy();
await executeAction("debug.startConfig", config);
} else {
await executeAction("run.debugContext", { path, content });
}
await executeAction("run.debugContext", { path, content });
if (c.request) void requestWhenListening(c.request);
const s = await until("the breakpoint", pausedOrEnded, 5 * 60_000);
expect(s.stopReason, `${s.stopDescription}\n${shown()}`).toBe("breakpoint");
@@ -275,12 +236,6 @@ async function smoke(language: string) {
const value = await evaluate(c.evaluate[0], "repl", s);
expect(value.value, c.evaluate[0]).toMatch(c.evaluate[1]);
if (c.debugger === "gdb") {
const expression = await evaluate(c.variable, "watch", s);
expect(expression.value).toBeTruthy();
const environment = await evaluate("environment_ok", "watch", s);
expect(environment.value).toBe("1");
}
// Python 3.12 reports a conditional expression's line twice: Step Over may stop on it
// (and its breakpoint) again.
-24
Переглянути файл
@@ -324,30 +324,6 @@ describe("build feature", () => {
});
});
it("scopes Build Artifacts to the active file's module, or the whole project without one", async () => {
provideEditorService({
openFile,
saveAll: () => Promise.resolve(),
activePath: () => "/p/core/src/A.java",
} as unknown as EditorService);
await executeAction("build.buildArtifacts", { activate: false });
expect(fake.calls.at(-1)).toMatchObject({ kind: "artifacts", file: "/p/core/src/A.java" });
await act(async () => {
fake.resolve(result([], true));
});
provideEditorService({
openFile,
saveAll: () => Promise.resolve(),
activePath: () => null,
} as unknown as EditorService);
await executeAction("build.buildArtifacts", { activate: false });
expect(fake.calls.at(-1)).toMatchObject({ kind: "artifacts", file: null });
await act(async () => {
fake.resolve(result([], true));
});
});
it("starts a build without a workbench", async () => {
show.mockImplementation(() => {
throw new Error("No workbench");
+3 -3
Переглянути файл
@@ -102,14 +102,14 @@ export function activate(): () => void {
{
id: "build.buildArtifacts",
title: "Build Artifacts",
description: "Packages the current module's artifacts, or the whole project when no file is active",
description: "Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)",
category: "Build",
when: WHEN,
keywords: ["package", "assemble", "jar", "release", "module"],
keywords: ["package", "assemble", "jar", "release"],
run: ({ arg }) => {
const options = typeof arg === "object" && arg !== null ? arg : {};
const activate = !("activate" in options && options.activate === false);
const build = startBuild("artifacts", moduleTarget(arg), activate);
const build = startBuild("artifacts", null, activate);
if ("wait" in options && options.wait === true) return build.then(() => undefined);
},
},
+1 -11
Переглянути файл
@@ -305,7 +305,7 @@ describe("run config → launch config", () => {
});
});
it("native programs under CodeLLDB / lldb-dap / GDB: program, args, cwd, env", () => {
it("native programs under CodeLLDB / lldb-dap: program, args, cwd, env", () => {
const run = rc({ command: "./build/app", args: ["-v"], cwd: "c", env: { K: "v" } });
const lldb = launchConfigFor({ ...run, debugAdapter: "codelldb" }, "/p")!;
expect(lldb).toMatchObject({
@@ -320,16 +320,6 @@ describe("run config → launch config", () => {
expect(dap).toMatchObject({ adapter: "lldb-dap", program: "/p/c/build/app" });
// lldb-dap takes `KEY=VALUE` strings.
expect(extra(dap)).toEqual({ env: ["K=v"] });
// GDB's DAP launch takes the environment as an object, like the default flow.
const gdb = launchConfigFor({ ...run, debugAdapter: "gdb" }, "/p")!;
expect(gdb).toMatchObject({
adapter: "gdb",
program: "/p/c/build/app",
args: ["-v"],
cwd: "/p/c",
env: { K: "v" },
});
expect(gdb.extraJson).toBeNull();
});
it.each(["native", "cmake-application"])(
-30
Переглянути файл
@@ -1,13 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import { act, fireEvent, render, screen } from "@testing-library/react";
const debugEvaluateIn = vi.hoisted(() =>
vi.fn(async () => ({
status: "ok" as const,
data: { name: "result", value: "4", typeName: "int", variablesReference: 0, evaluateName: null },
})),
);
vi.mock("@/platform/ipc", async (importOriginal) => {
const real = await importOriginal<typeof import("@/platform/ipc")>();
const ok = <T,>(data: T) => Promise.resolve({ status: "ok" as const, data });
@@ -15,7 +8,6 @@ vi.mock("@/platform/ipc", async (importOriginal) => {
...real,
commands: {
...real.commands,
debugEvaluateIn,
debugScopes: () => ok([{ name: "Locals", variablesReference: 1, expensive: false }]),
debugVariables: () =>
ok([
@@ -39,8 +31,6 @@ vi.mock("@/workbench/confirmTerminate", () => ({ confirmTerminate }));
import type { RunConfig } from "@/platform/ipc";
import { useDebug, type DebugSession } from "../state";
import { DebugTabs, DebugToolWindow } from "../ui/DebugToolWindow";
import { DebuggerOverlays } from "../ui/Overlays";
import { useOverlays } from "../ui/popoverStore";
const session: DebugSession = {
id: 1,
@@ -63,26 +53,6 @@ const session: DebugSession = {
};
describe("debug tool window", () => {
it.each(["gdb", "debugpy"])("evaluates expressions in the variable field and dialog under %s", async (adapter) => {
debugEvaluateIn.mockClear();
useDebug.setState({ sessions: { 1: { ...session, adapter } }, active: 1 });
const { unmount } = render(<DebugToolWindow />);
fireEvent.click(screen.getByRole("tab", { name: "Threads & Variables" }));
const field = screen.getByPlaceholderText(/Evaluate expression/);
fireEvent.change(field, { target: { value: "count + 1" } });
fireEvent.keyDown(field, { key: "Enter" });
const context = adapter === "gdb" ? "watch" : "repl";
await vi.waitFor(() => expect(debugEvaluateIn).toHaveBeenCalledWith(1, 7, "count + 1", context));
unmount();
debugEvaluateIn.mockClear();
useOverlays.setState({ evaluate: { expression: "count + 1" } });
const dialog = render(<DebuggerOverlays />);
fireEvent.click(screen.getByRole("button", { name: "Evaluate" }));
await vi.waitFor(() => expect(debugEvaluateIn).toHaveBeenCalledWith(1, 7, "count + 1", context));
dialog.unmount();
useOverlays.setState({ evaluate: null });
});
it("offers Hot Reload and Hot Restart for Dart and Flutter sessions only", () => {
const hot = () => ["debug.hotReload", "debug.hotRestart"].map((name) => !!screen.queryByRole("button", { name }));
useDebug.setState({ sessions: { 1: { ...session, status: "running" } }, active: 1 });
+2 -2
Переглянути файл
@@ -318,7 +318,7 @@ function godotLaunch(rc: RunConfig, cwd: string): LaunchConfig {
return { ...base(rc, "godot", project), extraJson: JSON.stringify({ project, scene: godotScene(rc.args) }) };
}
/** A native program under CodeLLDB, lldb-dap or GDB: program, args, cwd, env. */
/** A native program under CodeLLDB or lldb-dap: program, args, cwd, env. */
function nativeLaunch(rc: RunConfig, cwd: string, adapter: string): LaunchConfig {
const out: LaunchConfig = { ...base(rc, adapter, cwd), program: resolveCommand(rc.command, cwd), args: [...rc.args] };
// lldb-dap takes the environment as `KEY=VALUE` strings.
@@ -420,7 +420,7 @@ export function launchConfigFor(rc: RunConfig, root: string, php: string | null
if (adapter === "dart") {
return rc.params?.request === "attach" ? flutterAttach(rc, cwd, adapter) : flutterLaunch(rc, cwd, adapter);
}
if (adapter === "codelldb" || adapter === "lldb-dap" || adapter === "gdb") {
if (adapter === "codelldb" || adapter === "lldb-dap") {
return rc.kind === "cargo" ? cargoLaunch(rc, cwd, adapter) : nativeLaunch(rc, cwd, adapter);
}
if (adapter === "debugpy") return debugpyLaunch(rc, cwd);
+1 -5
Переглянути файл
@@ -512,11 +512,7 @@ function VariablesPane({ session }: { session: DebugSession }) {
const e = expression.trim();
if (!e) return;
try {
setLastEval({
expression: e,
result: await evaluate(e, session.adapter === "gdb" ? "watch" : "repl", session),
error: null,
});
setLastEval({ expression: e, result: await evaluate(e, "repl", session), error: null });
} catch (err) {
setLastEval({ expression: e, result: null, error: err instanceof Error ? err.message : String(err) });
}
+1 -1
Переглянути файл
@@ -706,7 +706,7 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
setHistory(readHistory("evaluate"));
historyPos.current = -1;
try {
const v: Variable = await evaluate(e, session?.adapter === "gdb" ? "watch" : "repl", session ?? null);
const v: Variable = await evaluate(e, "repl", session ?? null);
setResult({ key: `eval:${e}:${Date.now()}`, kind: "eval", name: e, variable: v, error: null });
} catch (err) {
setResult({ key: `eval:${e}:${Date.now()}`, kind: "eval", name: e, variable: null, error: errorText(err) });
+1 -2
Переглянути файл
@@ -66,7 +66,6 @@ const ADAPTERS: ReadonlyArray<{ id: string; label: string }> = [
{ id: "delve", label: "Delve (Go)" },
{ id: "codelldb", label: "CodeLLDB (Rust, C, C++)" },
{ id: "lldb-dap", label: "lldb-dap (C, C++, Swift)" },
{ id: "gdb", label: "GDB (C, C++)" },
{ id: "php-debug", label: "php-debug (PHP)" },
{ id: "rdbg", label: "rdbg (Ruby)" },
];
@@ -376,7 +375,7 @@ export function ConfigForm({ config, all, type, errors, template, onChange, modi
const adapterOptions: SelectOption[] = [
{ value: "", label: "None" },
...ADAPTERS.map((a) => ({ value: a.id, label: tx(a.label) })),
...ADAPTERS.map((a) => ({ value: a.id, label: a.label })),
];
if (config.debugAdapter && !ADAPTERS.some((a) => a.id === config.debugAdapter))
adapterOptions.push({
+10 -4
Переглянути файл
@@ -54,10 +54,16 @@ it.each(resizeObserverMessages)("still times out an unresolved startup after %s"
expect(document.querySelector("textarea")?.value).toContain("Startup did not finish within 30 seconds.");
});
it.each(resizeObserverMessages)("keeps actual errors with the same message fatal: %s", (message) => {
window.dispatchEvent(new ErrorEvent("error", { message, error: new Error(message) }));
expect(document.getElementById("splash")).toBeNull();
expect(document.querySelector("textarea")?.value).toContain(message);
it.each(resizeObserverMessages)("ignores the loop notification delivered as an Error: %s", (message) => {
// WebKit (Tauri on Linux) reports the loop with an Error object; Blink as a bare message.
// No genuine startup failure carries these engine-generated strings.
window.dispatchEvent(new ErrorEvent("error", { message, filename: "tauri://localhost", error: new Error(message) }));
expect(document.getElementById("splash")).not.toBeNull();
expect(document.getElementById("boot-error")).toBeNull();
expect(document.documentElement.dataset.boot).toBeUndefined();
window.dispatchEvent(new Event("openidea:boot-ready"));
vi.advanceTimersByTime(30_000);
expect(document.getElementById("boot-error")).toBeNull();
});
it.each(resizeObserverMessages)("keeps rejections with the same message fatal: %s", (message) => {
-1
Переглянути файл
@@ -1,5 +1,4 @@
{
"GDB (C, C++)": "GDB (C, C++)",
"Unknown error": "Unknown error",
"Retry Loading Conversation": "Retry Loading Conversation",
"No conversation history": "No conversation history",
+1
Переглянути файл
@@ -1476,6 +1476,7 @@
"Package manager": "Administrador de paquetes",
"Package to install": "Paquete a instalar",
"Packages": "Paquetes",
"Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)": "Empaqueta el proyecto (mvn package, gradle assemble, cargo build --release, npm run build)",
"Page size": "Tamaño de página",
"Parameter Info": "Información de parámetros",
"Parameter names": "Nombres de parámetros",
+1
Переглянути файл
@@ -1404,6 +1404,7 @@
"Package manager": "Gestionnaire de paquets",
"Package to install": "Paquet à installer",
"Packages": "Paquets",
"Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)": "Empaquette le projet (mvn package, gradle assemble, cargo build --release, npm run build)",
"Page size": "Taille de page",
"Parameter Info": "Informations sur les paramètres",
"Parameter names": "Noms des paramètres",
+1
Переглянути файл
@@ -1518,6 +1518,7 @@
"Package manager": "패키지 관리자",
"Package to install": "설치할 패키지",
"Packages": "패키지",
"Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)": "프로젝트를 패키징합니다(mvn package, gradle assemble, cargo build --release, npm run build)",
"Page size": "페이지 크기",
"Parameter Info": "매개변수 정보",
"Parameter names": "매개변수 이름",
+1
Переглянути файл
@@ -1466,6 +1466,7 @@
"Package manager": "Menedżer pakietów",
"Package to install": "Pakiet do zainstalowania",
"Packages": "Pakiety",
"Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)": "Pakuje projekt (mvn package, gradle assemble, cargo build --release, npm run build)",
"Page size": "Rozmiar strony",
"Parameter Info": "Informacje o parametrach",
"Parameter names": "Nazwy parametrów",
+1
Переглянути файл
@@ -1466,6 +1466,7 @@
"Package manager": "Gerenciador de pacotes",
"Package to install": "Pacote a instalar",
"Packages": "Pacotes",
"Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)": "Empacota o projeto (mvn package, gradle assemble, cargo build --release, npm run build)",
"Page size": "Tamanho da página",
"Parameter Info": "Informações de parâmetros",
"Parameter names": "Nomes dos parâmetros",
+1 -2
Переглянути файл
@@ -1,5 +1,4 @@
{
"GDB (C, C++)": "GDB(C、C++)",
"Unknown error": "未知错误",
"Retry Loading Conversation": "重新加载对话",
"No conversation history": "没有对话历史记录",
@@ -1671,7 +1670,7 @@
"Package manager": "软件包管理器",
"Package to install": "要安装的软件包",
"Packages": "软件包",
"Packages the current module's artifacts, or the whole project when no file is active": "打包当前模块的产物,无活动文件时则打包整个项目",
"Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)": "打包项目(mvn package、gradle assemble、cargo build --release、npm run build)",
"Page size": "页面大小",
"Parameter Info": "形参信息",
"Parameter names": "形参名称",