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

...
Автор SHA1 Повідомлення Дата
l0ng-ai 10436c46f5 fix(search): keep file context visible in Find previews 2026-11-23 05:35:24 +08:00
l0ng-ai 844c2f3145 test(maven): wait for the background refresh of jdtls import roots (#5272)
external_maven_link_persists_reloads_and_unlink_keeps_files failed on the macOS runner: setting languages.java.maven.linkedProjects refreshes the language server's import roots on a blocking task, and the test read them right after build_model returned. It now waits up to 5 s for them to change.
2026-11-23 05:18:24 +08:00
4 змінених файлів з 77 додано та 22 видалено

No files matched your search

+15 -2
Переглянути файл
@@ -49,7 +49,7 @@ async fn external_maven_link_persists_reloads_and_unlink_keeps_files() {
assert_eq!(b.pom, canonical);
assert_eq!(dunce::canonicalize(root.join(&b.dir)).unwrap(), sibling);
assert_eq!(host.project("main").unwrap().content_roots(), vec![sibling.clone()]);
assert_eq!(host.project("main").unwrap().lsp.jdtls_import_roots(), vec![sibling.clone()]);
assert_eq!(import_roots(&host, |roots| !roots.is_empty()).await, vec![sibling.clone()]);
let reloaded = ops::build::build_model(&host, "main").await.unwrap();
assert_eq!(
@@ -63,13 +63,26 @@ async fn external_maven_link_persists_reloads_and_unlink_keeps_files() {
let gone = ops::build::build_model(&host, "main").await.unwrap();
assert!(gone.maven.unwrap().projects.iter().all(|p| p.artifact_id != "b"));
assert!(host.project("main").unwrap().content_roots().is_empty());
assert!(host.project("main").unwrap().lsp.jdtls_import_roots().is_empty());
assert!(import_roots(&host, |roots| roots.is_empty()).await.is_empty());
assert_eq!(saved(), Vec::<String>::new());
assert_eq!(std::fs::read_to_string(root.join("pom.xml")).unwrap(), a_pom);
assert_eq!(std::fs::read_to_string(sibling.join("pom.xml")).unwrap(), b_pom);
host.shutdown().await;
}
/// The language server's Maven import roots once `ready` holds: a settings change refreshes them in
/// the background.
async fn import_roots(host: &Host, ready: impl Fn(&[std::path::PathBuf]) -> bool) -> Vec<std::path::PathBuf> {
for _ in 0..200 {
let roots = host.project("main").unwrap().lsp.jdtls_import_roots();
if ready(&roots) {
return roots;
}
tokio::time::sleep(std::time::Duration::from_millis(25)).await;
}
host.project("main").unwrap().lsp.jdtls_import_roots()
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn reactor_module_beside_a_trusted_project_is_a_content_root_until_removed() {
let temp = tempfile::tempdir().unwrap();
+28 -2
Переглянути файл
@@ -15,7 +15,7 @@ async function run(page: Page, id: string) {
}, id);
}
async function stubFindMatches(page: Page) {
async function stubFindMatches(page: Page, firstPath = LONG_RESULT_PATH) {
await stubDesktop(page);
await page.evaluate((longPath) => {
window.__ipc.handlers.search_validate = () => null;
@@ -39,7 +39,7 @@ async function stubFindMatches(page: Page) {
}, 20);
return null;
};
}, LONG_RESULT_PATH);
}, firstPath);
}
async function expectControlsFit(page: Page) {
@@ -205,3 +205,29 @@ test("Find in Files prioritizes the preview and remembers an adjusted split", as
await expect(handle).toBeAttached();
await expect.poll(resultsShare).toBeCloseTo(adjusted, 2);
});
test("Find in Files keeps the file and its parent folder visible in the preview caption", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 400, height: 570 });
const prefix = "config/generated/regional-integrations/sandbox/development/notifications";
const name = "RegionalLedgerSettings.txt";
const path = `${prefix}/runtime/${name}`;
await stubFindMatches(page, path);
await run(page, "find.inPath");
const dialog = page.getByRole("dialog", { name: "Find in Files" });
const search = dialog.getByPlaceholder("Search");
await search.fill("http://localhost:8080");
const preview = dialog.locator("[data-panel][id=preview]");
const caption = preview.getByTitle(path, { exact: true });
const folder = caption.getByText("/runtime", { exact: true });
const beginning = caption.getByText(prefix, { exact: true });
await expect(caption.getByText(name, { exact: true })).toBeInViewport({ ratio: 1 });
await expect(folder).toBeInViewport({ ratio: 1 });
await expect(folder).toHaveCSS("font-size", "13px");
expect(await beginning.evaluate((el) => el.scrollWidth > el.clientWidth)).toBe(true);
expect(await folder.evaluate((el) => el.scrollWidth <= el.clientWidth)).toBe(true);
await search.press("ArrowDown");
await search.press("ArrowDown");
await expect(preview.getByTitle("config/endpoint-1.txt", { exact: true })).toContainText("endpoint-1.txt");
});
+17 -8
Переглянути файл
@@ -201,23 +201,32 @@
.previewHeader {
flex: none;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
height: 36px;
padding: 0 20px;
align-items: baseline;
gap: var(--space-1);
padding: 10px 20px var(--space-1-5);
border-top: 1px solid var(--border-popup);
color: var(--fg-subtle);
font-size: var(--fs-ui);
line-height: 1.25;
white-space: nowrap;
}
.previewPath {
.previewDirectory {
display: flex;
min-width: 0;
}
.previewName,
.previewSegment {
min-width: 0;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.previewName,
.previewParent {
flex: none;
}
.previewName {
color: var(--fg-strong);
margin-right: 8px;
}
.previewBox {
flex: 1;
+17 -10
Переглянути файл
@@ -284,6 +284,8 @@ function FindInFilesDialog() {
const rows = useMemo(() => matchRows(state.files), [state.files]);
const active = rows.length ? Math.min(sel.lead, rows.length - 1) : -1;
const selected = active >= 0 ? rows[active] : undefined;
const previewDirectory = selected?.relPath.includes("/") ? dirname(selected.relPath) : "";
const previewParentStart = Math.max(0, previewDirectory.lastIndexOf("/"));
const chosen = useMemo(() => selectedRows(rows, sel), [rows, sel]);
const fileHighlights = useMemo(() => {
if (stale || !selected) return [];
@@ -890,16 +892,21 @@ function FindInFilesDialog() {
</SplitPanel>
<SplitHandle hairline={false} />
<SplitPanel id="preview" minSize={96}>
<div className={styles.previewHeader}>
{selected ? (
<span className={styles.previewPath}>
<span className={styles.previewName}>{basename(selected.relPath)}</span>
{selected.relPath.includes("/") && dirname(selected.relPath)}
</span>
) : (
<span />
)}
</div>
{selected && (
<div className={styles.previewHeader} title={selected.relPath}>
<span className={styles.previewName}>{basename(selected.relPath)}</span>
{previewDirectory && (
<span className={styles.previewDirectory} dir="ltr">
{previewParentStart > 0 && (
<span className={styles.previewSegment}>{previewDirectory.slice(0, previewParentStart)}</span>
)}
<span className={clsx(styles.previewSegment, styles.previewParent)}>
{previewDirectory.slice(previewParentStart)}
</span>
</span>
)}
</div>
)}
<div className={styles.previewBox}>
{!stale && previewMode && s.replace && selected ? (
<ReplaceDiffPreview