дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-30 06:12:33 +02:00
Порівняти коміти
1
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
49d402e53d |
No files matched your search
@@ -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!(import_roots(&host, |roots| !roots.is_empty()).await, vec![sibling.clone()]);
|
||||
assert_eq!(host.project("main").unwrap().lsp.jdtls_import_roots(), vec![sibling.clone()]);
|
||||
|
||||
let reloaded = ops::build::build_model(&host, "main").await.unwrap();
|
||||
assert_eq!(
|
||||
@@ -63,26 +63,13 @@ 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!(import_roots(&host, |roots| roots.is_empty()).await.is_empty());
|
||||
assert!(host.project("main").unwrap().lsp.jdtls_import_roots().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();
|
||||
|
||||
@@ -111,7 +111,6 @@ test("completion lists the server's items and inserts the chosen one", async ({
|
||||
});
|
||||
await expect(editor.locator(".cm-content")).toHaveCSS("font-size", zoomedSize);
|
||||
await expect(method.locator(".cm-completionLabel")).toHaveCSS("font-size", zoomedSize);
|
||||
|
||||
await page.keyboard.type("toD");
|
||||
await expect(popup.getByText("total", { exact: true })).toBeHidden();
|
||||
// Refreshing the results rebuilds the list; the hint bar must stay below it, not jump to the top.
|
||||
@@ -125,37 +124,6 @@ test("completion lists the server's items and inserts the chosen one", async ({
|
||||
await expect(popup).toBeHidden();
|
||||
await expect(editor.locator(".cm-activeLine")).toHaveText(/^\s*order\.toDto\(\)$/);
|
||||
expect((await ipcCalls(page, "lsp_completion")).length).toBeGreaterThan(0);
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/platform/actions.ts";
|
||||
await (await import(/* @vite-ignore */ path)).executeAction("editor.splitRight");
|
||||
});
|
||||
const panes = page.locator("[data-pane-id]");
|
||||
await expect(panes).toHaveCount(2);
|
||||
await page.setViewportSize({ width: 480, height: 760 });
|
||||
await panes.last().locator(".cm-content").focus();
|
||||
await page.keyboard.press("End");
|
||||
await page.keyboard.press("Enter");
|
||||
await page.keyboard.type("order.");
|
||||
await page.keyboard.press("Control+Space");
|
||||
const footer = popup.locator(".cm-lsp-completion-footer");
|
||||
await expect
|
||||
.poll(() =>
|
||||
footer.evaluate((el) => {
|
||||
const tip = el.querySelector("span")!;
|
||||
const sort = el.querySelector("button")!;
|
||||
const a = tip.getBoundingClientRect();
|
||||
const b = sort.getBoundingClientRect();
|
||||
return {
|
||||
oneRow: Math.abs(a.y + a.height / 2 - b.y - b.height / 2) <= 1,
|
||||
hintClipped: tip.scrollWidth > tip.clientWidth,
|
||||
sortFits: sort.scrollWidth <= sort.clientWidth + 1 && b.right <= el.getBoundingClientRect().right,
|
||||
};
|
||||
}),
|
||||
)
|
||||
.toEqual({ oneRow: true, hintClipped: true, sortFits: true });
|
||||
await expect(footer.getByTitle("Press ↵ to insert, ⇥ to replace")).toHaveCSS("font-size", "12px");
|
||||
await expect(footer.getByRole("button", { name: "Sort by name" })).toBeInViewport({ ratio: 1 });
|
||||
});
|
||||
|
||||
test("long completion signatures fit the editor when the workbench is narrowed", async ({ workbench: page }) => {
|
||||
|
||||
@@ -1155,6 +1155,60 @@ async function stubEarlierAmend(page: Page) {
|
||||
});
|
||||
}
|
||||
|
||||
test("Amend sizes the chooser for long subjects while keeping the last commit action distinct", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await stubEarlierAmend(page);
|
||||
const tip = "Record regional settlement adjustments across the quarterly audit and reconciliation reports";
|
||||
const earlier = "Expand the warehouse reconciliation report with monthly ledger and inventory audit totals";
|
||||
await page.evaluate(
|
||||
({ tip, earlier }) => {
|
||||
const handlers = window.__ipc.handlers;
|
||||
const log = handlers.vcs_log!;
|
||||
handlers.vcs_log = (args) =>
|
||||
(log(args) as { id: string; summary: string; message: string }[]).map((commit) => {
|
||||
const subject = commit.id === "1111111" ? tip : commit.id === "aaaaaaa" ? earlier : commit.summary;
|
||||
return { ...commit, summary: subject, message: subject };
|
||||
});
|
||||
},
|
||||
{ tip, earlier },
|
||||
);
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await page.keyboard.press("Meta+k");
|
||||
const panel = page.getByRole("region", { name: "Commit", exact: true });
|
||||
const choose = panel.getByRole("button", { name: "Choose Commit to Amend", exact: true });
|
||||
await choose.click();
|
||||
const list = page.getByRole("listbox", { name: "Choose Commit to Amend", exact: true });
|
||||
const popup = list.locator("xpath=ancestor::*[@data-popup]");
|
||||
const search = popup.getByRole("textbox", { name: "Search commits", exact: true });
|
||||
const last = list.getByRole("option", { name: /^Amend Last Commit/ });
|
||||
const previous = list.getByRole("option", { name: earlier, exact: true });
|
||||
|
||||
await expect(previous).toBeVisible();
|
||||
const wide = (await popup.boundingBox())!;
|
||||
expect(wide.width).toBeGreaterThan(360);
|
||||
expect(wide.width).toBeLessThanOrEqual(522);
|
||||
await expect(last.getByText("Amend Last Commit", { exact: true })).toHaveCSS("font-weight", "600");
|
||||
await expect(last.getByText(tip, { exact: true })).toHaveAttribute("title", tip);
|
||||
await expect(previous.getByText(earlier, { exact: true })).toHaveAttribute("title", earlier);
|
||||
|
||||
await page.setViewportSize({ width: 440, height: 520 });
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const box = (await popup.boundingBox())!;
|
||||
return box.x >= 0 && box.x + box.width <= 440 && box.width < wide.width;
|
||||
})
|
||||
.toBe(true);
|
||||
await expect(search).toBeFocused();
|
||||
await search.fill("inventory audit");
|
||||
await expect(previous).toBeVisible();
|
||||
await search.press("Enter");
|
||||
await expect(list).toBeHidden();
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await page.keyboard.press("Meta+k");
|
||||
await expect(panel.getByRole("textbox", { name: "Commit message" })).toHaveValue(earlier);
|
||||
});
|
||||
|
||||
test("Amend can select an earlier commit before protected history", async ({ workbench: page }) => {
|
||||
await stubEarlierAmend(page);
|
||||
await page.keyboard.press("Meta+k");
|
||||
|
||||
@@ -1045,7 +1045,6 @@ const completionPopup = ViewPlugin.fromClass(
|
||||
footer.className = "cm-lsp-completion-footer";
|
||||
const tip = document.createElement("span");
|
||||
tip.textContent = tx("Press ↵ to insert, ⇥ to replace");
|
||||
tip.title = tip.textContent;
|
||||
footer.append(tip, sortToggle(this.view));
|
||||
}
|
||||
// CodeMirror appends a fresh list when the candidates change.
|
||||
|
||||
@@ -212,28 +212,22 @@ export const lspTheme = EditorView.theme({
|
||||
color: "var(--fg-muted)",
|
||||
},
|
||||
".cm-lsp-completion-footer, .cm-lsp-inplace-footer": {
|
||||
display: "flex",
|
||||
flex: "none",
|
||||
flexWrap: "wrap",
|
||||
alignItems: "center",
|
||||
padding: "5px 12px",
|
||||
backgroundColor: "var(--bg-popup-inline, var(--bg-elev))",
|
||||
color: "var(--fg-subtle)",
|
||||
fontFamily: "var(--font-ui)",
|
||||
fontSize: "var(--fs-small)",
|
||||
gap: "var(--space-1) var(--space-3)",
|
||||
justifyContent: "space-between",
|
||||
borderRadius: "0 0 calc(var(--radius-popup) - 1px) calc(var(--radius-popup) - 1px)",
|
||||
},
|
||||
".cm-lsp-completion-footer": {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "minmax(0, 1fr) minmax(0, max-content)",
|
||||
gap: "var(--space-2)",
|
||||
paddingBlock: "var(--space-1) 3px",
|
||||
paddingInline: "var(--space-3) var(--space-2)",
|
||||
},
|
||||
".cm-lsp-completion-footer > span, .cm-lsp-completion-sort": {
|
||||
minWidth: "0",
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
whiteSpace: "nowrap",
|
||||
},
|
||||
".cm-lsp-completion-sort": {
|
||||
flex: "none",
|
||||
maxWidth: "100%",
|
||||
padding: "0",
|
||||
border: "none",
|
||||
background: "none",
|
||||
@@ -496,14 +490,7 @@ export const lspTheme = EditorView.theme({
|
||||
'.cm-lsp-inplace-suggestions button[aria-current="true"]': {
|
||||
backgroundColor: "var(--bg-list-selected, var(--bg-tree-selected, var(--bg-selected-strong)))",
|
||||
},
|
||||
".cm-lsp-inplace-footer": {
|
||||
display: "flex",
|
||||
flexWrap: "wrap",
|
||||
padding: "5px 12px",
|
||||
gap: "var(--space-1) var(--space-3)",
|
||||
justifyContent: "space-between",
|
||||
overflowWrap: "anywhere",
|
||||
},
|
||||
".cm-lsp-inplace-footer": { overflowWrap: "anywhere" },
|
||||
|
||||
// --- floating lightbulb (intentions.ts) -----------------------------------
|
||||
".cm-lsp-bulb": {
|
||||
|
||||
@@ -42,6 +42,7 @@ export function AmendTargetMenu({ root }: { root: string }) {
|
||||
{
|
||||
value: LAST_COMMIT,
|
||||
label: "Amend Last Commit",
|
||||
emphasized: true,
|
||||
detail: available?.latest?.summary,
|
||||
verbatimDetail: true,
|
||||
},
|
||||
|
||||
@@ -143,9 +143,13 @@
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.amendPicker {
|
||||
width: min(360px, calc(100vw - var(--space-4)));
|
||||
width: max-content;
|
||||
min-width: min(280px, calc(100vw - var(--space-4)));
|
||||
padding-block: var(--space-1);
|
||||
}
|
||||
.amendPicker > * {
|
||||
max-width: 520px;
|
||||
}
|
||||
.amendPickerRows {
|
||||
max-height: calc(5 * var(--h-list-row));
|
||||
}
|
||||
|
||||
@@ -113,6 +113,9 @@
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.emphasized {
|
||||
font-weight: 600;
|
||||
}
|
||||
/* The label keeps its width (up to most of the row); a long detail (a path) is cut instead. */
|
||||
.withDetail {
|
||||
flex-shrink: 0;
|
||||
|
||||
@@ -22,6 +22,8 @@ import styles from "./Select.module.css";
|
||||
export interface SelectOption<V extends string = string> {
|
||||
value: V;
|
||||
label: string;
|
||||
/** Give the label extra weight in the list. */
|
||||
emphasized?: boolean;
|
||||
/** User values are displayed as written. */
|
||||
verbatim?: boolean;
|
||||
icon?: IconName | (string & {});
|
||||
@@ -280,7 +282,7 @@ export function SelectListbox<V extends string = string>({
|
||||
<span className={styles.check} />
|
||||
{o.tree && <TreeIndent {...o.tree} />}
|
||||
{o.icon && <Icon name={o.icon} size={14} />}
|
||||
<span>{labelOf(o)}</span>
|
||||
<span className={o.emphasized ? styles.emphasized : undefined}>{labelOf(o)}</span>
|
||||
{o.detail && <span className={styles.sizerDetail}>{detailOf(o)}</span>}
|
||||
</div>
|
||||
))}
|
||||
@@ -315,7 +317,10 @@ export function SelectListbox<V extends string = string>({
|
||||
<span className={styles.check}>{o.value === value && <Icon name="check" size={12} />}</span>
|
||||
{o.tree && <TreeIndent {...o.tree} />}
|
||||
{o.icon && <Icon name={o.icon} size={14} />}
|
||||
<span className={clsx(styles.optionLabel, detail && styles.withDetail)} title={label}>
|
||||
<span
|
||||
className={clsx(styles.optionLabel, detail && styles.withDetail, o.emphasized && styles.emphasized)}
|
||||
title={label}
|
||||
>
|
||||
{highlight(label)}
|
||||
</span>
|
||||
{detail && (
|
||||
|
||||
Reference in new issue
Заблокувати користувача