diff --git a/src/editor/lsp/Popups.module.css b/src/editor/lsp/Popups.module.css index 1a7f2965e..eb422edad 100644 --- a/src/editor/lsp/Popups.module.css +++ b/src/editor/lsp/Popups.module.css @@ -400,8 +400,15 @@ text-overflow: ellipsis; } +/* Dialog bodies get no padding of their own; wrap the groups like Analysis dialogs' .form. */ +.reformatBody { + display: flex; + flex-direction: column; + gap: 10px; + padding: 14px; +} .reformatGroup { - margin: 0 0 10px; + margin: 0; padding: 0; border: 0; display: flex; diff --git a/src/editor/lsp/Popups.test.tsx b/src/editor/lsp/Popups.test.tsx index 7237641d9..7a9a65ebe 100644 --- a/src/editor/lsp/Popups.test.tsx +++ b/src/editor/lsp/Popups.test.tsx @@ -17,6 +17,7 @@ vi.mock("@/workbench/contributions", async (orig) => { const { LspPopups, DocumentationWindow } = await import("./Popups"); const { closePopup, openPopup, useLspPopup } = await import("./popupStore"); const { useDocWindow, pushHistory, stepHistory, hoverCandidates } = await import("./docs"); +import popupStyles from "./Popups.module.css"; const loc = (path: string, line: number): Location => ({ path, @@ -223,3 +224,23 @@ describe("quick definition popup", () => { expect(openFile).toHaveBeenCalledWith("/p/b.ts", { selection: { line: 5, col: 4 }, focus: true }); }); }); + +describe("reformat dialog", () => { + it("wraps its content in the padded body", () => { + const onRun = vi.fn(); + openPopup({ + kind: "reformat", + title: "Reformat File", + hasSelection: false, + canOptimizeImports: true, + initial: { selectionOnly: false, optimizeImports: false }, + onRun, + }); + render(); + const body = screen.getByRole("dialog", { name: "Reformat File" }).querySelector("[data-dialog-body]")!; + expect(body.firstElementChild).toHaveClass(popupStyles.reformatBody!); + expect(body.firstElementChild!.querySelectorAll("fieldset")).toHaveLength(2); + fireEvent.click(screen.getByRole("button", { name: "Run" })); + expect(onRun).toHaveBeenCalledWith({ selectionOnly: false, optimizeImports: false }); + }); +}); diff --git a/src/editor/lsp/Popups.tsx b/src/editor/lsp/Popups.tsx index 2c8288efd..5317310cf 100644 --- a/src/editor/lsp/Popups.tsx +++ b/src/editor/lsp/Popups.tsx @@ -621,36 +621,43 @@ function ReformatDialog({ popup }: { popup: Extract -
- - Scope - - -
+ ); }