mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 18:43:16 -10:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae7a8e74c8 | ||
|
|
a7b67347c2 | ||
|
|
707b6fe169 | ||
|
|
b9a0c66ca6 | ||
|
|
26f83240a7 | ||
|
|
c6bb0b84ce | ||
|
|
09d1f4a673 | ||
|
|
3b875620d2 | ||
|
|
843f2024c5 | ||
|
|
4ed7bf14d6 | ||
|
|
4bc46baddb |
No files matched your search
@@ -114,6 +114,12 @@ pub async fn debug_start(host: &Host, window: &str, config: LaunchConfig) -> Ide
|
||||
extra["__adapterJavaHome"] = serde_json::json!(runtime.home);
|
||||
config.extra_json = Some(extra.to_string());
|
||||
}
|
||||
if finds_java_sources(&config)
|
||||
&& let Ok(project) = host.project(window)
|
||||
{
|
||||
let roots = host.blocking(move || Ok(java_source_roots(&project))).await?;
|
||||
config = add_java_source_paths(config, &roots);
|
||||
}
|
||||
let root = config.cwd.clone().map(PathBuf::from).unwrap_or_default();
|
||||
let mut ruby_tools = Vec::new();
|
||||
if config.adapter == "rdbg" && config.request == "launch" {
|
||||
@@ -308,6 +314,46 @@ fn start_java_attach_listener(mut config: LaunchConfig, windows: bool) -> Launch
|
||||
config
|
||||
}
|
||||
|
||||
/// The project's source and test roots, as the IDE detects them (no Maven / Gradle import needed).
|
||||
fn java_source_roots(project: &crate::project::Project) -> Vec<PathBuf> {
|
||||
use ide_workspace::roots::RootKind;
|
||||
project
|
||||
.roots()
|
||||
.roots
|
||||
.iter()
|
||||
.filter(|r| matches!(r.kind, RootKind::Source | RootKind::Test))
|
||||
.map(|r| project.root.join(&r.path))
|
||||
.filter(|p| p.is_dir())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Debuggers that look a frame's source up in `sourcePaths` when their own model has no file:
|
||||
/// java-debug after jdtls (which has not imported a project whose Maven sync failed), and
|
||||
/// java-analyzer after the module it debugs (whose sibling modules it does not load).
|
||||
fn finds_java_sources(config: &LaunchConfig) -> bool {
|
||||
matches!(config.adapter.as_str(), "java-debug" | ide_dap::adapter::JAVA_ANALYZER)
|
||||
}
|
||||
|
||||
/// Without a file for the stopped frame the editor cannot follow the execution point, so Java
|
||||
/// sessions get every source root of the project. The user's own list wins.
|
||||
fn add_java_source_paths(mut config: LaunchConfig, roots: &[PathBuf]) -> LaunchConfig {
|
||||
if !finds_java_sources(&config) || roots.is_empty() {
|
||||
return config;
|
||||
}
|
||||
let mut extra = match config.extra_json.as_deref().map(serde_json::from_str) {
|
||||
None => serde_json::Map::new(),
|
||||
Some(Ok(serde_json::Value::Object(extra))) => extra,
|
||||
Some(_) => return config,
|
||||
};
|
||||
if extra.get("sourcePaths").is_some_and(|v| !v.is_null()) {
|
||||
return config;
|
||||
}
|
||||
let paths: Vec<String> = roots.iter().map(|r| r.to_string_lossy().into_owned()).collect();
|
||||
extra.insert("sourcePaths".into(), paths.into());
|
||||
config.extra_json = Some(serde_json::Value::Object(extra).to_string());
|
||||
config
|
||||
}
|
||||
|
||||
/// A JVM launched by java-debug writes what java-debug decodes its output as
|
||||
/// (see [`ide_core::output_encoding::java_debug_vm_args`]).
|
||||
fn match_java_debug_encoding(mut config: LaunchConfig, windows: bool) -> LaunchConfig {
|
||||
@@ -737,6 +783,34 @@ mod tests {
|
||||
serde_json::from_str::<serde_json::Value>(config.extra_json.as_deref().unwrap()).unwrap()["vmArgs"].clone()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn java_debug_sessions_look_up_sources_in_project_roots() {
|
||||
let roots = [PathBuf::from("/p/src/main/java"), PathBuf::from("/p/src/test/java")];
|
||||
let source_paths = |config: &LaunchConfig| {
|
||||
serde_json::from_str::<serde_json::Value>(config.extra_json.as_deref().unwrap()).unwrap()["sourcePaths"]
|
||||
.clone()
|
||||
};
|
||||
for adapter in ["java-debug", ide_dap::adapter::JAVA_ANALYZER] {
|
||||
for request in ["launch", "attach"] {
|
||||
let config = add_java_source_paths(launch(adapter, request, serde_json::json!({"port": 5005})), &roots);
|
||||
assert_eq!(source_paths(&config), serde_json::json!(["/p/src/main/java", "/p/src/test/java"]));
|
||||
}
|
||||
}
|
||||
let mut bare = launch("java-debug", "attach", serde_json::json!({}));
|
||||
bare.extra_json = None;
|
||||
assert_eq!(
|
||||
source_paths(&add_java_source_paths(bare, &roots)),
|
||||
serde_json::json!(["/p/src/main/java", "/p/src/test/java"])
|
||||
);
|
||||
|
||||
let own = launch("java-debug", "launch", serde_json::json!({"sourcePaths": ["/elsewhere"]}));
|
||||
assert_eq!(source_paths(&add_java_source_paths(own, &roots)), serde_json::json!(["/elsewhere"]));
|
||||
let other = launch("debugpy", "launch", serde_json::json!({}));
|
||||
assert_eq!(add_java_source_paths(other.clone(), &roots).extra_json, other.extra_json);
|
||||
let none = launch("java-debug", "launch", serde_json::json!({}));
|
||||
assert_eq!(add_java_source_paths(none.clone(), &[]).extra_json, none.extra_json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn java_debug_launches_on_windows_write_utf8() {
|
||||
let extra =
|
||||
|
||||
@@ -136,6 +136,10 @@ pub trait PluginWorkspace: Send + Sync {
|
||||
fn apply_edits(&self, path: &Path, version: u64, edits: &[TextEdit], background: bool) -> Result<u64, HostError>;
|
||||
/// Code from the project may run (git hooks and config on fetch).
|
||||
fn trusted(&self, root: &Path) -> bool;
|
||||
/// Git roots with the same directory mappings as the VCS tool window.
|
||||
fn repositories(&self, _root: &Path) -> Result<ide_vcs::Repos, HostError> {
|
||||
Err(HostError::NotFound("no open project repositories".into()))
|
||||
}
|
||||
/// The git executable of the project at `root` (see [`crate::Project::git_executable`]).
|
||||
fn git_executable(&self, _root: &Path) -> Option<PathBuf> {
|
||||
None
|
||||
@@ -2394,8 +2398,40 @@ impl HostApi for PluginApi {
|
||||
|
||||
fn vcs_remotes(&self, root: &Path) -> Result<Vec<(String, String)>, HostError> {
|
||||
let Some(repo) = ide_vcs::Repo::discover(root).map_err(failed)? else { return Ok(Vec::new()) };
|
||||
let remotes = repo.remotes().map_err(failed)?;
|
||||
Ok(remotes.into_iter().map(|r| (r.name, without_credentials(&r.url))).collect())
|
||||
plugin_remotes(&repo)
|
||||
}
|
||||
|
||||
fn vcs_roots(&self, root: &Path) -> Result<Vec<String>, HostError> {
|
||||
let workspace = self.shared.workspace().ok_or(HostError::Cancelled)?;
|
||||
Ok(workspace
|
||||
.repositories(root)?
|
||||
.roots()
|
||||
.iter()
|
||||
.filter(|r| r.starts_with(root) || root.starts_with(r))
|
||||
.map(|r| to_ipc(r))
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn vcs_repository_at(&self, root: &Path, path: &str) -> Result<Option<ide_plugin::RepositoryInfo>, HostError> {
|
||||
let workspace = self.shared.workspace().ok_or(HostError::Cancelled)?;
|
||||
if !workspace.trusted(root) {
|
||||
return Err(HostError::Failed("the project is in Restricted Mode: git does not run there".into()));
|
||||
}
|
||||
let path = ide_plugin::resolve_in_root(root, path).map_err(HostError::Invalid)?;
|
||||
let repos = workspace.repositories(root)?;
|
||||
// A link to a nested worktree directory denotes that worktree, not its entry in the parent.
|
||||
let Some(repo) = repos.at_root(&path).or_else(|| repos.for_path(&path)) else { return Ok(None) };
|
||||
let relative = path.strip_prefix(repo.root()).map_err(failed)?;
|
||||
let info = repo.branch_info().map_err(failed)?;
|
||||
Ok(Some(ide_plugin::RepositoryInfo {
|
||||
root: to_ipc(repo.root()),
|
||||
relative_path: to_ipc(relative),
|
||||
branch: info.head,
|
||||
commit: info.head_commit,
|
||||
upstream: info.upstream,
|
||||
ahead: info.ahead,
|
||||
remotes: plugin_remotes(repo)?,
|
||||
}))
|
||||
}
|
||||
|
||||
fn vcs_fetch(&self, root: &Path, cancel: &CancellationToken) -> Result<(), HostError> {
|
||||
@@ -3730,6 +3766,13 @@ impl PluginWorkspace for HostWorkspace {
|
||||
HostWorkspace::project_covering(self, root).is_some_and(|p| p.is_trusted())
|
||||
}
|
||||
|
||||
fn repositories(&self, root: &Path) -> Result<ide_vcs::Repos, HostError> {
|
||||
Ok(self
|
||||
.project_covering(root)
|
||||
.ok_or_else(|| HostError::NotFound("the project is no longer open".into()))?
|
||||
.repos())
|
||||
}
|
||||
|
||||
fn git_executable(&self, root: &Path) -> Option<PathBuf> {
|
||||
HostWorkspace::project_covering(self, root)?.git_executable()
|
||||
}
|
||||
@@ -4694,6 +4737,10 @@ fn from_window<'a>(client: Option<&'a str>, what: &str) -> Result<&'a str, HostE
|
||||
client.ok_or_else(|| HostError::Invalid(format!("can only {what} from a command the user invoked")))
|
||||
}
|
||||
|
||||
fn plugin_remotes(repo: &ide_vcs::Repo) -> Result<Vec<(String, String)>, HostError> {
|
||||
Ok(repo.remotes().map_err(failed)?.into_iter().map(|r| (r.name, without_credentials(&r.url))).collect())
|
||||
}
|
||||
|
||||
/// `url` without the `user:password@` a remote may carry (`https://user:token@host/…`):
|
||||
/// `vcs.read` must not hand out credentials. scp-style `git@host:path` has no password.
|
||||
fn without_credentials(url: &str) -> String {
|
||||
|
||||
@@ -2361,8 +2361,11 @@ fn git_metadata_watch(root: &Path, sink: &SharedSink) -> Option<Arc<ide_vcs::Met
|
||||
.ok()
|
||||
}
|
||||
|
||||
/// Whether a VCS metadata path changed for a reason other than our own status run
|
||||
/// refreshing an index: the main repository's `.git/index` or a linked worktree's
|
||||
/// `.git/worktrees/<id>/index`.
|
||||
fn vcs_path_changed(path: &Path) -> bool {
|
||||
!path.ends_with(".git/index") || !ide_vcs::is_own_index_write(path)
|
||||
path.file_name().is_none_or(|n| n != "index") || !ide_vcs::is_own_index_write(path)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -2446,6 +2449,40 @@ mod index_event_tests {
|
||||
std::fs::remove_file(&index).unwrap();
|
||||
assert!(vcs_path_changed(&index));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn status_write_in_a_linked_worktree_is_suppressed() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let main = tmp.path().join("main");
|
||||
std::fs::create_dir(&main).unwrap();
|
||||
let git = |dir: &std::path::Path, args: &[&str]| {
|
||||
let output = std::process::Command::new("git")
|
||||
.current_dir(dir)
|
||||
.args(["-c", "user.name=t", "-c", "user.email=t@t"])
|
||||
.args(args)
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
|
||||
};
|
||||
git(&main, &["init", "-q"]);
|
||||
std::fs::write(main.join("file.txt"), "original\n").unwrap();
|
||||
git(&main, &["add", "file.txt"]);
|
||||
git(&main, &["commit", "-qm", "init"]);
|
||||
let linked = tmp.path().join("linked");
|
||||
git(&main, &["worktree", "add", "-q", linked.to_str().unwrap()]);
|
||||
std::fs::File::options()
|
||||
.write(true)
|
||||
.open(linked.join("file.txt"))
|
||||
.unwrap()
|
||||
.set_modified(std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_secs(1))
|
||||
.unwrap();
|
||||
let index = main.join(".git/worktrees/linked/index");
|
||||
let before = std::fs::read(&index).unwrap();
|
||||
ide_vcs::Repo::discover(&linked).unwrap().unwrap().status().unwrap();
|
||||
assert_ne!(before, std::fs::read(&index).unwrap(), "status must actually write the index");
|
||||
assert!(!vcs_path_changed(&index));
|
||||
assert!(vcs_path_changed(&main.join(".git/worktrees/linked/HEAD")));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, unix))]
|
||||
|
||||
@@ -81,6 +81,10 @@ impl TestWorkspace {
|
||||
}
|
||||
|
||||
impl PluginWorkspace for TestWorkspace {
|
||||
fn repositories(&self, root: &Path) -> Result<ide_vcs::Repos, HostError> {
|
||||
ide_vcs::Repos::discover(root, &|_| false).map_err(|e| HostError::Failed(e.message))
|
||||
}
|
||||
|
||||
fn run_configuration(&self, _client: &str, plugin: &str, id: &str) -> Result<ide_run::RunConfig, HostError> {
|
||||
if !(plugin == "execution" && matches!(id, "detected" | "dynamic") || plugin == "api14" && id == "tests") {
|
||||
return Err(HostError::NotFound(id.into()));
|
||||
@@ -3609,6 +3613,36 @@ fn commands_see_the_paths_they_were_run_on() {
|
||||
assert_eq!(f.run("jobs", "selection", None).unwrap().as_deref(), Some(""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_reads_the_repository_owning_the_path() {
|
||||
let f = fixture(Limits::default());
|
||||
f.install(&sample("jobs"));
|
||||
let lookup = |path: Option<&str>| f.run("jobs", "repository-at", path);
|
||||
for name in ["alpha", "beta", "alpha/nested"] {
|
||||
let dir = f.project.join(name);
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
git(&dir, &["init", "-b", "work"]);
|
||||
git(&dir, &["remote", "add", "origin", &format!("https://user:[email protected]/{name}.git")]);
|
||||
std::fs::write(dir.join("file.txt"), name).unwrap();
|
||||
}
|
||||
assert_eq!(lookup(None).unwrap().unwrap().lines().count(), 3);
|
||||
for (path, repo, relative) in [
|
||||
("alpha/file.txt", "alpha", "file.txt"),
|
||||
("beta/file.txt", "beta", "file.txt"),
|
||||
("alpha/nested/file.txt", "alpha/nested", "file.txt"),
|
||||
("alpha/nested", "alpha/nested", ""),
|
||||
] {
|
||||
let root = to_ipc(&f.project.join(repo));
|
||||
let expected = format!("{root}|{relative}|work|[(\"origin\", \"https://example.org/{repo}.git\")]");
|
||||
assert_eq!(lookup(Some(path)).unwrap().as_deref(), Some(expected.as_str()));
|
||||
}
|
||||
assert_eq!(lookup(Some(".")).unwrap(), None);
|
||||
assert!(lookup(Some("..")).unwrap_err().contains("outside"));
|
||||
f.host.set_capability("jobs", "vcs.read", false).unwrap();
|
||||
assert!(lookup(None).unwrap_err().contains("vcs.read"));
|
||||
assert!(lookup(Some("alpha/file.txt")).unwrap_err().contains("vcs.read"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vcs_remotes_clipboard_and_open_url() {
|
||||
let f = fixture(Limits::default());
|
||||
|
||||
@@ -317,6 +317,8 @@ pub trait HostApi: Send + Sync {
|
||||
fn storage_keys(&self, prefix: &str) -> Result<Vec<String>, HostError>;
|
||||
fn vcs_status(&self, root: &Path) -> Result<Option<RepositoryStatus>, HostError>;
|
||||
fn vcs_remotes(&self, root: &Path) -> Result<Vec<(String, String)>, HostError>;
|
||||
fn vcs_roots(&self, root: &Path) -> Result<Vec<String>, HostError>;
|
||||
fn vcs_repository_at(&self, root: &Path, path: &str) -> Result<Option<crate::RepositoryInfo>, HostError>;
|
||||
fn vcs_fetch(&self, root: &Path, cancel: &CancellationToken) -> Result<(), HostError>;
|
||||
/// The commit being prepared in `client`'s window (`None`: no repository),
|
||||
/// waiting for the window until `cancel` fires.
|
||||
|
||||
@@ -408,6 +408,18 @@ pub struct RepositoryStatus {
|
||||
pub changed_files: u32,
|
||||
}
|
||||
|
||||
/// Reference and remotes of a path's mapped worktree (WIT `vcs.repository-info`).
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct RepositoryInfo {
|
||||
pub root: String,
|
||||
pub relative_path: String,
|
||||
pub branch: Option<String>,
|
||||
pub commit: Option<String>,
|
||||
pub upstream: Option<String>,
|
||||
pub ahead: u32,
|
||||
pub remotes: Vec<(String, String)>,
|
||||
}
|
||||
|
||||
/// A file a pending commit changes (WIT `commit.commit-change`).
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@@ -1446,6 +1446,34 @@ impl vcs::Host for StoreData {
|
||||
let root = self.table.get(&project)?.root.clone();
|
||||
Ok(self.host.vcs_remotes(&root).map_err(to_wit))
|
||||
}
|
||||
|
||||
fn roots(&mut self, project: Resource<ProjectRes>) -> Fallible<Vec<String>> {
|
||||
if let Err(e) = self.require(Capability::VcsRead) {
|
||||
return Ok(Err(e));
|
||||
}
|
||||
Ok(self.host.vcs_roots(&self.table.get(&project)?.root).map_err(to_wit))
|
||||
}
|
||||
|
||||
fn repository_at(&mut self, project: Resource<ProjectRes>, path: String) -> Fallible<Option<vcs::RepositoryInfo>> {
|
||||
if let Err(e) = self.require(Capability::VcsRead) {
|
||||
return Ok(Err(e));
|
||||
}
|
||||
Ok(self
|
||||
.host
|
||||
.vcs_repository_at(&self.table.get(&project)?.root, &path)
|
||||
.map(|r| {
|
||||
r.map(|r| vcs::RepositoryInfo {
|
||||
root: r.root,
|
||||
relative_path: r.relative_path,
|
||||
branch: r.branch,
|
||||
commit: r.commit,
|
||||
upstream: r.upstream,
|
||||
ahead: r.ahead,
|
||||
remotes: r.remotes,
|
||||
})
|
||||
})
|
||||
.map_err(to_wit))
|
||||
}
|
||||
}
|
||||
|
||||
impl build::Host for StoreData {
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
1bd593215a298e86d1dcbccd5431d7efd3d0e0f0d83c0a05ecf95cd597cb89b1
|
||||
68517d169bea40ca5a5426a3a05ace3389417073b9369e79157a2beb051dcfc0
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
fce80835362944cf050a430a134a8c742e3365af32ad45ae2156918bd0c74575
|
||||
6edda84fad0ee7cd56a3a28b55e6c559db7b7f6b9c8c0ca645be805b545c01e7
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
e7d65dbf92a0edce8f1a6abf5a502dfc4fb4d818599ac1c54e8f82f60e62648a
|
||||
ecc6b6c52753b11521ae033a5a66c2a289119e09e07d22742203d3a13122dd97
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
c79c1613b8ce1dd69a2889b6a80a7608c6862b115d4283a8a9bae179e0fb57b9
|
||||
4ec581c69a62bbf424983e241a79d0bfdb5d025a3e86d27eea745adcb1906253
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
cc7ff6388700b72a9c8785f7935a79d018752e86ce32407ecd7a3b51f4093f09
|
||||
5fb89ee3d07e4275433ad9ad930ad781ef4f227af11aa5eb9dfc9174c015b1b8
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
fcf00edd43ed4fc26201ccdd4d1c102e51b9e0080603204d566e437bedc28fcf
|
||||
236db5a85d3e7e9fee01c3ff0b9f5e66fad7e3d64fa618a0c1c980d9e5883839
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
3f00290d04844109a9175f91dae042d3f377f0b2badf56955c589f1c1fbe71db
|
||||
4f89bd09b571016cbb9feb0674e668aa66996997c6b53a91d1a4ffbf161083a3
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
b9812539466c03233fabd6a428a1598bed0e485841ec462f577889da2f8c1831
|
||||
c5c3bac9e2b69e4957bd5049d4f560dd04faf4dfc2d7523bb7968aa29f3bdcfb
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
4a9eaf0b5374baf7cca82553d8209b7750f34c9e6dfd923bb491b07294b564d2
|
||||
a75758a44e255b7df3adf53e5f81b8f1283270d28f78ad0d8b358d9feea98a99
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
4d9403692c7bb8698f06c6336c5d9db7934004d6dd09362f77aa361b215108ca
|
||||
7e658a971fd58b84fcadc1f4939991d5f4506936989d4c8a7302ccebc0455e9c
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
df21a4a36dbfeb99505d24da6f18011531f581327f2c5069479ad47ab03bb8b3
|
||||
6b7c0d8971cfd3ba1d80c5fc6428e5890c820350972597a11be4ea6f0324973f
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
545723b3a96ef095c60cc2e16743fcd23bb8568a023507e2f1c33cba27478717
|
||||
20e43b6ac3aaa1527874f98f4b502ef88dd4676b6096b989c7bfba7a521e723d
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
698653d9344a009b0682becb67708d8e4e49d6880bce448f865b985f2605a330
|
||||
f879df5a331ec439c7e74af4d9c7d249477239e3a0a59d5e612548623cf5e9e2
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
03da30c1e589f499ae0889af62d39cfdbdcdc9f1035f8ed1479058843ef39ebf
|
||||
de1fc37d8fd5993164e0d903a0f1b4ba15005f2a90de325d7f4b4902a363fdf1
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
f080d959792a14554e6978923d4c5461a1b3d31dead0b7ec69131acb98e47f27
|
||||
367366c14b69d8f3837e731e061768ec5cb344d86fba89ced63fb196e5ca475e
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
b48218bf3d0f76b519cce52856c5f5c577a2273eb7e0afd63c771c0222342450
|
||||
b7bccc7f93b409263293d2dff8a31dbdcfcdfba133815f3ff60bc70a073257de
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
e34aabcbc0fb1cb26d5c913a8ddece8eea205128b4985c24e89935a49c4e290d
|
||||
f28d85f2004adcdf4e43faa57b7a5b52ab5d8233579979062461b0c5b4c63e10
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
a6c412b5e9f0f5b677a0d6ec64f50e90a62a5559a25f70a2f40fa83defc35823
|
||||
23c2c5e6e208104979e1f5b8620d2279547d372f0accf893c2d7797399fe39b0
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
d364826baf1beeefbd582325a67c95d2d66a58ce2643100974a52e10c7cd7afe
|
||||
57fc9ea26136a56fa2f502e4bb17531df3f5eed092fde1267199e2447c8fbc23
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
f130b73f1a32c5a87d052dc3d8274ec92d21083d738775328cd6a587e92bd7b5
|
||||
105017e20dd7a93cecb178576f2718ccf8433a6fac027b5708d6e2121f85e27a
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
d01472c658cb3cda802603d4a6db5ff976c7ae958929c03dafdc54820a9990f2
|
||||
ae72f5db42f508bd8faac6134f6e9a785a8fdcdda823af32cb56e5936c157bf9
|
||||
@@ -35,6 +35,15 @@ impl Plugin for Jobs {
|
||||
fn run_command(&mut self, id: &str, ctx: &Invocation, arg: Option<&str>) -> Result<Option<String>, Error> {
|
||||
match id {
|
||||
"follow" => self.follow().map(|()| None),
|
||||
"repository-at" => {
|
||||
let project = ctx.project().ok_or("no project is open")?;
|
||||
Ok(match arg {
|
||||
None => Some(project.vcs_roots()?.join("\n")),
|
||||
Some(path) => project.vcs_repository_at(path)?.map(|r| {
|
||||
format!("{}|{}|{}|{:?}", r.root, r.relative_path, r.branch.unwrap_or_default(), r.remotes)
|
||||
}),
|
||||
})
|
||||
}
|
||||
"remotes" => {
|
||||
let project = ctx.project().ok_or("no project is open")?;
|
||||
let remotes = project.vcs_remotes()?;
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
2a4e83aac16df6c12fcaac2f1b2bdc52c7426b3262a9172563b6760ca7b0f27f
|
||||
d773509ce0beebc88b769d8346aaafa39b1201d959c4afd16d680c63cef919d5
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
6e5f70de45fc4d9d5392ba9260eb4d2a85518076a0d6952e38913f09183cea12
|
||||
1b15f24dc006f18260c746d9651cdaa2416e7871397e21f2935f50d316b88f67
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
5a31c423c02f6f95b3f2d350c0f6abce1a2d93540d1c50e635a240382c5a551b
|
||||
8249c0aa3ab7621f5cb33e2afea6babf3370749757f0957360e5c40f0c15ff66
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
dc6d6308f6b228a349ece32b253f278009149ad1244722a79463747f04ef6a1a
|
||||
0006724d54d1acb732d2d4f77d67c855b5a560747537c11eb48cb0cb988d9783
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
307396d257af1b732a7cdb8b69e25fe37d2a63b1a8bd2d6faee325aebbad3f54
|
||||
5985abd096cf5d957f17302ecd9d785fbc975e409b945c3b5c7ef84b2890e6b0
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
86886cbeed8325adffde61a07b0ae97195cc76ee8fc4f85b3763d0cf28c24cd1
|
||||
5e0ee5752d6c418b96b7dd3f0bfaea3e034eb868d4edb847b42cc8c33eef1257
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
d6f9e669b02bc4f3fe5aa23e2908112eb9c4134889474c2321f82c7fa3934487
|
||||
281c04d6fb2999a6f4967475fa19dd9f0ee887c7cf2b323951f124562ea27389
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
fec0b2f041f5362ddb8c3eec0edceaab2555c44e5694c226d11ea272a5d79b87
|
||||
ca75434712f4f1709943a84f7bb8907479395109d1e160171314fcf768c73ef8
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
89a930f275b2b6b087bd22e0ac9f520379efaa380fb1a141d190018a351e44c1
|
||||
51d29c00405b9e364755dec2ce22eeaaa3b06ef5218244179be73e8ab03e815f
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
c743ba515c8a329e45e441bb48d32fe4ff9cedc5835f8c23dca4893c23b19a4e
|
||||
5e9db81302adfaab77c1cf6545cdc2cd7b0b1bed29e68ed8160b487694da043a
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
a09d11f1f1d278ca11e1e799f15108dcfd19d8b35687a898a71799663c11e9a5
|
||||
e66d84009ab855107a8614a146e3e21c34a767c590f2b0f10157b0546e532008
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
d9ec893a3b270d6df8f7225ac532afd7b48efb511fa1f48df041ae7ebef6f21a
|
||||
42e2ca709640744b0a00c0ab44911b2204417744c7402271f759ee630de79cf2
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
4cf100f956d75ab7e6bd9ba1b77a4daed1514072a364ecd84f9a62af756944a2
|
||||
161f4797c5a371dd3fe5e9c02a75d444c357e88db7a55e53b3cc6d22af021d38
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
73df9e3929d160a0ec75a0dab38c89cc3f4fb5110b8d3245870345ea58693a75
|
||||
f5e228a477aee1f902d74b532838b96cd6c07b0416037c76dfe25744724d3094
|
||||
@@ -784,10 +784,25 @@ impl EventFilter {
|
||||
}
|
||||
}
|
||||
|
||||
/// Relative to `.git/worktrees`: the first component is the worktree ID. Even read-only
|
||||
/// Git queries create fsmonitor cookies; reporting those would schedule another query.
|
||||
fn watch_worktree_entry(parts: &[&OsStr]) -> bool {
|
||||
!matches!(parts, [_, name, ..] if *name == "fsmonitor--daemon" || *name == "fsmonitor--daemon.ipc")
|
||||
/// Relative to `.git/worktrees`: the first component is the worktree ID. Like the main
|
||||
/// gitdir, a linked worktree's gitdir only reports the files that describe its state; the
|
||||
/// rest is Git's (and our own) scratch space. Even read-only queries write there
|
||||
/// (fsmonitor cookies, temporary indexes, reflogs), and reporting those would schedule
|
||||
/// another query.
|
||||
fn worktree_metadata(parts: &[&OsStr]) -> bool {
|
||||
match parts {
|
||||
[] | [_] => true,
|
||||
[_, name] => matches!(
|
||||
name.to_str(),
|
||||
Some("HEAD" | "index" | "config.worktree" | "gitdir" | "commondir" | "locked" | "refs")
|
||||
),
|
||||
[_, first, ..] => *first == "refs",
|
||||
}
|
||||
}
|
||||
|
||||
/// Directories below `.git/worktrees` that need a watch: the worktree entries and their refs.
|
||||
fn watch_worktree_dir(parts: &[&OsStr]) -> bool {
|
||||
matches!(parts, [] | [_]) || matches!(parts, [_, first, ..] if *first == "refs")
|
||||
}
|
||||
|
||||
/// `Some(true)` for interesting VCS metadata, `Some(false)` for other `.git`
|
||||
@@ -815,7 +830,7 @@ impl EventFilter {
|
||||
let metadata = *first == "refs"
|
||||
// Linked-worktree gitdirs: a worktree added or removed below
|
||||
// the project writes its HEAD here.
|
||||
|| (*first == "worktrees" && Self::watch_worktree_entry(parts));
|
||||
|| (*first == "worktrees" && Self::worktree_metadata(parts));
|
||||
metadata && !rest.last().is_some_and(|l| l.to_string_lossy().ends_with(".lock"))
|
||||
}
|
||||
// The `.git` path itself: a linked worktree's `.git` is a plain
|
||||
@@ -848,7 +863,7 @@ impl EventFilter {
|
||||
return match rest.as_slice() {
|
||||
[] => true,
|
||||
[first, ..] if *first == "refs" => true,
|
||||
[first, parts @ ..] if *first == "worktrees" => Self::watch_worktree_entry(parts),
|
||||
[first, parts @ ..] if *first == "worktrees" => Self::watch_worktree_dir(parts),
|
||||
[only] => *only == "info",
|
||||
_ => false,
|
||||
};
|
||||
@@ -1502,6 +1517,13 @@ mod tests {
|
||||
// Linked-worktree gitdir metadata below the main repository.
|
||||
assert_eq!(g(".git/worktrees/wt/HEAD"), Some(true));
|
||||
assert_eq!(g(".git/worktrees/wt/index.lock"), Some(false));
|
||||
for path in ["index", "config.worktree", "gitdir", "commondir", "locked", "refs", "refs/bisect/bad"] {
|
||||
assert_eq!(g(&format!(".git/worktrees/wt/{path}")), Some(true), "{path}");
|
||||
}
|
||||
// Scratch files Git and the IDE write during read-only queries.
|
||||
for path in ["openidea-index-1-2", "openidea-partial-index", "logs/HEAD", "ORIG_HEAD", "rebase-merge/done"] {
|
||||
assert_eq!(g(&format!(".git/worktrees/wt/{path}")), Some(false), "{path}");
|
||||
}
|
||||
// The depth-1 directories themselves: `git init` or the first
|
||||
// `git worktree add` creates them in an already-watched gitdir.
|
||||
assert_eq!(g(".git/refs"), Some(true));
|
||||
@@ -1719,7 +1741,8 @@ mod tests {
|
||||
assert!(!w(".git/objects") && !w(".git/objects/ab") && !w(".git/logs"));
|
||||
// Linked-worktree gitdirs are watched so worktrees added below the
|
||||
// project while it is open are discovered.
|
||||
assert!(w(".git/worktrees") && w(".git/worktrees/wt") && w(".git/worktrees/wt/rebase-merge"));
|
||||
assert!(w(".git/worktrees") && w(".git/worktrees/wt") && w(".git/worktrees/wt/refs/bisect"));
|
||||
assert!(!w(".git/worktrees/wt/rebase-merge") && !w(".git/worktrees/wt/logs"));
|
||||
assert!(!filter.should_watch_dir(Path::new("/elsewhere")));
|
||||
// Excludes are replaced in place (Watcher::set_excludes).
|
||||
*filter.excludes.write() = ExcludeMatcher::new(&["gen".into()]);
|
||||
|
||||
@@ -45,8 +45,11 @@ The editor follows IntelliJ IDEA's behaviour and default keymap. Shortcuts below
|
||||
| **Unwrap/Remove…** | `⇧⌘⌦` | `Ctrl+Shift+Delete` |
|
||||
| **Move Caret to Matching Brace** | `⌃M` | `Ctrl+Shift+M` |
|
||||
| **Move Caret to Code Block Start** / **End** | `⌥⌘[` / `⌥⌘]` | `Ctrl+[` / `Ctrl+]` |
|
||||
| **Move Caret to Page Top** / **Bottom** | `⌘⇞` / `⌘⇟` | `Ctrl+PageUp` / `Ctrl+PageDown` |
|
||||
| **Toggle Insert/Overwrite** | `Insert` | `Insert` |
|
||||
|
||||
**Move Caret to Page Top** / **Bottom** put the caret on the first / last line the editor shows in full, in the same column, without scrolling; with `⇧` / `Shift` added they select up to it.
|
||||
|
||||
**Edit › Sort Lines** and **Edit › Reverse Lines** reorder the selected lines (the whole file without a selection); they have no default shortcut. Sort Lines orders by character code, so uppercase letters come before lowercase ones.
|
||||
|
||||
**Duplicate Entire Lines** copies every line touched by a caret or selection below itself, even when only part of a line is selected, and keeps the selection on the copy. It has no default shortcut; run it from **Find Action** or assign one in **Settings › Keymap**.
|
||||
@@ -111,6 +114,8 @@ To format on every save, enable **Reformat code** (and optionally **Optimize imp
|
||||
|
||||
**Window › Editor Tabs** also has **Pin Tab**, **Close Other Tabs**, **Close All Tabs** and **Reopen Closed Tab**, all without default shortcuts. **Window › Move Tab to New Window** detaches the current tab into its own window.
|
||||
|
||||
The tab context menu's **Close Unmodified Tabs**, **Close All but Pinned**, **Close Tabs to the Left**, **Close Tabs to the Right** and **Close All Read-Only Tabs** are also actions on the current tab and its group: run them from **Find Action** or assign a shortcut in **Settings › Keymap**. Pinned tabs stay open.
|
||||
|
||||
Tab placement, the tab limit and what happens when it is reached, the preview tab, sorting, and which tab is activated after one closes are set in **Settings › Editor › General › Editor Tabs**.
|
||||
|
||||
With tabs placed left or right, the tab column is as wide as its longest name, up to a limit. Drag the column's inner edge (or focus it and press `←` / `→`) to change the limit; it applies to every editor group and is remembered.
|
||||
|
||||
@@ -18,8 +18,8 @@ Showing an empty Terminal window opens a tab in the start directory (the project
|
||||
|
||||
- **+** (**New Tab**) opens a tab with the default shell.
|
||||
- The **▾** button (**More Terminal Options**) has **New Terminal Tab**, **New Predefined Session** (one entry per installed shell, plus **SSH Session…**), **Split Right**, **Split Down** and **Settings**.
|
||||
- Right-click a tab for **Rename Session…**, **Close Tab**, **Close Other Tabs**, **Split Right**, **Split and Move Right**, **Split Down**, **Split and Move Down** and **Unsplit**. Double-clicking a tab also renames it.
|
||||
- Drag tabs to reorder them, or drop a tab on the edge of another group to split.
|
||||
- Right-click a tab for **Rename Session…**, **Move to Editor**, **Close Tab**, **Close Other Tabs**, **Split Right**, **Split and Move Right**, **Split Down**, **Split and Move Down** and **Unsplit**. Double-clicking a tab also renames it.
|
||||
- Drag tabs to reorder them, drop a tab on the edge of another group to split, or drag a tab into an editor group (or its edge) to keep the session running as an editor tab.
|
||||
|
||||
A tab is named after your custom name, otherwise after the program running in it (when the shell reports it), otherwise `Local`, `Local (2)` and so on. A spinner shows while a command runs; **Exited** or **Failed** shows once the session ends.
|
||||
|
||||
|
||||
@@ -45,8 +45,11 @@ description: "多光标与选区、行编辑、剪贴板历史、代码折叠、
|
||||
| **解包/移除…** | `⇧⌘⌦` | `Ctrl+Shift+Delete` |
|
||||
| **将文本光标移至匹配的大括号** | `⌃M` | `Ctrl+Shift+M` |
|
||||
| **将光标移至代码块开头** / **末尾** | `⌥⌘[` / `⌥⌘]` | `Ctrl+[` / `Ctrl+]` |
|
||||
| **将光标移至页面顶部** / **底部** | `⌘⇞` / `⌘⇟` | `Ctrl+PageUp` / `Ctrl+PageDown` |
|
||||
| **切换插入/改写** | `Insert` | `Insert` |
|
||||
|
||||
**将光标移至页面顶部** / **底部** 把光标放到编辑器完整显示的第一行 / 最后一行,保持所在列,不滚动视图;再加上 `⇧` / `Shift` 则选择到该处。
|
||||
|
||||
**编辑 › 对行排序** 和 **编辑 › 反转行** 对选中的行(没有选区时为整个文件)重新排序,默认没有快捷键。对行排序按字符编码排序,大写字母排在小写字母之前。
|
||||
|
||||
**复制整行** 把光标或选区涉及的每一行完整复制到其下方(即使只选中了行的一部分),并让选区落在副本上。它默认没有快捷键,可在查找操作中运行,或在 **设置 › 按键映射** 中分配快捷键。
|
||||
@@ -111,6 +114,8 @@ description: "多光标与选区、行编辑、剪贴板历史、代码折叠、
|
||||
|
||||
**窗口 › 编辑器标签页** 中还有 **固定标签页**、**关闭其他标签页**、**关闭所有标签页** 和 **重新打开已关闭的标签页**,默认都没有快捷键。在查找操作中运行 **将标签页移到新窗口**,可以把当前标签页拆到一个独立窗口。
|
||||
|
||||
标签页右键菜单中的 **关闭未修改的标签页**、**关闭除已固定外的所有标签页**、**关闭左侧标签页**、**关闭右侧标签页** 和 **关闭所有只读标签页** 也是作用于当前标签页及其所在组的操作:可在查找操作中运行,或在 **设置 › 按键映射** 中分配快捷键。已固定的标签页会保留。
|
||||
|
||||
标签页的位置、数量上限以及达到上限后的处理方式、预览标签页、排序方式,以及关闭标签页后激活哪一个,都在 **设置 › 编辑器 › 常规 › 编辑器标签页** 中设置。
|
||||
|
||||
标签页放在左侧或右侧时,标签页列的宽度随最长的名称变化,但不超过一个上限。拖动该列靠近编辑器的边缘(或聚焦后按 `←` / `→`)可以调整上限;调整对所有编辑器组生效,并会被记住。
|
||||
|
||||
@@ -18,8 +18,8 @@ description: "使用内置终端:标签页、拆分、Shell、链接、查找
|
||||
|
||||
- **+**(**新建标签页**)用默认 Shell 打开一个标签页。
|
||||
- **▾** 按钮(**更多终端选项**)包含 **新建终端标签页**、**新建预定义会话**(每个已安装的 Shell 一项,另有 **SSH 会话…**)、**向右拆分**、**向下拆分** 和 **设置**。
|
||||
- 右键标签页可以 **重命名会话…**、**关闭标签页**、**关闭其他标签页**、**向右拆分**、**向右拆分并移动**、**向下拆分**、**向下拆分并移动**、**取消拆分**。双击标签页也能重命名。
|
||||
- 拖动标签页可以调整顺序,拖到另一组的边缘则会拆分。
|
||||
- 右键标签页可以 **重命名会话…**、**移至编辑器**、**关闭标签页**、**关闭其他标签页**、**向右拆分**、**向右拆分并移动**、**向下拆分**、**向下拆分并移动**、**取消拆分**。双击标签页也能重命名。
|
||||
- 拖动标签页可以调整顺序,拖到另一组的边缘会拆分;拖入编辑器分组(或其边缘)则会带着正在运行的会话作为编辑器标签页打开。
|
||||
|
||||
标签页名称优先用你设置的名字,其次是 Shell 报告的正在运行的程序名,否则就是 `本地`、`本地 (2)` 等默认名称。命令运行时标签上会显示转圈图标,会话结束后显示 **已退出** 或 **失败**。
|
||||
|
||||
|
||||
+109
-1
@@ -1,4 +1,4 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("terminal output menu groups session, clipboard and split actions and opens Find", async ({ workbench: page }) => {
|
||||
await page.evaluate(async () => {
|
||||
@@ -360,3 +360,111 @@ test("terminal composition follows a drawn caret inside the session", async ({ w
|
||||
})
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
test("dragging terminal tabs into editor strips and split edges preserves live sessions and scrollback", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const handlers = window.__ipc.handlers;
|
||||
let id = 0;
|
||||
const killed: number[] = [];
|
||||
(window as unknown as { __killedPtys: number[] }).__killedPtys = killed;
|
||||
handlers.term_default_shell = () => "/bin/zsh";
|
||||
handlers.term_available_shells = () => ["/bin/zsh"];
|
||||
handlers.term_spawn = () => ({ id: ++id, title: "zsh", pid: id });
|
||||
handlers.term_resize = () => null;
|
||||
handlers.term_write = () => null;
|
||||
handlers.term_is_busy = () => false;
|
||||
handlers.term_kill = (args: unknown) => {
|
||||
killed.push((args as { id: number }).id);
|
||||
return null;
|
||||
};
|
||||
|
||||
const contributions = "/src/workbench/contributions.ts";
|
||||
const editor = (await import(contributions)).editorService();
|
||||
await editor.openFile("/dev/acme-api/App.tsx", { focus: false });
|
||||
await editor.openFile("/dev/acme-api/README.md", { focus: false });
|
||||
const store = "/src/workbench/toolwindows/store.ts";
|
||||
const layout = await import(store);
|
||||
layout.setToolWindowSize("bottom", 240);
|
||||
layout.showToolWindow("terminal", true);
|
||||
});
|
||||
|
||||
const terminal = page.getByRole("region", { name: "Terminal", exact: true });
|
||||
await expect(terminal.locator(".xterm-helper-textarea")).toBeFocused();
|
||||
|
||||
// Open a second terminal tab and write distinct output into both sessions.
|
||||
await terminal.getByRole("button", { name: "New Tab", exact: true }).click();
|
||||
const termStrip = terminal.getByRole("tablist", { name: "Terminal sessions" });
|
||||
await expect(termStrip.getByRole("tab")).toHaveCount(2);
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const store = "/src/features/terminal/store.ts";
|
||||
const rt = await import(store);
|
||||
const [first, second] = rt.useTerminals.getState().tabs;
|
||||
const s1 = rt.getSession(first!.session)!;
|
||||
const s2 = rt.getSession(second!.session)!;
|
||||
await new Promise<void>((done) => s1.term.write("ALPHA-SESSION-OUTPUT\r\n", done));
|
||||
await new Promise<void>((done) => s2.term.write("BETA-TEST-RUNNER\r\n", done));
|
||||
});
|
||||
|
||||
// 1) Drag "Local" into the editor tab strip between App.tsx and README.md.
|
||||
const localTab = termStrip.getByRole("tab", { name: "Local", exact: true });
|
||||
const readmeTab = page.getByRole("tablist", { name: "Editor tabs" }).getByRole("tab", { name: "README.md" });
|
||||
const from1 = (await localTab.boundingBox())!;
|
||||
const to1 = (await readmeTab.boundingBox())!;
|
||||
await page.mouse.move(from1.x + from1.width / 2, from1.y + from1.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(to1.x + 6, to1.y + to1.height / 2, { steps: 8 });
|
||||
if (process.env.OPENIDEA_TERMINAL_SHOTS)
|
||||
await page.screenshot({
|
||||
path: `${process.env.OPENIDEA_TERMINAL_SHOTS}/after-strip-hover.png`,
|
||||
animations: "disabled",
|
||||
});
|
||||
await page.mouse.up();
|
||||
|
||||
const editorLists = page.getByRole("tablist", { name: "Editor tabs" });
|
||||
await expect(editorLists.first().getByRole("tab")).toHaveText(["App.tsx", "Local", "README.md"]);
|
||||
await expect(termStrip.getByRole("tab")).toHaveCount(1);
|
||||
|
||||
const editorArea = page.locator("[data-pane-id]");
|
||||
await expect(editorArea.locator(".xterm-rows")).toContainText("ALPHA-SESSION-OUTPUT");
|
||||
await expect(editorArea.locator(".xterm-helper-textarea")).toBeFocused();
|
||||
|
||||
// 2) Drag the remaining "Local (2)" onto the right edge of the editor pane to split it, hiding the empty tool window.
|
||||
const local2Tab = termStrip.getByRole("tab", { name: "Local (2)", exact: true });
|
||||
const paneBox = (await editorArea.first().locator('[role="tabpanel"]').boundingBox())!;
|
||||
const from2 = (await local2Tab.boundingBox())!;
|
||||
await page.mouse.move(from2.x + from2.width / 2, from2.y + from2.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(paneBox.x + paneBox.width - 20, paneBox.y + paneBox.height / 2, { steps: 8 });
|
||||
if (process.env.OPENIDEA_TERMINAL_SHOTS)
|
||||
await page.screenshot({
|
||||
path: `${process.env.OPENIDEA_TERMINAL_SHOTS}/after-split-hover.png`,
|
||||
animations: "disabled",
|
||||
});
|
||||
await page.mouse.up();
|
||||
|
||||
await expect(terminal).toBeHidden();
|
||||
await expect(editorArea).toHaveCount(2);
|
||||
await expect(editorArea.nth(1).locator(".xterm-rows")).toContainText("BETA-TEST-RUNNER");
|
||||
await expect(editorArea.nth(1).locator(".xterm-helper-textarea")).toBeFocused();
|
||||
|
||||
// 3) Resize the editor split divider and confirm both panes and the live PTY survive.
|
||||
const widthBefore = (await editorArea.nth(1).boundingBox())!.width;
|
||||
const divider = page.locator("[data-editor-area]").getByRole("separator");
|
||||
const divBox = (await divider.boundingBox())!;
|
||||
await page.mouse.move(divBox.x + divBox.width / 2, divBox.y + divBox.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(divBox.x - 100, divBox.y + divBox.height / 2, { steps: 6 });
|
||||
await page.mouse.up();
|
||||
await expect.poll(async () => (await editorArea.nth(1).boundingBox())!.width).toBeGreaterThan(widthBefore + 50);
|
||||
await expect(editorArea.nth(1).locator(".xterm-rows")).toContainText("BETA-TEST-RUNNER");
|
||||
if (process.env.OPENIDEA_TERMINAL_SHOTS)
|
||||
await page.screenshot({
|
||||
path: `${process.env.OPENIDEA_TERMINAL_SHOTS}/after-final.png`,
|
||||
animations: "disabled",
|
||||
});
|
||||
expect(await page.evaluate(() => (window as unknown as { __killedPtys: number[] }).__killedPtys)).toEqual([]);
|
||||
});
|
||||
@@ -432,6 +432,12 @@ are always available. Calling a gated function without its capability returns
|
||||
API 1.16.0 is in development on `main`. Use `engines.openidea = "^1.16"` and the
|
||||
matching SDK. Plugins for 1.15 and earlier keep working. New in 1.16:
|
||||
|
||||
- `Project::vcs_repository_at(path)` returns the mapped worktree owning an existing project file
|
||||
or directory, its repository-relative path, branch, commit, upstream, ahead count and sanitized
|
||||
remotes, or `None` outside Git. The innermost root wins, including for the worktree directory
|
||||
itself. It requires `vcs.read` and trust. `Project::vcs_roots()` lists the possible roots
|
||||
without choosing one on the user's behalf.
|
||||
|
||||
- `host::pick_file(title, &dialog)` lets an interactive command or view event choose an existing file
|
||||
or a save destination. The path belongs to the host running the project, including in remote windows.
|
||||
See [File selection](#file-selection-api-116).
|
||||
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
ebbb9ce6869a540c782bfb6c38e918bfac342571d909deeae307a4ed93491a85
|
||||
657eb2ab2d2c0e1bffa6e5852af883d38a507341bc2d9c5879717ccaef6a4100
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
4a7199396c05dcb26810332beae3c4e20d54d5c0c04f9e982051a7920160640f
|
||||
cab71634347487537f5310bdcb883482e94387707d57dd3eb271be378186dfff
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
4e69aee5ba09bc2cd142489b283d881b443e73371f9bcc9dee5d4328b7c67ab9
|
||||
a802ccc1608628f2e97d91b5e4ba3f0d77b8addffdb7ada532d52b089c878b72
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
4824e76e178a12bb257a4fdcadcff31e0be0a2f51aab838e053c784a4d74ec07
|
||||
28d398a0f606cacbab278002320dc1724d353d1e858eff290c4bbafc3f70fb92
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
76dc9f5ce2fa1c03474ff8d6a875b6647d639d84faa85c2cb628be5d568f2a93
|
||||
a2ec37204138e764dde32a021bedb4cb2b79e8905c48d5912ca356f98d8e7439
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
7f42554592d2c24c49360ee28398bc321e0b61d457a750c1398f32cf3768c4bc
|
||||
07fb659ac6daf89956cfeb51073f95cdc65fa801f2de62bdfa12b5ef0c72e08f
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
f7f2e588ee1e239e366d28fc14a270d745c028cd0a3aef6d344c91474c1a74fe
|
||||
f2feddc2ca41706ff859f82081541832b3b3c3501c2deefb266faadcc4833b5a
|
||||
BIN
Binary file not shown.
Loaded 100 of 194 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user