дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-28 05:22:23 +02:00
Порівняти коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
53502d2460 | ||
|
|
844c2f3145 | ||
|
|
76d67145f5 | ||
|
|
cf4273eeea |
No files matched your search
Створено
+4
-4
@@ -2361,9 +2361,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.2"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
|
||||
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
@@ -10827,9 +10827,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.8"
|
||||
version = "2.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
|
||||
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,6 +1,66 @@
|
||||
import type { Locator } from "@playwright/test";
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Find Usages places read and write filters with the other actions", async ({ workbench: page }) => {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const modulePath = "/src/features/code-insight/usages.ts";
|
||||
const { useUsagesPopup } = await import(modulePath);
|
||||
const path = "/dev/acme-api/src/SettlementService.ts";
|
||||
const lines = ["const current = settlement;", "settlement = next;"];
|
||||
window.__ipc.handlers.fs_read_text = () => lines.join("\n");
|
||||
useUsagesPopup.setState({
|
||||
open: true,
|
||||
anchor: { x: 100, y: 150 },
|
||||
symbol: "settlement",
|
||||
loading: false,
|
||||
scope: "project",
|
||||
groups: [
|
||||
{
|
||||
path,
|
||||
usages: lines.map((text, line) => ({
|
||||
path,
|
||||
line,
|
||||
col: text.indexOf("settlement"),
|
||||
endCol: text.indexOf("settlement") + "settlement".length,
|
||||
text,
|
||||
access: line === 0 ? "read" : "write",
|
||||
})),
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
const popup = page.getByRole("dialog", { name: "Usages", exact: true });
|
||||
const read = { name: "Show read accesses", exact: true };
|
||||
const write = { name: "Show write accesses", exact: true };
|
||||
const actions = popup.getByRole("button", { name: "Show Preview", exact: true }).locator("..");
|
||||
await expect(popup.getByRole("option")).toHaveCount(2);
|
||||
for (const width of [1120, 540]) {
|
||||
await page.setViewportSize({ width, height: 640 });
|
||||
expect(await actions.getByRole("toolbar", { name: "Usage access filters", exact: true }).count()).toBe(1);
|
||||
await expect(actions.getByRole("button", read)).toBeInViewport({ ratio: 1 });
|
||||
await expect(actions.getByRole("button", write)).toBeInViewport({ ratio: 1 });
|
||||
}
|
||||
await actions.getByRole("button", write).click();
|
||||
await expect(popup.getByRole("option")).toHaveCount(1);
|
||||
await popup.getByRole("button", { name: /Open in Find Window/ }).click();
|
||||
|
||||
const view = page.getByRole("region", { name: "Find Usages", exact: true });
|
||||
const toolbar = view.getByRole("toolbar", { name: "Usages actions", exact: true });
|
||||
const readButton = toolbar.getByRole("button", read);
|
||||
const writeButton = toolbar.getByRole("button", write);
|
||||
await expect(readButton).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(writeButton).toHaveAttribute("aria-pressed", "false");
|
||||
const a = (await readButton.boundingBox())!;
|
||||
const b = (await writeButton.boundingBox())!;
|
||||
expect(a.x).toBeCloseTo(b.x, 0);
|
||||
expect(b.y).toBeGreaterThanOrEqual(a.y + a.height);
|
||||
await expect(view.locator("mark")).toHaveCount(1);
|
||||
await writeButton.click();
|
||||
await expect(view.locator("mark")).toHaveCount(2);
|
||||
});
|
||||
|
||||
async function checkSize(icon: Locator, size = 16) {
|
||||
const dimensions = await icon.evaluate((node) => {
|
||||
const style = getComputedStyle(node);
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
import type { SearchQuery } from "../src/bindings";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Replace All keeps both values readable and the actions visible", async ({ workbench: page }) => {
|
||||
const pattern = `LEGACY_${"MONTH_END_RECONCILIATION_INPUT_".repeat(15)}END`;
|
||||
const replacement = `ACTIVE_${"MONTH_END_RECONCILIATION_OUTPUT_".repeat(18)}END`;
|
||||
await page.emulateMedia({ reducedMotion: "reduce" });
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate((pattern) => {
|
||||
window.__ipc.handlers.search_validate = () => null;
|
||||
window.__ipc.handlers.search_start = ({ query, onEvent }) => {
|
||||
if ((query as SearchQuery).pattern !== pattern) return null;
|
||||
setTimeout(() => {
|
||||
for (const relPath of ["invoice.txt", "receipt.txt"]) {
|
||||
window.__ipc.send(onEvent, {
|
||||
type: "file",
|
||||
file: {
|
||||
path: `/dev/acme-api/${relPath}`,
|
||||
relPath,
|
||||
matches: [{ line: 0, text: pattern, ranges: [[0, pattern.length]], textOffset: 0 }],
|
||||
},
|
||||
});
|
||||
}
|
||||
window.__ipc.send(onEvent, {
|
||||
type: "done",
|
||||
summary: { files: 2, matches: 2, limitHit: false, cancelled: false, elapsedMs: 1 },
|
||||
});
|
||||
}, 20);
|
||||
return null;
|
||||
};
|
||||
}, pattern);
|
||||
await page.keyboard.press("Meta+Shift+r");
|
||||
const popup = page.getByRole("dialog", { name: "Replace in Files", exact: true });
|
||||
await popup.getByRole("textbox", { name: "Text to find", exact: true }).fill(pattern);
|
||||
const replacementInput = popup.getByRole("textbox", { name: "Replace with", exact: true });
|
||||
await replacementInput.fill(replacement);
|
||||
await expect(popup.getByRole("listbox", { name: "Matches" }).getByRole("option")).toHaveCount(2);
|
||||
await page.setViewportSize({ width: 440, height: 520 });
|
||||
await popup.getByRole("button", { name: "Replace All", exact: true }).click();
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Replace All", exact: true });
|
||||
const findText = dialog.getByRole("region", { name: "Text to find", exact: true });
|
||||
const replaceText = dialog.getByRole("region", { name: "Replace with", exact: true });
|
||||
const replace = dialog.getByRole("button", { name: "Replace", exact: true });
|
||||
const cancel = dialog.getByRole("button", { name: "Cancel", exact: true });
|
||||
await expect(findText).toHaveText(pattern);
|
||||
await expect(replaceText).toHaveText(replacement);
|
||||
await expect(dialog.getByText("Replace 2 occurrences in 2 files?", { exact: true })).toBeVisible();
|
||||
const bottom = (await replace.boundingBox())!.y;
|
||||
for (const item of [findText, replaceText]) {
|
||||
await expect(item).toHaveCSS("font-size", "13px");
|
||||
expect(await item.evaluate((el) => el.scrollHeight > el.clientHeight && el.scrollWidth === el.clientWidth)).toBe(
|
||||
true,
|
||||
);
|
||||
await item.focus();
|
||||
await page.keyboard.press("End");
|
||||
await expect.poll(() => item.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
|
||||
}
|
||||
expect((await replace.boundingBox())!.y).toBeCloseTo(bottom, 0);
|
||||
await expect(replace).toBeInViewport({ ratio: 1 });
|
||||
await expect(cancel).toBeInViewport({ ratio: 1 });
|
||||
await cancel.click();
|
||||
await expect(dialog).toBeHidden();
|
||||
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await replacementInput.fill("");
|
||||
await popup.getByRole("button", { name: "Open in Find Window", exact: true }).click();
|
||||
const findWindow = page.getByRole("region", { name: "Find", exact: true });
|
||||
await findWindow.getByRole("button", { name: "Replace All", exact: true }).click();
|
||||
await expect(findText).toHaveText(pattern);
|
||||
await expect(replaceText).toHaveText("Empty text");
|
||||
await cancel.click();
|
||||
expect(await ipcCalls(page, "replace_in_files")).toHaveLength(0);
|
||||
});
|
||||
@@ -26,12 +26,12 @@ describe("the Language smoke workflow", () => {
|
||||
const { files, problems } = await smokeInputs(repo, workflow);
|
||||
expect(problems).toEqual([]);
|
||||
expect(describeUnselected(await unselected(workflow, [...files.keys()]), files)).toBe("");
|
||||
});
|
||||
}, 20000);
|
||||
|
||||
it("runs every language when a crate the smoke runs changes", async () => {
|
||||
const crates = rustSmokeInputs(repo);
|
||||
expect(describeUnselected(await unselected(workflow, [...crates.keys()]), crates)).toBe("");
|
||||
});
|
||||
}, 20000);
|
||||
});
|
||||
|
||||
const dirs: string[] = [];
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5);
|
||||
padding: 3px 6px;
|
||||
flex-shrink: 0;
|
||||
flex: none;
|
||||
}
|
||||
.vertical {
|
||||
flex-direction: column;
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import clsx from "clsx";
|
||||
import { useTx } from "@/platform/i18n";
|
||||
import { IconButton } from "@/ui";
|
||||
import type { Usage } from "./usages";
|
||||
import styles from "./UsageAccessFilter.module.css";
|
||||
@@ -45,11 +47,16 @@ export function filterUsageAccess(items: readonly Usage[], options: UsageAccessO
|
||||
|
||||
export const supportsUsageAccess = (items: readonly Usage[]) => items.some((u) => u.access && u.access !== "unknown");
|
||||
|
||||
export function UsageAccessFilter({ items }: { items: readonly Usage[] }) {
|
||||
export function UsageAccessFilter({ items, vertical }: { items: readonly Usage[]; vertical?: boolean }) {
|
||||
const tx = useTx();
|
||||
const options = useUsageAccessOptions();
|
||||
if (!supportsUsageAccess(items)) return null;
|
||||
return (
|
||||
<div className={styles.toolbar} role="toolbar" aria-label="Usage access filters">
|
||||
<div
|
||||
className={clsx(styles.toolbar, vertical && styles.vertical)}
|
||||
role={vertical ? "group" : "toolbar"}
|
||||
aria-label={tx("Usage access filters")}
|
||||
>
|
||||
<IconButton
|
||||
icon="show-read-access"
|
||||
size="small"
|
||||
|
||||
@@ -176,6 +176,7 @@ function UsagesPopupInner() {
|
||||
</span>
|
||||
</span>
|
||||
<div className={styles.actions}>
|
||||
<UsageAccessFilter items={all} />
|
||||
{scope && (
|
||||
<Select<UsageScope>
|
||||
variant="ghost"
|
||||
@@ -213,7 +214,6 @@ function UsagesPopupInner() {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<UsageAccessFilter items={all} />
|
||||
{note && (
|
||||
<div className={styles.note} data-testid="usages-note">
|
||||
{note}
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
gap: var(--space-0-5);
|
||||
padding: 4px 0;
|
||||
border-right: 1px solid var(--border);
|
||||
overflow-y: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.toolbarSep {
|
||||
flex: none;
|
||||
width: 16px;
|
||||
height: 1px;
|
||||
margin: 3px 0;
|
||||
@@ -66,7 +69,6 @@
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.body > [role="toolbar"],
|
||||
.body > .summary {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
@@ -284,11 +284,11 @@ export function UsagesView() {
|
||||
<IconButton icon="arrow-up" action="navigate.prevOccurrence" size="small" iconSize={16} />
|
||||
<IconButton icon="arrow-down" action="navigate.nextOccurrence" size="small" iconSize={16} />
|
||||
<span className={styles.toolbarSep} />
|
||||
<UsageAccessFilter items={allUsages} vertical />
|
||||
<IconButton icon="expand-all" title="Expand All" size="small" iconSize={16} onClick={() => setAll(false)} />
|
||||
<IconButton icon="collapse-all" title="Collapse All" size="small" iconSize={16} onClick={() => setAll(true)} />
|
||||
</div>
|
||||
<div className={styles.body} onKeyDown={onKeyDown}>
|
||||
<UsageAccessFilter items={allUsages} />
|
||||
{!search.loading && !search.error && search.scope === "project" && (
|
||||
<div className={styles.summary}>
|
||||
<T>Usages in Project Files</T>
|
||||
|
||||
@@ -53,7 +53,7 @@ it("shows a plain count for unclassified searches after a Java access mode was s
|
||||
});
|
||||
const view = render(<UsagesView />);
|
||||
expect(screen.getByText("2 results")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("toolbar", { name: "Usage access filters" })).toBeNull();
|
||||
expect(screen.queryByRole("group", { name: "Usage access filters" })).toBeNull();
|
||||
view.unmount();
|
||||
useUsageAccessOptions.setState({ read: true, write: true });
|
||||
useUsages.setState({ tabs: [], active: null });
|
||||
|
||||
@@ -103,9 +103,9 @@ describe("replace flow model", () => {
|
||||
});
|
||||
|
||||
it("confirmation and summary texts carry the counts", () => {
|
||||
expect(confirmText({ usages: 1, files: 1 })).toBe("Replace 1 occurrence in 1 file?");
|
||||
expect(confirmText({ usages: 3, files: 1 })).toBe("Replace 3 occurrences in 1 file?");
|
||||
expect(confirmText({ usages: 3, files: 2 })).toBe("Replace 3 occurrences in 2 files?");
|
||||
expect(confirmText({ usages: 3, files: 1 }, "foo", "bar")).toBe(
|
||||
"Replace 3 occurrences of 'foo' with 'bar' in 1 file?",
|
||||
);
|
||||
expect(summaryText({ files: 2, replacements: 1, failed: 0, cancelled: false, elapsedMs: 3 })).toBe(
|
||||
"Replaced 1 occurrence in 2 files",
|
||||
);
|
||||
|
||||
@@ -39,12 +39,14 @@ import {
|
||||
} from "@/ui";
|
||||
import { useRowHeight } from "@/ui/density";
|
||||
import { maybeEditorService, notifications } from "@/workbench/contributions";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { basename, dirname, openLocation } from "../common/open";
|
||||
import { CodePreview, MatchText, ReplaceDiffPreview } from "./parts";
|
||||
import { clearPreviewCache } from "./preview";
|
||||
import { confirmReplacement } from "./ReplaceAllConfirmation";
|
||||
import {
|
||||
NO_MARKS,
|
||||
confirmAllText,
|
||||
confirmText,
|
||||
countUsages,
|
||||
groupState,
|
||||
loadReplacePreview,
|
||||
@@ -344,11 +346,22 @@ function FindInFilesDialog() {
|
||||
void replaceAll(usages);
|
||||
return;
|
||||
}
|
||||
const ok = await confirmReplacement({
|
||||
counts: allInScope ? null : counts,
|
||||
pattern: s.pattern,
|
||||
replacement: s.replacement || "",
|
||||
hasExclusions: marks.excluded.size > 0,
|
||||
const ok = await confirm({
|
||||
title: "Replace All",
|
||||
ok: "Replace",
|
||||
message: (
|
||||
<>
|
||||
{allInScope
|
||||
? confirmAllText(s.pattern, s.replacement || "")
|
||||
: confirmText(counts, s.pattern, s.replacement || "")}
|
||||
{marks.excluded.size > 0 && (
|
||||
<>
|
||||
{" "}
|
||||
<T>Excluded usages are skipped.</T>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
),
|
||||
});
|
||||
if (ok) void replaceAll(usages, allInScope);
|
||||
};
|
||||
|
||||
@@ -23,12 +23,14 @@ import {
|
||||
T,
|
||||
} from "@/ui";
|
||||
import { notifications, useOccurrenceNavigator } from "@/workbench/contributions";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { basename, openLocation, relDir } from "../common/open";
|
||||
import { countFileMatches } from "./session";
|
||||
import { CodePreview, MatchText, type PreviewHighlight } from "./parts";
|
||||
import { confirmReplacement } from "./ReplaceAllConfirmation";
|
||||
import {
|
||||
NO_MARKS,
|
||||
confirmAllText,
|
||||
confirmText,
|
||||
countUsages,
|
||||
groupState,
|
||||
loadReplacePreview,
|
||||
@@ -367,11 +369,22 @@ function FindTabView({ tab }: { tab: FindTab }) {
|
||||
// Past the search's limit, every match in the scope is replaced, listed or not (as in IDEA).
|
||||
const allInScope = !!st.summary?.limitHit;
|
||||
const confirmReplaceAll = async () => {
|
||||
const ok = await confirmReplacement({
|
||||
counts: allInScope ? null : countUsages(allPending),
|
||||
pattern: tab.query.pattern,
|
||||
replacement: tab.replacement ?? "",
|
||||
hasExclusions: marks.excluded.size > 0,
|
||||
const ok = await confirm({
|
||||
title: "Replace All",
|
||||
ok: "Replace",
|
||||
message: (
|
||||
<>
|
||||
{allInScope
|
||||
? confirmAllText(tab.query.pattern, tab.replacement ?? "")
|
||||
: confirmText(countUsages(allPending), tab.query.pattern, tab.replacement ?? "")}
|
||||
{marks.excluded.size > 0 && (
|
||||
<>
|
||||
{" "}
|
||||
<T>Excluded usages are skipped.</T>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
),
|
||||
});
|
||||
if (ok) void replace(allPending, allInScope);
|
||||
};
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
.content {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
font-size: var(--fs-ui);
|
||||
}
|
||||
|
||||
.content p,
|
||||
.values,
|
||||
.values dd,
|
||||
.values pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.values {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
align-items: start;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.values dt {
|
||||
padding-block: var(--space-1);
|
||||
color: var(--fg-secondary);
|
||||
}
|
||||
|
||||
.values pre {
|
||||
max-height: 5em;
|
||||
padding: var(--space-1) var(--space-2);
|
||||
overflow: auto;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-control);
|
||||
background: var(--bg-field);
|
||||
font-family: var(--font-mono);
|
||||
font-size: inherit;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.values pre:focus-visible {
|
||||
outline: 1px solid var(--focus-ring);
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: var(--fg-muted);
|
||||
font-family: var(--font-ui);
|
||||
}
|
||||
|
||||
.note {
|
||||
color: var(--fg-muted);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { T } from "@/ui";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { confirmText, type ReplaceCounts } from "./replaceFlow";
|
||||
import styles from "./ReplaceAllConfirmation.module.css";
|
||||
|
||||
export function confirmReplacement({
|
||||
counts,
|
||||
pattern,
|
||||
replacement,
|
||||
hasExclusions,
|
||||
}: {
|
||||
counts: ReplaceCounts | null;
|
||||
pattern: string;
|
||||
replacement: string;
|
||||
hasExclusions: boolean;
|
||||
}): Promise<boolean> {
|
||||
return confirm({
|
||||
title: "Replace All",
|
||||
ok: "Replace",
|
||||
message: (
|
||||
<div className={styles.content}>
|
||||
<p>{counts ? confirmText(counts) : <T>Replace every occurrence in the scope?</T>}</p>
|
||||
<dl className={styles.values}>
|
||||
<dt>
|
||||
<T>Text to find</T>
|
||||
</dt>
|
||||
<dd>
|
||||
<pre role="region" aria-label={tx("Text to find")} tabIndex={0}>
|
||||
{pattern}
|
||||
</pre>
|
||||
</dd>
|
||||
<dt>
|
||||
<T>Replace with</T>
|
||||
</dt>
|
||||
<dd>
|
||||
<pre role="region" aria-label={tx("Replace with")} tabIndex={0}>
|
||||
{replacement || (
|
||||
<span className={styles.empty}>
|
||||
<T>Empty text</T>
|
||||
</span>
|
||||
)}
|
||||
</pre>
|
||||
</dd>
|
||||
</dl>
|
||||
{!counts && (
|
||||
<p className={styles.note}>
|
||||
<T>The search hit its limit, so it runs again to find any additional matches.</T>
|
||||
</p>
|
||||
)}
|
||||
{hasExclusions && (
|
||||
<p className={styles.note}>
|
||||
<T>Excluded usages are skipped.</T>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
});
|
||||
}
|
||||
@@ -91,10 +91,15 @@ export function countUsages(usages: readonly Usage[]): ReplaceCounts {
|
||||
}
|
||||
|
||||
/** "Replace 3 occurrences in 2 files" for the confirmation dialog. */
|
||||
export function confirmText({ usages, files }: ReplaceCounts): string {
|
||||
if (usages === 1) return tx("Replace 1 occurrence in 1 file?");
|
||||
if (files === 1) return tx`Replace ${usages} occurrences in 1 file?`;
|
||||
return tx`Replace ${usages} occurrences in ${files} files?`;
|
||||
export function confirmText(c: ReplaceCounts, pattern: string, replacement: string): string {
|
||||
const occ = `${c.usages} occurrence${c.usages === 1 ? "" : "s"}`;
|
||||
const files = `${c.files} file${c.files === 1 ? "" : "s"}`;
|
||||
return `Replace ${occ} of '${pattern}' with '${replacement}' in ${files}?`;
|
||||
}
|
||||
|
||||
/** Confirmation for Replace All once the search hit its limit (the count shown is not the total). */
|
||||
export function confirmAllText(pattern: string, replacement: string): string {
|
||||
return tx`Replace every occurrence of '${pattern}' with '${replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.`;
|
||||
}
|
||||
|
||||
/** Toggles exclusion of every usage in `groups` (all excluded → include them again). */
|
||||
|
||||
@@ -1578,6 +1578,7 @@
|
||||
"Read the project's resolved Maven and Gradle dependencies": "Read the project's resolved Maven and Gradle dependencies",
|
||||
"Resolved Dependencies": "Resolved Dependencies",
|
||||
"Usages of {symbol}": "Usages of {symbol}",
|
||||
"Usage access filters": "Usage access filters",
|
||||
"Read the clipboard's text and images when you run one of its commands": "Read the clipboard's text and images when you run one of its commands",
|
||||
"Output: {channel}": "Output: {channel}",
|
||||
"You can close this tab.": "You can close this tab.",
|
||||
@@ -3180,15 +3181,7 @@
|
||||
"Stacked": "Stacked",
|
||||
"Resize plugin panes": "Resize plugin panes",
|
||||
"Run a Python script or module": "Run a Python script or module",
|
||||
"Replace 1 occurrence in 1 file?": "Replace 1 occurrence in 1 file?",
|
||||
"Replace {usages} occurrences in 1 file?": "Replace {usages} occurrences in 1 file?",
|
||||
"Replace {usages} occurrences in {files} files?": "Replace {usages} occurrences in {files} files?",
|
||||
"Replace every occurrence in the scope?": "Replace every occurrence in the scope?",
|
||||
"The search hit its limit, so it runs again to find any additional matches.": "The search hit its limit, so it runs again to find any additional matches.",
|
||||
"Text to find": "Text to find",
|
||||
"Replace with": "Replace with",
|
||||
"Empty text": "Empty text",
|
||||
"Excluded usages are skipped.": "Excluded usages are skipped.",
|
||||
"Replace every occurrence of '{pattern}' with '{replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.": "Replace every occurrence of '{pattern}' with '{replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.",
|
||||
"Server default": "Server default",
|
||||
"New Database": "New Database",
|
||||
"Owner:": "Owner:",
|
||||
|
||||
@@ -2588,8 +2588,7 @@
|
||||
"Resize Markdown preview": "Markdown önizlemesini yeniden boyutlandır",
|
||||
"Resize plugin panes": "Eklenti bölmelerini yeniden boyutlandır",
|
||||
"Run a Python script or module": "Python betiği veya modülü çalıştır",
|
||||
"Replace every occurrence in the scope?": "Kapsamdaki tüm eşleşmeler değiştirilsin mi?",
|
||||
"The search hit its limit, so it runs again to find any additional matches.": "Arama sınıra ulaştığı için kalan eşleşmeleri bulmak üzere yeniden çalıştırılacak.",
|
||||
"Replace every occurrence of '{pattern}' with '{replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.": "Kapsamdaki tüm '{pattern}' eşleşmeleri '{replacement}' ile değiştirilsin mi? Arama sınıra ulaştığı için listelenmeyen eşleşmeleri bulmak üzere yeniden çalıştırılacak.",
|
||||
"Server default": "Sunucu varsayılanı",
|
||||
"New Database": "Yeni veritabanı",
|
||||
"Owner:": "Sahip:",
|
||||
|
||||
@@ -3392,8 +3392,7 @@
|
||||
"Group By": "分組依據",
|
||||
"Show on Double-Click": "雙擊時顯示",
|
||||
"Follow the Interface": "跟隨介面",
|
||||
"Replace every occurrence in the scope?": "要取代整個範圍內的所有相符項目嗎?",
|
||||
"The search hit its limit, so it runs again to find any additional matches.": "搜尋已達上限,將重新搜尋以找出其餘相符項目。",
|
||||
"Replace every occurrence of '{pattern}' with '{replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.": "要在整個範圍內把所有「{pattern}」取代為「{replacement}」嗎?搜尋已達上限,將重新搜尋以找出未列出的相符項目。",
|
||||
"Review": "審查",
|
||||
"Commit and Push…": "提交併推送…",
|
||||
"Language server": "語言伺服器",
|
||||
|
||||
@@ -3820,12 +3820,7 @@
|
||||
"Group By": "分组依据",
|
||||
"Show on Double-Click": "双击时显示",
|
||||
"Follow the Interface": "跟随界面",
|
||||
"Replace 1 occurrence in 1 file?": "替换 1 个文件中的 1 处匹配项吗?",
|
||||
"Replace {usages} occurrences in 1 file?": "替换 1 个文件中的 {usages} 处匹配项吗?",
|
||||
"Replace {usages} occurrences in {files} files?": "替换 {files} 个文件中的 {usages} 处匹配项吗?",
|
||||
"Replace every occurrence in the scope?": "替换整个范围内的所有匹配项吗?",
|
||||
"The search hit its limit, so it runs again to find any additional matches.": "搜索已达上限,将重新搜索以找出其余匹配项。",
|
||||
"Empty text": "空文本",
|
||||
"Replace every occurrence of '{pattern}' with '{replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.": "要在整个范围内把所有「{pattern}」替换为「{replacement}」吗?搜索已达上限,将重新搜索以找出未列出的匹配项。",
|
||||
"Review": "审查",
|
||||
"Commit and Push…": "提交并推送…",
|
||||
"Language server": "语言服务器",
|
||||
|
||||
Reference in new issue
Заблокувати користувача