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

...
Автор SHA1 Повідомлення Дата
l0ng-ai 9448c86609 fix(diff): keep revision filenames readable in narrow panes 2026-11-22 13:25:26 +08:00
Gabriel Gondim 698cad2b3f fix(ci): run language smoke when editor navigation providers change (#5101)
src/editor/api.ts re-exports navigationProviders and relatedProviders, which the frontend smoke loads. Add both files to the Language smoke workflow paths and to the Changes step's smoke pattern, so scripts/smoke-paths.test.ts passes again and a change to either file runs every language.

Closes #5073
2026-11-22 12:57:44 +08:00
l0ng-ai 581c64f544 fix(vcs): surface the Git Log affected changes filter (#5130)
Show the affected-changes toggle on the changed-files toolbar when Git Log has a path filter. This makes it possible to narrow the selected commit's file list in one click. Group the Diff preview toggle and its location under Layout in View Options. Let the toolbar wrap when the pane is narrow.
2026-11-22 12:52:57 +08:00
l0ng-ai 77d6d81f8a fix(editor): complete /** doc stubs in PHP files and list C/C++ tags (#5127)
Two problems with the `/**` + Enter stub:

- **PHP**: `/**` + Enter right after `<?php` gave `/**` / caret, with no `*/`, so the function below ended up inside an open comment. With an unclosed `/**` directly after `<?php`, Lezer PHP parses the text as the surrounding HTML: `languageDataAt("commentTokens")` there returns only `<!-- -->` (checked with the real PHP language), and `enterInDocComment` stood back. In PHP documents it no longer requires `/* */` tokens at the caret, so the stub is closed and lists `@param` / `@return` as elsewhere in PHP.
- **C / C++**: the stub had no tags. New `cDocTags` lists `@param` per named parameter (defaults and array suffixes dropped, `void` / `...` skipped) and `@return` unless the function returns `void` or is a constructor or destructor. It handles specifiers, pointers and references, `template <…>`, qualified names (`Box<T>::take`), trailing `const` / `noexcept` / `override` and initializer lists; types, calls and statements get no tags.
2026-11-22 12:45:26 +08:00
l0ng-ai ea62941bc6 fix(editor): pair include and template angle brackets in C and C++ (#5126)
With bracket pairing on, `<` after `#include ` (C, C++) and after `std::vector` (C++) stayed single: `smartAngleBrackets` had no rule for C or C++.

- C and Objective-C: `#include <` (and `#include_next`, `#import`) pairs.
- C++ and Objective-C++: the same, plus `template <`, a standard template or cast written against its `<` (`std::vector<`, `std::make_unique<`, `static_cast<`…) and a capitalized name (`Box<`).
- Lowercase values (`a <`, `i<`), `std::cout <`, all-caps macros (`MAX<`) and `operator<` stay single.

`inLiteral` treated any node whose name contains "template" as a template literal, which made Lezer C++'s `TemplateFunction` (`std::make_unique`) look like a string; C++ template nodes are now excluded.
2026-11-22 12:42:18 +08:00
l0ng-ai 00e044b66b fix(project): group tool window options in submenus (#5118)
Project's Options menu groups its settings under Behavior, Appearance, and Sort By. Sort By includes the folder ordering toggle alongside the sort choices. The first level now has seven items, so the window controls stay visible in a short window.
2026-11-22 12:39:34 +08:00
l0ng-ai 1db368d2b4 fix(refactor): find clangd's extractions from the refactoring shortcuts (#5121)
⌥⌘V on `value * value` in C or C++ said "Selected block should represent an expression", while ⌥↵ on the same selection offered **Extract subexpression to variable** and it worked. clangd gives every tweak the kind `refactor`, and `refactor` is not contained in `refactor.extract`, so the shortcut's request returned nothing. Checked with a small LSP script against the installed clangd: `only: ["refactor"]` → `Extract subexpression to variable` (`refactor`); `only: ["refactor.extract"]` → none.

`requestKind` now asks for `refactor` in C, C++, Objective-C and Objective-C++ too (as it already does for typescript-language-server); `classifyAction` already maps a generic `refactor` action by its title.
2026-11-22 12:36:03 +08:00
l0ng-ai db50b5df5b fix(editor): keep inline find controls together (#5120)
Keep the Close button next to More in the editor's Find and Replace toolbar. The two fields share a column that scales with the editor pane. In narrow panes, the controls wrap below the query and the fields use the space freed by moving Close.
2026-11-22 12:32:52 +08:00
Deng Liu 17fe162f6c chore(dev): add dogfood build and install tasks (#5125)
Add `pnpm dogfood:build` / `pnpm dogfood:install` (and matching mise tasks) to build a fast local release app named openidea_dogfood with a grey icon. It keeps the release identifier, so it shares settings and data with the installed app.

The dogfood config clears the updater endpoints so a release never replaces the dogfood bundle, the bundle is read from Cargo's target directory, and the install output and setup docs note that the two apps share one instance and settings and that the dogfood app never updates itself.
2026-11-22 12:26:36 +08:00
32 змінених файлів з 1070 додано та 84 видалено

No files matched your search

+3 -1
Переглянути файл
@@ -28,6 +28,8 @@ on:
- "src/workbench/**"
- "src/ui/**"
- "src/editor/api.ts"
- "src/editor/navigationProviders.ts"
- "src/editor/relatedProviders.ts"
- "src/editor/core/cm/cornerInset.ts"
- "src/editor/core/cm/iconArea.ts"
- "src/editor/lsp/availability.ts"
@@ -98,7 +100,7 @@ jobs:
# ide-lsp/dap/run/sdk/tools.
unused='^crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-http|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-spell|ide-ssh|ide-vcs|ide-web)/'
# The workflow's paths, less those handled per language below.
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|core/cm/(cornerInset|iconArea)|lsp/(availability|diagnostics|files|hint|lsp|positions))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src-tauri/icons/128x128\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|navigationProviders|relatedProviders|core/cm/(cornerInset|iconArea)|lsp/(availability|diagnostics|files|hint|lsp|positions))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src-tauri/icons/128x128\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
langs=""
while read -r f; do
case "$f" in
+1
Переглянути файл
@@ -79,6 +79,7 @@ Shared agent skills live in `.agents/skills/` (`.claude/skills/` links to them):
`pnpm dev:app` also enables the global Tauri API. `pnpm dev:status` reports
this worktree's running MCP bridges and actual ports.
- `pnpm build` — typecheck + bundle frontend.
- `pnpm dogfood:build` / `pnpm dogfood:install` (or `mise run dogfood:build` / `mise run dogfood:install`) — build and locally install the grey-icon dogfood desktop app sharing release settings and data.
- `cargo nextest run --workspace` (or `cargo test`), `cargo clippy --workspace --all-targets -- -D warnings`, `cargo fmt --all`.
- `cargo test -p ide-host --test language_smoke -- --ignored --exact <language>` — code intelligence
on `fixtures/` with that language's real server installed (CI: `Language smoke`, pinned versions).
+1 -1
Переглянути файл
@@ -67,7 +67,7 @@ mise run dev
`setup` runs `pnpm install` in this worktree. `dev` and `dev:app` use the same worktree-aware launchers as the direct commands. No shell activation is needed for `mise run`.
Run `mise tasks` to list all six tasks. `mise run build` builds the frontend (not a desktop installer). `mise run test` runs Vitest and `cargo test --workspace`; `mise run check` runs the format, lint, type and unused-code checks, then both test suites. Neither requires nextest or the plugin WASM target.
Run `mise tasks` to list all tasks. `mise run build` builds the frontend (not a desktop installer); `mise run dogfood:build` and `mise run dogfood:install` build and locally install a grey-icon dogfood desktop app that shares settings and data with the release app. Only one of the two apps runs at a time, since they share one instance; settings written by the newer dogfood build can make an older release ignore the settings file. The dogfood app never updates itself: run `dogfood:install` again to pick up new changes. `mise run test` runs Vitest and `cargo test --workspace`; `mise run check` runs the format, lint, type and unused-code checks, then both test suites. Neither requires nextest or the plugin WASM target.
## Worktrees
+1 -1
Переглянути файл
@@ -67,7 +67,7 @@ mise run dev
`setup` 在当前 worktree 中执行 `pnpm install`。`dev` 和 `dev:app` 都沿用原来的启动脚本,保留 worktree 隔离。使用 `mise run` 不需要在 shell 中激活 mise。
运行 `mise tasks` 可以查看全部六个任务。`mise run build` 构建前端,不生成桌面安装包。`mise run test` 运行 Vitest 和 `cargo test --workspace`;`mise run check` 先检查格式、代码规范、类型和未使用的代码,再运行这两套测试。两者都不需要 nextest 或插件的 WASM 目标。
运行 `mise tasks` 可以查看全部任务。`mise run build` 构建前端,不生成桌面安装包;`mise run dogfood:build` 和 `mise run dogfood:install` 用于构建并在本地安装灰色图标的 dogfood 桌面版(与正式版共享设置和数据)。两者共用同一个实例,同一时间只能运行一个;较新的 dogfood 版写入的设置可能让较旧的正式版忽略整个设置文件。dogfood 版不会自动更新,需要更新时重新运行 `dogfood:install`。`mise run test` 运行 Vitest 和 `cargo test --workspace`;`mise run check` 先检查格式、代码规范、类型和未使用的代码,再运行这两套测试。两者都不需要 nextest 或插件的 WASM 目标。
## Worktree
+65 -1
Переглянути файл
@@ -1,6 +1,6 @@
import type { EditorView } from "@codemirror/view";
import type { Page } from "@playwright/test";
import { expect, test } from "./fixtures";
import { expect, stubDesktop, test } from "./fixtures";
async function openChain(page: Page) {
await page.evaluate(async () => {
@@ -46,6 +46,70 @@ test("a narrow diff keeps navigation, settings and the difference count visible"
await expect(toolbar).toContainText("1 of 1 differences");
});
test("revision titles keep both filenames in view when the diff divider moves", async ({ workbench: page }) => {
const leftName = "OrderRoutes.ts";
const rightName = "OrdersRoutes.ts";
const directory = "services/customer-orders/fulfillment/warehouse-routing/primary";
await page.setViewportSize({ width: 800, height: 650 });
await stubDesktop(page);
await page.evaluate(
async ({ directory, leftName, rightName }) => {
const inputPath = "/src/features/vcs/diffInput.ts";
const layoutPath = "/src/workbench/toolwindows/store.ts";
const { openDiff } = await import(inputPath);
const { hideAllToolWindows } = await import(layoutPath);
const leftPath = `/dev/acme-api/${directory}/${leftName}`;
const rightPath = `/dev/acme-api/${directory}/${rightName}`;
window.__ipc.handlers.vcs_file_at = (args) =>
args.rev === "7b70e02c" ? "export const region = 'east';\r\n" : "export const region = 'west';\n";
window.__ipc.handlers.vcs_file_mode = () => "100644";
hideAllToolWindows();
localStorage.setItem("openidea.vcs.diffOptions", JSON.stringify({ mode: "split", alignChanges: false }));
await openDiff({
path: rightPath,
left: { type: "rev", rev: "7b70e02c", path: leftPath },
right: { type: "rev", rev: "a8c5f31d", path: rightPath },
});
},
{ directory, leftName, rightName },
);
const left = page.getByTitle(/^7b70e02c .*OrderRoutes\.ts$/);
const right = page.getByTitle(/^a8c5f31d .*OrdersRoutes\.ts$/);
const filenamesFit = async () => {
for (const [title, filename] of [
[left, leftName],
[right, rightName],
] as const) {
await expect(title).toBeVisible();
expect(await title.getAttribute("title")).toContain(`${directory}/${filename}`);
const text = title.locator("span").filter({ hasText: filename }).last();
expect(
await text.evaluate((el, filename) => {
const node = el.firstChild!;
const range = document.createRange();
range.setStart(node, (node.textContent ?? "").length - filename.length);
range.setEnd(node, (node.textContent ?? "").length);
const bounds = range.getBoundingClientRect();
const clip = el.getBoundingClientRect();
return bounds.left >= clip.left - 1 && bounds.right <= clip.right + 1;
}, filename),
`${filename} is visible within its revision label`,
).toBe(true);
}
};
await filenamesFit();
const divider = page.getByRole("separator", { name: "Resize diff panes" });
const { x, y, width, height } = (await divider.boundingBox())!;
const leftWidth = (await left.boundingBox())!.width;
await page.mouse.move(x + width / 2, y + height / 2);
await page.mouse.down();
await page.mouse.move(x + width / 2 - 96, y + height / 2, { steps: 4 });
await page.mouse.up();
await expect.poll(async () => (await left.boundingBox())!.width).toBeLessThan(leftWidth - 60);
await filenamesFit();
});
test("a medium-width diff keeps its full status beside the viewer tools", async ({ workbench: page }) => {
await page.setViewportSize({ width: 490, height: 650 });
await page.evaluate(async () => {
+48 -1
Переглянути файл
@@ -299,6 +299,47 @@ test("⌘R replaces every match in the file", async ({ workbench: page }) => {
await expect(editor.locator(".cm-line", { hasText: "OrderDto" })).toHaveCount(2);
});
test("the inline find and replace fields share a column that grows with the editor", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 760 });
const editor = await openFromTree(page, "build.gradle.kts");
await editor.locator(".cm-content").click();
await page.keyboard.press("Meta+r");
const bar = page.getByRole("search", { name: "Replace in file" });
const find = bar.getByRole("textbox", { name: "Find" });
const replace = bar.getByRole("textbox", { name: "Replace" });
const more = bar.getByRole("button", { name: "More", exact: true });
const close = bar.getByRole("button", { name: "Close", exact: true });
await find.fill("OrderDto");
await replace.fill("OrderView");
const column = () =>
bar.evaluate((panel) => {
const [find, replace] = panel.querySelectorAll("textarea");
const findField = find!.parentElement!.getBoundingClientRect();
const replaceField = replace!.parentElement!.getBoundingClientRect();
return {
left: findField.left,
width: findField.width,
replaceLeft: replaceField.left,
replaceWidth: replaceField.width,
};
});
const initial = await column();
expect(initial.left).toBeCloseTo(initial.replaceLeft);
expect(initial.width).toBeCloseTo(initial.replaceWidth);
for (const width of [1120, 1480]) {
await page.setViewportSize({ width, height: 760 });
const [moreBox, closeBox] = await Promise.all([more.boundingBox(), close.boundingBox()]);
expect(closeBox!.y).toBeCloseTo(moreBox!.y);
expect(closeBox!.x).toBeGreaterThanOrEqual(moreBox!.x + moreBox!.width);
expect(closeBox!.x).toBeLessThanOrEqual(moreBox!.x + moreBox!.width + 4);
}
await expect.poll(async () => (await column()).width).toBeGreaterThan(initial.width + 60);
await close.click();
await expect(bar).toBeHidden();
});
test("the inline find and replace controls stay inside a narrow editor pane", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 760 });
const editor = await openFromTree(page, "build.gradle.kts");
@@ -331,13 +372,19 @@ test("the inline find and replace controls stay inside a narrow editor pane", as
await expect.poll(navigationIsBelowFind).toBe(true);
await page.setViewportSize({ width: 495, height: 760 });
await expect.poll(controlsFit).toBe(true);
const close = bar.getByRole("button", { name: "Close", exact: true });
const more = bar.getByRole("button", { name: "More", exact: true });
const [moreBox, closeBox] = await Promise.all([more.boundingBox(), close.boundingBox()]);
expect(closeBox!.y).toBeCloseTo(moreBox!.y);
expect(closeBox!.x).toBeGreaterThanOrEqual(moreBox!.x + moreBox!.width);
expect(closeBox!.x).toBeLessThanOrEqual(moreBox!.x + moreBox!.width + 4);
await expect(find).toHaveValue("OrderDto");
await expect(replace).toHaveValue("OrderView");
await next.click();
await expect(bar.getByText(/^[12]\/2$/)).toBeVisible();
await bar.getByRole("button", { name: "Replace All" }).click();
await expect(editor.locator(".cm-line", { hasText: "OrderView" })).toHaveCount(2);
await bar.getByRole("button", { name: "Close", exact: true }).click();
await close.click();
await expect(bar).toBeHidden();
});
+68
Переглянути файл
@@ -174,6 +174,74 @@ test("Git Log keeps filters and actions inside the commit pane at the minimum wi
await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible();
});
test("Git Log puts affected changes on the changed-files toolbar and groups preview options", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1100, height: 720 });
await page.evaluate(() => {
window.__ipc.handlers.vcs_commit_files = () => [
{ path: "src/prices.ts", oldPath: null, kind: "modified" },
{ path: "docs/checkout.md", oldPath: null, kind: "modified" },
];
});
const commit = page.getByRole("listbox", { name: "Commits" }).getByRole("option").first();
const toolbar = page.getByRole("toolbar", { name: "Changed files" });
const tree = page.getByRole("tree", { name: "Changed files" });
const prices = tree.getByText("prices.ts", { exact: true });
const notes = tree.getByText("checkout.md", { exact: true });
const affected = toolbar.getByRole("button", { name: "Show Only Affected Changes" });
const viewOptions = toolbar.getByRole("button", { name: "View Options" });
const menu = page.getByRole("menu");
await commit.click();
await expect(notes).toBeVisible();
await expect(affected).toHaveCount(0);
const filter = (paths: string[]) =>
page.evaluate(async (paths) => {
const mod = "/src/features/vcs/logStore.ts";
const { setLogFilters } = await import(/* @vite-ignore */ mod);
setLogFilters({ paths });
}, paths);
await filter(["/dev/acme-api/src"]);
await commit.click();
await expect(affected).toHaveAttribute("aria-pressed", "false");
await affected.press("Space");
await expect(affected).toHaveAttribute("aria-pressed", "true");
await expect(prices).toBeVisible();
await expect(notes).toHaveCount(0);
await page.setViewportSize({ width: 490, height: 550 });
await expect(affected).toBeInViewport({ ratio: 1 });
await expect
.poll(() =>
toolbar.evaluate((el) => {
const bounds = el.getBoundingClientRect();
return [...el.querySelectorAll("button")].every((button) => {
const box = button.getBoundingClientRect();
return box.left >= bounds.left && box.right <= bounds.right && box.bottom <= bounds.bottom;
});
}),
)
.toBe(true);
await viewOptions.click();
await expect(menu.getByText("Layout", { exact: true })).toBeVisible();
await expect(menu.getByRole("menuitemcheckbox", { name: "Show Only Affected Changes" })).toHaveCount(0);
const preview = menu.getByRole("menuitemcheckbox", { name: "Show Diff Preview" });
await expect(preview).toHaveAttribute("aria-checked", "true");
await preview.click();
await viewOptions.click();
await expect(preview).toHaveAttribute("aria-checked", "false");
await page.keyboard.press("Escape");
await affected.click();
await expect(notes).toBeVisible();
await filter([]);
await commit.click();
await expect(affected).toHaveCount(0);
await expect(notes).toBeVisible();
});
test("the Paths filter replaces the repository filter and can be cleared from overflow", async ({
workbench: page,
}) => {
+1
Переглянути файл
@@ -9,6 +9,7 @@ test("gives the project name room before its path in a narrow tree", async ({ wo
const pane = page.getByRole("region", { name: "Project", exact: true });
await pane.getByRole("button", { name: "Options", exact: true }).click();
await page.getByRole("menuitem", { name: "Appearance", exact: true }).hover();
await page.getByRole("menuitemcheckbox", { name: "Horizontal Scrolling" }).click();
const tree = pane.getByRole("tree", { name: "Project" });
+46
Переглянути файл
@@ -65,3 +65,49 @@ test("tool window header keeps its actions visible as the Project pane narrows",
await hide.click();
await expect(project).toBeHidden();
});
test("Project options expose behavior, appearance, and sorting as submenus", async ({ workbench: page }) => {
await openFromTree(page, "build.gradle.kts");
await page.setViewportSize({ width: 700, height: 500 });
await page.evaluate(async () => {
const path = "/src/workbench/toolwindows/store.ts";
(await import(/* @vite-ignore */ path)).setToolWindowSize("left", 185);
});
const header = page.locator('[data-toolwindow="project"] header');
const options = header.getByRole("button", { name: "Options", exact: true });
const locate = header.getByRole("button", { name: "Select Opened File", exact: true });
await options.press("Enter");
const menu = page.getByRole("menu", { name: "Project options", exact: true });
const behavior = menu.getByRole("menuitem", { name: "Behavior", exact: true });
const appearance = menu.getByRole("menuitem", { name: "Appearance", exact: true });
const sort = menu.getByRole("menuitem", { name: "Sort By", exact: true });
await expect(behavior).toBeVisible();
await expect(behavior).toBeFocused();
await behavior.press("ArrowRight");
const alwaysSelect = page.getByRole("menuitemcheckbox", { name: "Always Select Opened File", exact: true });
await expect(alwaysSelect).toBeFocused();
await expect(alwaysSelect).toHaveAttribute("aria-checked", "false");
await alwaysSelect.press("Enter");
await expect(menu).toBeHidden();
await expect(locate).toBeHidden();
await options.press("Enter");
await page.keyboard.press("ArrowDown");
await expect(appearance).toBeFocused();
await appearance.press("ArrowRight");
const rootPaths = page.getByRole("menuitemcheckbox", { name: "Show Root Paths", exact: true });
await expect(rootPaths).toBeInViewport({ ratio: 1 });
await page.keyboard.press("ArrowLeft");
await expect(rootPaths).toBeHidden();
await expect(appearance).toBeFocused();
await sort.click();
const type = page.getByRole("menuitemcheckbox", { name: "Type", exact: true });
await expect(type).toBeInViewport({ ratio: 1 });
await expect(page.getByRole("menuitemcheckbox", { name: "Sort Folders First", exact: true })).toBeVisible();
await type.click();
await options.press("Enter");
await sort.click();
await expect(type).toHaveAttribute("aria-checked", "true");
});
+4 -2
Переглянути файл
@@ -46,7 +46,8 @@ test("sorts collapsed workspace roots by project type, shows their icons and ref
.getByRole("region", { name: "Project", exact: true })
.getByRole("button", { name: "Options", exact: true })
.click();
await page.getByRole("menuitemcheckbox", { name: "Sort by Type", exact: true }).click();
await page.getByRole("menuitem", { name: "Sort By", exact: true }).hover();
await page.getByRole("menuitemcheckbox", { name: "Type", exact: true }).click();
await expect(tree.locator("[data-project-path]")).toHaveText([
"rust/work/rust",
"dart/work/dart",
@@ -185,7 +186,8 @@ test("keeps surviving workspace icons and type order during removal", async ({ w
const panel = page.getByRole("region", { name: "Project", exact: true });
await panel.getByRole("button", { name: "Collapse All", exact: true }).click();
await panel.getByRole("button", { name: "Options", exact: true }).click();
await page.getByRole("menuitemcheckbox", { name: "Sort by Type", exact: true }).click();
await page.getByRole("menuitem", { name: "Sort By", exact: true }).hover();
await page.getByRole("menuitemcheckbox", { name: "Type", exact: true }).click();
const rows = tree.locator('[data-project-path^="/work/"]');
await expect(rows).toHaveText(["z-rust/work/z-rust", "a-go/work/a-go", "b-web/work/b-web"]);
const before = await icons();
+9
Переглянути файл
@@ -20,6 +20,15 @@ run = "pnpm dev:app"
description = "Typecheck, bundle and verify the frontend"
run = "pnpm build"
[tasks."dogfood:build"]
description = "Build a local dogfood desktop app bundle"
run = "pnpm dogfood:build"
[tasks."dogfood:install"]
description = "Build and install the local dogfood desktop app"
depends = ["dogfood:build"]
run = "pnpm dogfood:install --no-build"
[tasks.test]
description = "Run the frontend and Rust workspace tests"
run = ["pnpm test", "cargo test --workspace"]
+3 -1
Переглянути файл
@@ -33,7 +33,9 @@
"perf": "node perf/run.ts",
"perf:rust": "node perf/rust.ts",
"eval": "node evals/run.ts",
"release:prepare": "node scripts/release-prepare.ts"
"release:prepare": "node scripts/release-prepare.ts",
"dogfood:build": "node scripts/dogfood.ts build",
"dogfood:install": "node scripts/dogfood.ts install"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
+135
Переглянути файл
@@ -0,0 +1,135 @@
// @vitest-environment node
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import {
DEFAULT_DOGFOOD_APP_NAME,
dogfoodBuildEnv,
dogfoodCliArgs,
dogfoodPaths,
dogfoodTauriConfig,
generateDogfoodIcons,
installDogfood,
parseDogfoodArgs,
} from "./dogfood.ts";
const root = fileURLToPath(new URL("..", import.meta.url));
describe("dogfood build and install", () => {
it("parses build and install arguments, including pnpm separator flags", () => {
expect(parseDogfoodArgs(["build"])).toEqual({ action: "build", skipBuild: false });
expect(parseDogfoodArgs(["install"])).toEqual({ action: "install", skipBuild: false });
expect(parseDogfoodArgs(["install", "--no-build"])).toEqual({ action: "install", skipBuild: true });
expect(parseDogfoodArgs(["install", "--", "--no-build"])).toEqual({ action: "install", skipBuild: true });
expect(() => parseDogfoodArgs([])).toThrow(/Expected 'build' or 'install'/);
expect(() => parseDogfoodArgs(["build", "--no-build"])).toThrow(/Unexpected option/);
});
it("keeps the vanilla app identifier so settings, MCP, Skills and agent sessions are shared, without updates", () => {
const baseConfig = JSON.parse(readFileSync(join(root, "src-tauri", "tauri.conf.json"), "utf8")) as {
identifier: string;
};
const override = dogfoodTauriConfig(DEFAULT_DOGFOOD_APP_NAME, ["../target/dogfood-icons/dogfood.icns"]);
expect(baseConfig.identifier).toBe("ai.l0ng.openidea");
expect("identifier" in override).toBe(false);
expect(override).toEqual({
productName: "openidea_dogfood",
bundle: {
createUpdaterArtifacts: false,
icon: ["../target/dogfood-icons/dogfood.icns"],
},
plugins: {
updater: { endpoints: [] },
},
});
});
it("uses fast release compilation defaults while respecting caller overrides", () => {
expect(dogfoodBuildEnv({})).toEqual({
CARGO_PROFILE_RELEASE_LTO: "off",
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16",
});
expect(dogfoodBuildEnv({ CARGO_PROFILE_RELEASE_LTO: "thin", CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "4" })).toEqual({
CARGO_PROFILE_RELEASE_LTO: "thin",
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "4",
});
});
it("resolves platform bundle arguments and install destinations", () => {
expect(dogfoodCliArgs("openidea_dogfood", ["icon.icns"], "darwin").slice(0, 3)).toEqual([
"build",
"--bundles",
"app",
]);
expect(dogfoodCliArgs("openidea_dogfood", ["icon.ico"], "win32").slice(0, 2)).toEqual(["build", "--no-bundle"]);
expect(dogfoodPaths(join("/repo", "target"), "openidea_dogfood", "darwin", {})).toEqual({
bundlePath: join("/repo", "target", "release", "bundle", "macos", "openidea_dogfood.app"),
installPath: join("/Applications", "openidea_dogfood.app"),
});
expect(
dogfoodPaths(join("/repo", "target"), "openidea_dogfood", "darwin", {
DOGFOOD_INSTALL_DIR: "/Users/me/Applications",
}),
).toEqual({
bundlePath: join("/repo", "target", "release", "bundle", "macos", "openidea_dogfood.app"),
installPath: join("/Users/me/Applications", "openidea_dogfood.app"),
});
});
it("keeps the dogfood source SVGs geometrically identical to the vanilla icons in grey", () => {
const sourceDir = join(root, "src-tauri", "icons", "source");
for (const [vanillaName, dogfoodName] of [
["openidea.svg", "openidea-dogfood.svg"],
["openidea-windows.svg", "openidea-dogfood-windows.svg"],
] as const) {
const vanilla = readFileSync(join(sourceDir, vanillaName), "utf8");
const dogfood = readFileSync(join(sourceDir, dogfoodName), "utf8");
expect(dogfood).not.toContain("#D9582C");
const recolored = vanilla
.replaceAll('aria-label="OpenIDEA"', 'aria-label="OpenIDEA Dogfood"')
.replaceAll("#EAE7E0", "#E6E7E9")
.replaceAll("#D9582C", "#787B82")
.replaceAll("#1B1A1A", "#1B1C1E");
expect(dogfood).toBe(recolored);
}
});
it("generates the dogfood icon bundle with a distinct macOS .icns name", () => {
const tempDir = mkdtempSync(join(tmpdir(), "openidea-dogfood-icons-"));
try {
const iconPaths = generateDogfoodIcons(root, tempDir, "darwin");
expect(iconPaths).toHaveLength(5);
expect(iconPaths.some((p) => p.endsWith("/dogfood.icns"))).toBe(true);
expect(existsSync(join(tempDir, "dogfood.icns"))).toBe(true);
expect(existsSync(join(tempDir, "[email protected]"))).toBe(true);
expect(existsSync(join(tempDir, "icon.ico"))).toBe(true);
const firstMtime = statSync(join(tempDir, "dogfood.icns")).mtimeMs;
expect(generateDogfoodIcons(root, tempDir, "darwin")).toEqual(iconPaths);
expect(statSync(join(tempDir, "dogfood.icns")).mtimeMs).toBe(firstMtime);
} finally {
rmSync(tempDir, { recursive: true, force: true });
}
}, 30_000);
it("installs a macOS .app bundle into DOGFOOD_INSTALL_DIR", () => {
if (process.platform !== "darwin") return;
const tempDir = mkdtempSync(join(tmpdir(), "openidea-dogfood-install-"));
const prevInstallDir = process.env.DOGFOOD_INSTALL_DIR;
try {
const fakeRoot = join(tempDir, "repo");
const fakeBundle = join(fakeRoot, "target", "release", "bundle", "macos", "openidea_dogfood.app");
mkdirSync(join(fakeBundle, "Contents", "MacOS"), { recursive: true });
writeFileSync(join(fakeBundle, "Contents", "MacOS", "openidea"), "#!/bin/sh\n");
const destDir = join(tempDir, "Applications");
process.env.DOGFOOD_INSTALL_DIR = destDir;
installDogfood(fakeRoot, "openidea_dogfood", "darwin", join(fakeRoot, "target"));
expect(existsSync(join(destDir, "openidea_dogfood.app", "Contents", "MacOS", "openidea"))).toBe(true);
} finally {
if (prevInstallDir === undefined) delete process.env.DOGFOOD_INSTALL_DIR;
else process.env.DOGFOOD_INSTALL_DIR = prevInstallDir;
rmSync(tempDir, { recursive: true, force: true });
}
});
});
+319
Переглянути файл
@@ -0,0 +1,319 @@
import { spawnSync } from "node:child_process";
import { createHash } from "node:crypto";
import {
chmodSync,
copyFileSync,
existsSync,
mkdirSync,
mkdtempSync,
readFileSync,
realpathSync,
rmSync,
utimesSync,
writeFileSync,
} from "node:fs";
import { createRequire } from "node:module";
import { homedir } from "node:os";
import { dirname, join, relative } from "node:path";
import { fileURLToPath } from "node:url";
export const DEFAULT_DOGFOOD_APP_NAME = "openidea_dogfood";
const LSREGISTER_PATH =
"/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";
export interface DogfoodCommand {
action: "build" | "install";
skipBuild: boolean;
}
export interface DogfoodPaths {
bundlePath: string;
installPath: string;
}
export function parseDogfoodArgs(args: readonly string[]): DogfoodCommand {
const filtered = args.filter((arg) => arg !== "--");
const action = filtered[0];
if (action !== "build" && action !== "install") {
throw new Error(`Expected 'build' or 'install', got ${action ? `'${action}'` : "no command"}`);
}
let skipBuild = false;
for (const flag of filtered.slice(1)) {
if (action === "install" && flag === "--no-build") {
skipBuild = true;
} else {
throw new Error(`Unexpected option '${flag}' for '${action}'`);
}
}
return { action, skipBuild };
}
/**
* Tauri config override for local dogfood builds.
*
* Keeps `identifier` untouched (`ai.l0ng.openidea` from `src-tauri/tauri.conf.json`) so the
* dogfood app shares configuration, settings, WebView storage, MCP servers, Skills, agent
* sessions, credentials, plugins and caches with the vanilla release app.
*
* Clears the updater endpoints: the next release would otherwise replace the dogfood bundle
* with the official app.
*/
export function dogfoodTauriConfig(appName: string, iconPaths: readonly string[]) {
return {
productName: appName,
bundle: {
createUpdaterArtifacts: false,
icon: [...iconPaths],
},
plugins: {
updater: { endpoints: [] },
},
};
}
export function dogfoodBuildEnv(baseEnv: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
return {
...baseEnv,
CARGO_PROFILE_RELEASE_LTO: baseEnv.CARGO_PROFILE_RELEASE_LTO ?? "off",
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: baseEnv.CARGO_PROFILE_RELEASE_CODEGEN_UNITS ?? "16",
};
}
export function dogfoodCliArgs(
appName: string,
iconPaths: readonly string[],
platform: NodeJS.Platform = process.platform,
): string[] {
const config = JSON.stringify(dogfoodTauriConfig(appName, iconPaths));
if (platform === "darwin") {
return ["build", "--bundles", "app", "--config", config];
}
return ["build", "--no-bundle", "--config", config];
}
/** Cargo's target directory, which a `CARGO_TARGET_DIR` or `build.target-dir` setting can move. */
export function cargoTargetDir(root: string): string {
const result = spawnSync("cargo", ["metadata", "--format-version", "1", "--no-deps"], {
cwd: root,
encoding: "utf8",
maxBuffer: 64 * 1024 * 1024,
});
if (result.status === 0) {
try {
const dir = (JSON.parse(result.stdout) as { target_directory?: unknown }).target_directory;
if (typeof dir === "string" && dir) return dir;
} catch {
// Fall back to the default below.
}
}
return join(root, "target");
}
export function dogfoodPaths(
targetDir: string,
appName: string,
platform: NodeJS.Platform = process.platform,
env: NodeJS.ProcessEnv = process.env,
): DogfoodPaths {
const customInstallPath = env.DOGFOOD_INSTALL_PATH?.trim();
const customInstallDir = env.DOGFOOD_INSTALL_DIR?.trim();
if (platform === "darwin") {
return {
bundlePath: join(targetDir, "release", "bundle", "macos", `${appName}.app`),
installPath: customInstallPath || join(customInstallDir || "/Applications", `${appName}.app`),
};
}
if (platform === "win32") {
const localAppData = env.LOCALAPPDATA?.trim() || join(homedir(), "AppData", "Local");
return {
bundlePath: join(targetDir, "release", "openidea.exe"),
installPath: customInstallPath || join(customInstallDir || localAppData, appName),
};
}
return {
bundlePath: join(targetDir, "release", "openidea"),
installPath: customInstallPath || join(customInstallDir || join(homedir(), ".local", "bin"), appName),
};
}
function toPosixPath(value: string): string {
return value.replaceAll("\\", "/");
}
function runTauriIcon(root: string, cli: string, svgPath: string, outputDir: string) {
const result = spawnSync(process.execPath, [cli, "icon", svgPath, "--output", outputDir], {
cwd: root,
stdio: "inherit",
});
if (result.error) throw result.error;
if (result.status !== 0) throw new Error(`Dogfood icon generation failed (${result.status})`);
}
export function generateDogfoodIcons(
root: string,
outputDir: string,
platform: NodeJS.Platform = process.platform,
): string[] {
const sourceDir = join(root, "src-tauri", "icons", "source");
const svgPath = join(sourceDir, "openidea-dogfood.svg");
const winSvgPath = join(sourceDir, "openidea-dogfood-windows.svg");
const iconFiles = ["32x32.png", "128x128.png", "[email protected]", "dogfood.icns", "icon.ico"];
const stampPath = join(outputDir, ".source-sha256");
const stamp = createHash("sha256")
.update(platform)
.update("\0")
.update(readFileSync(svgPath))
.update("\0")
.update(readFileSync(winSvgPath))
.digest("hex");
// Preserve file mtimes/bytes when SVGs are unchanged so `tauri-build` does not re-link `src-tauri`.
const upToDate =
existsSync(stampPath) &&
readFileSync(stampPath, "utf8").trim() === stamp &&
iconFiles.every((file) => existsSync(join(outputDir, file)));
if (!upToDate) {
const require = createRequire(import.meta.url);
const cli = require.resolve("@tauri-apps/cli/tauri.js");
mkdirSync(outputDir, { recursive: true });
runTauriIcon(root, cli, svgPath, outputDir);
if (platform === "win32") {
const winTemp = mkdtempSync(join(outputDir, "win-"));
try {
runTauriIcon(root, cli, winSvgPath, winTemp);
copyFileSync(join(winTemp, "icon.ico"), join(outputDir, "icon.ico"));
} finally {
rmSync(winTemp, { recursive: true, force: true });
}
}
// Distinct .icns filename avoids macOS LaunchServices icon-cache collisions with OpenIDEA.app.
copyFileSync(join(outputDir, "icon.icns"), join(outputDir, "dogfood.icns"));
writeFileSync(stampPath, `${stamp}\n`);
}
const tauriDir = join(root, "src-tauri");
return iconFiles.map((file) => toPosixPath(relative(tauriDir, join(outputDir, file))));
}
function runChecked(command: string, args: string[], options?: { cwd?: string; env?: NodeJS.ProcessEnv }) {
const result = spawnSync(command, args, { stdio: "inherit", ...options });
if (result.error) throw result.error;
if (result.status !== 0) throw new Error(`${command} exited with status ${result.status}`);
}
export function buildDogfood(root: string, appName: string) {
const iconsDir = join(root, "target", "dogfood-icons");
const iconPaths = generateDogfoodIcons(root, iconsDir);
const args = dogfoodCliArgs(appName, iconPaths);
runChecked(process.execPath, [join(root, "scripts", "tauri.ts"), ...args], {
cwd: root,
env: dogfoodBuildEnv(),
});
}
const SHARED_DATA_NOTES = [
"The dogfood app shares its single instance with OpenIDEA: quit one before opening the other.",
"It writes OpenIDEA's settings and data; a setting only newer builds know can make an older OpenIDEA ignore your settings file.",
"It never updates itself: run 'pnpm dogfood:install' again to pick up new changes.",
];
export function installDogfood(
root: string,
appName: string,
platform: NodeJS.Platform = process.platform,
targetDir: string = cargoTargetDir(root),
) {
const { bundlePath, installPath } = dogfoodPaths(targetDir, appName, platform);
installBundle(root, appName, platform, bundlePath, installPath);
for (const note of SHARED_DATA_NOTES) console.log(note);
}
function installBundle(
root: string,
appName: string,
platform: NodeJS.Platform,
bundlePath: string,
installPath: string,
) {
if (!existsSync(bundlePath)) {
throw new Error(`Dogfood build output not found at ${bundlePath}; run 'mise run dogfood:build' first`);
}
if (platform === "darwin") {
rmSync(installPath, { recursive: true, force: true });
mkdirSync(dirname(installPath), { recursive: true });
runChecked("cp", ["-R", bundlePath, installPath]);
runChecked("xattr", ["-cr", installPath]);
const now = new Date();
utimesSync(installPath, now, now);
if (existsSync(LSREGISTER_PATH)) {
spawnSync(LSREGISTER_PATH, ["-f", installPath], { stdio: "ignore" });
}
console.log(`Installed ${appName} to ${installPath}`);
return;
}
if (platform === "win32") {
mkdirSync(installPath, { recursive: true });
const targetExe = join(installPath, `${appName}.exe`);
copyFileSync(bundlePath, targetExe);
const webviewLoader = join(dirname(bundlePath), "WebView2Loader.dll");
if (existsSync(webviewLoader)) {
copyFileSync(webviewLoader, join(installPath, "WebView2Loader.dll"));
}
console.log(`Installed ${appName} to ${targetExe}`);
return;
}
mkdirSync(dirname(installPath), { recursive: true });
copyFileSync(bundlePath, installPath);
chmodSync(installPath, 0o755);
const dataHome = process.env.XDG_DATA_HOME?.trim() || join(homedir(), ".local", "share");
const iconSource = join(root, "target", "dogfood-icons", "128x128.png");
if (existsSync(iconSource)) {
const iconDest = join(dataHome, "icons", "hicolor", "128x128", "apps", `${appName}.png`);
mkdirSync(dirname(iconDest), { recursive: true });
copyFileSync(iconSource, iconDest);
}
const desktopFile = join(dataHome, "applications", `${appName}.desktop`);
mkdirSync(dirname(desktopFile), { recursive: true });
writeFileSync(
desktopFile,
[
"[Desktop Entry]",
"Type=Application",
`Name=${appName}`,
`Exec=${installPath} %F`,
`Icon=${appName}`,
"Categories=Development;IDE;",
"StartupWMClass=openidea",
"",
].join("\n"),
);
console.log(`Installed ${appName} to ${installPath}`);
}
function main() {
const root = realpathSync(fileURLToPath(new URL("..", import.meta.url)));
const { action, skipBuild } = parseDogfoodArgs(process.argv.slice(2));
const appName = process.env.DOGFOOD_APP_NAME?.trim() || DEFAULT_DOGFOOD_APP_NAME;
if (action === "build" || !skipBuild) {
buildDogfood(root, appName);
}
if (action === "install") {
installDogfood(root, appName);
}
}
if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
try {
main();
} catch (error) {
console.error(error instanceof Error ? error.message : error);
process.exitCode = 1;
}
}
+14
Переглянути файл
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 100 100" role="img" aria-label="OpenIDEA Dogfood">
<rect x="2" y="2" width="96" height="96" rx="22" fill="#E6E7E9"/>
<g transform="translate(50 50) scale(1.5) translate(-50 -52)">
<rect x="22" y="26" width="56" height="52" rx="12" fill="#787B82"/>
<rect x="27" y="26" width="46" height="42" rx="9" fill="#1B1C1E"/>
<g transform="translate(50 46) scale(1.35) translate(-50 -46)">
<circle cx="44" cy="47.4" r="4.1" fill="none" stroke="#E6E7E9" stroke-width="2.7"/>
<rect x="54.3" y="42" width="2.8" height="10.5" fill="#E6E7E9"/>
<rect x="51.2" y="42" width="5.9" height="2.5" fill="#E6E7E9"/>
<rect x="51.2" y="50" width="9.4" height="2.5" fill="#E6E7E9"/>
<circle cx="55.7" cy="38.4" r="1.8" fill="#E6E7E9"/>
</g>
</g>
</svg>

Після

Ширина:  |  Висота:  |  Розмір: 858 B

+1
Переглянути файл
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 100 100" role="img" aria-label="OpenIDEA Dogfood"><rect x="10" y="10" width="80" height="80" rx="18" fill="#E6E7E9"/><g transform="translate(50 50) scale(1.25) translate(-50 -52)"><rect x="22" y="26" width="56" height="52" rx="12" fill="#787B82"/><rect x="27" y="26" width="46" height="42" rx="9" fill="#1B1C1E"/><circle cx="44" cy="47.4" r="4.1" fill="none" stroke="#E6E7E9" stroke-width="2.7"/><rect x="54.3" y="42" width="2.8" height="10.5" fill="#E6E7E9"/><rect x="51.2" y="42" width="5.9" height="2.5" fill="#E6E7E9"/><rect x="51.2" y="50" width="9.4" height="2.5" fill="#E6E7E9"/><circle cx="55.7" cy="38.4" r="1.8" fill="#E6E7E9"/></g></svg>

Після

Ширина:  |  Висота:  |  Розмір: 729 B

+35
Переглянути файл
@@ -7,6 +7,7 @@ import {
enterInBlockComment,
enterInDocComment,
enterInDocstring,
cDocTags,
javaDocTags,
jsDocTags,
phpDocTags,
@@ -20,6 +21,8 @@ const slashStar = EditorState.languageData.of(() => [
{ commentTokens: { line: "//", block: { open: "/*", close: "*/" } } },
]);
const hash = EditorState.languageData.of(() => [{ commentTokens: { line: "#" } }]);
/** What Lezer PHP reports right after `<?php\n/**`: the HTML around it. */
const html = EditorState.languageData.of(() => [{ commentTokens: { block: { open: "<!--", close: "-->" } } }]);
/** `|` marks the caret. */
function enter(text: string, language = "php", tokens = slashStar) {
@@ -102,6 +105,38 @@ function enterBlock(text: string) {
return { handled, text: s.doc.sliceString(0, caret) + "|" + s.doc.sliceString(caret) };
}
describe("Enter after /** in PHP files and C / C++", () => {
it("closes the stub in a PHP file where the parser reports HTML comments", () => {
const r = enter("<?php\n/**|\nfunction add(int $a, int $b): int { return $a + $b; }", "php", html);
expect(r.text).toBe(
"<?php\n/**\n * |\n * @param int $a\n * @param int $b\n * @return int\n */\nfunction add(int $a, int $b): int { return $a + $b; }",
);
});
it("lists a C or C++ function's parameters and return value", () => {
expect(enter("<p>/**|</p>", "html", html).handled).toBe(false);
expect(enter("/**|\nint add(int a, int b) { return a + b; }", "c").text).toBe(
"/**\n * |\n * @param a\n * @param b\n * @return\n */\nint add(int a, int b) { return a + b; }",
);
expect(cDocTags("static const char *name(const struct S *s, size_t n[]);")).toEqual([
"@param s",
"@param n",
"@return",
]);
expect(cDocTags("void run(void) {}")).toEqual([]);
expect(cDocTags("void *alloc(size_t size, int flags = 0) {}")).toEqual(["@param size", "@param flags", "@return"]);
expect(cDocTags("template <typename T> std::vector<T> Box<T>::take(const T &x, ...) const {")).toEqual([
"@param x",
"@return",
]);
expect(cDocTags("explicit Widget(int w) : w_(w) {}")).toEqual(["@param w"]);
expect(cDocTags("Widget(int w) {}")).toEqual(["@param w"]);
expect(cDocTags("struct S { int a; };")).toEqual([]);
expect(cDocTags("return add(a, b);")).toEqual([]);
expect(cDocTags('printf("%d", x);')).toEqual([]);
});
});
describe("Enter in a /* */ comment", () => {
it("starts the new line with a leading asterisk aligned under the comment's", () => {
expect(enterBlock("/**\n * xxxx|\n **/\nclass A {}").text).toBe("/**\n * xxxx\n * |\n **/\nclass A {}");
+55 -3
Переглянути файл
@@ -78,6 +78,45 @@ function javaDeclaration(text: string): string {
}
}
const C_SPECIFIERS =
/^(static|inline|extern|virtual|explicit|constexpr|consteval|friend|const|volatile|unsigned|signed|long|short|struct|enum|union|\[\[[^\]]*\]\])\s+/;
/**
* Doxygen tags for the C / C++ function declared at the start of `text`: `@param` per named
* parameter (default values and arrays dropped, `void` and `...` skipped) and `@return` unless it
* returns `void` or is a constructor / destructor. A type, a call or a statement gets none.
*/
export function cDocTags(text: string): string[] {
let s = text.trimStart();
if (/^template\s*</.test(s)) {
const end = closing(s, s.indexOf("<"));
if (end < 0) return [];
s = s.slice(end).trimStart();
}
for (let m = C_SPECIFIERS.exec(s); m; m = C_SPECIFIERS.exec(s)) s = s.slice(m[0].length);
const open = s.indexOf("(");
if (open < 0) return [];
const head = s.slice(0, open).trim();
// `Type name`, `Type *name`, `Type Class::name`, or a lone `Name` / `~Name` for constructors.
const m = /^(?:([\w:<>,\s*&]+?)\s*([*&]+\s*|\s+))?((?:[\w:]*(?:<[^()]*>)?::)?~?\w+)$/.exec(head);
const statement = /^(return|if|while|for|switch|sizeof|case|else|do|new|delete|throw|goto)$/;
if (!m || statement.test(m[3]!) || statement.test((m[1] ?? "").trim().split(/\s+/)[0]!)) return [];
const end = closing(s, open);
if (end < 0 || !/^\s*(const\s*)?(noexcept\s*)?(override\s*)?(->\s*[^{;]+)?(:[^{;]*)?\s*(\{|;|$)/.test(s.slice(end)))
return [];
const params = splitTopLevel(s.slice(open + 1, end - 1), true).flatMap((p) => {
const t = p.replace(/=.*$/s, "").trim();
if (!t || t === "void" || t === "...") return [];
// A parameter without a name (`int`) has nothing to document.
const name = /(\w+)\s*(\[[^\]]*\]\s*)*$/.exec(t)?.[1];
return name && /[\s*&]/.test(t) ? [name] : [];
});
const tags = params.map((n) => `@param ${n}`);
const returnType = (m[1] ?? "").trim();
if (returnType && !(returnType === "void" && !(m[2] ?? "").includes("*"))) tags.push("@return");
return tags;
}
/** Type parameter names of `<T extends A, U>`. */
function typeParams(list: string): string[] {
return splitTopLevel(list.slice(1, -1), true).flatMap((p) => /^\s*(\w+)/.exec(p)?.[1] ?? []);
@@ -254,6 +293,16 @@ export const enterInDocstring: Command = (view) => {
return true;
};
/**
* Whether the comments at `pos` include `/* *\/` ones. Embedded languages list several comment
* styles there (PHP after HTML's `<!-- -->`), so every entry counts, not only the first.
*/
function hasCBlockComments(state: EditorState, pos: number): boolean {
return state
.languageDataAt<{ block?: { open: string; close: string } }>("commentTokens", pos)
.some((t) => t.block?.open === "/*" && t.block.close === "*/");
}
/** The Enter command for documents of `language` (stub tags in PHP). */
export function enterInDocComment(language: string | undefined): Command {
return (view) => {
@@ -261,8 +310,9 @@ export function enterInDocComment(language: string | undefined): Command {
if (state.readOnly || state.selection.ranges.length !== 1) return false;
const r = state.selection.main;
if (!r.empty) return false;
const block = state.languageDataAt<{ block?: { open: string; close: string } }>("commentTokens", r.head)[0]?.block;
if (block?.open !== "/*" || block.close !== "*/") return false;
// Lezer PHP leaves `<?php` + an unclosed `/**` to the HTML around it, whose comments are
// `<!-- -->`; PHP code always takes `/* */`.
if (language !== "php" && !hasCBlockComments(state, r.head)) return false;
const line = state.doc.lineAt(r.head);
const before = line.text.slice(0, r.head - line.from);
if (before.trim() !== "/**" || line.text.slice(r.head - line.from).trim()) return false;
@@ -280,7 +330,9 @@ export function enterInDocComment(language: string | undefined): Command {
? javaDocTags(code)
: /^(java|type)script(react)?$/.test(language ?? "")
? jsDocTags(code)
: [];
: /^(c|cpp|objective-c|objective-cpp)$/.test(language ?? "")
? cDocTags(code)
: [];
const summary = `${br}${indent} * `;
const insert = summary + tags.map((t) => `${br}${indent} * ${t}`).join("") + `${br}${indent} */`;
view.dispatch(
+19
Переглянути файл
@@ -352,8 +352,27 @@ describe("smart angle brackets", () => {
const KOTLIN = StreamLanguage.define(interpolationParser(kotlin, "Kotlin"));
const CSHARP = StreamLanguage.define(interpolationParser(csharp, "C#"));
let RUST: LanguageSupport;
let CPP: LanguageSupport;
beforeAll(async () => {
RUST = (await cmLanguages.find((l) => l.name === "Rust")!.load()) as LanguageSupport;
CPP = (await cmLanguages.find((l) => l.name === "C++")!.load()) as LanguageSupport;
});
it("pairs include brackets in C and C++, and template arguments in C++", () => {
pair("c", CPP, "#include |", "#include <|>");
pair("cpp", CPP, "#include |", "#include <|>");
pair("cpp", CPP, "std::vector|", "std::vector<|>");
pair("cpp", CPP, "auto p = std::make_unique|", "auto p = std::make_unique<|>");
pair("cpp", CPP, "auto n = static_cast|", "auto n = static_cast<|>");
pair("cpp", CPP, "template |", "template <|>");
pair("cpp", CPP, "Box|", "Box<|>");
});
it("does not pair comparisons, shifts or macros in C and C++", () => {
pair("c", CPP, "int f() { return a |", "int f() { return a <|");
pair("cpp", CPP, "for (int i = 0; i|", "for (int i = 0; i<|");
pair("cpp", CPP, "std::cout |", "std::cout <|");
pair("cpp", CPP, "if (x < MAX|", "if (x < MAX<|");
});
it("pairs after a type name in Java: fields, type arguments and class declarations", () => {
+87 -1
Переглянути файл
@@ -273,13 +273,16 @@ function wordBefore(state: EditorState, pos: number): string {
}
/** The caret is inside a literal: never pair there, whatever the language rule says. */
/** C++ template syntax, not a template literal. */
const CPP_TEMPLATE_NODE = /^Template(Function|Type|Method|ArgumentList|ParameterList|Declaration|Instantiation)$/;
function inLiteral(state: EditorState, pos: number): boolean {
for (
let n: ReturnType<ReturnType<typeof syntaxTree>["resolveInner"]> | null = syntaxTree(state).resolveInner(pos, -1);
n;
n = n.parent
)
if (/string|comment|template|rune/i.test(n.name)) return true;
if (/string|comment|template|rune/i.test(n.name) && !CPP_TEMPLATE_NODE.test(n.name)) return true;
return false;
}
@@ -360,6 +363,85 @@ function cLikeTypePosition(state: EditorState, pos: number): boolean {
);
}
/** Standard C++ templates (and casts) written against their `<`. */
const CPP_TEMPLATES = new Set([
"vector",
"array",
"deque",
"list",
"forward_list",
"map",
"multimap",
"set",
"multiset",
"unordered_map",
"unordered_multimap",
"unordered_set",
"unordered_multiset",
"stack",
"queue",
"priority_queue",
"pair",
"tuple",
"optional",
"variant",
"any",
"function",
"span",
"basic_string",
"unique_ptr",
"shared_ptr",
"weak_ptr",
"make_unique",
"make_shared",
"atomic",
"future",
"promise",
"initializer_list",
"numeric_limits",
"is_same",
"enable_if",
"conditional",
"decay",
"remove_reference",
"static_cast",
"dynamic_cast",
"const_cast",
"reinterpret_cast",
"duration_cast",
"get",
"hash",
"less",
"greater",
"allocator",
"reference_wrapper",
"string_view",
"bitset",
"complex",
"valarray",
]);
/** `#include <` in C and C++. */
function includePosition(state: EditorState, pos: number): boolean {
const line = state.doc.lineAt(pos);
return /^\s*#\s*(include|include_next|import)\s*$/.test(line.text.slice(0, pos - line.from));
}
/**
* C++: `#include <`, `template <`, and a template name written against its `<`: a standard one
* (`std::vector<`, `static_cast<`) or a capitalized one (`Box<`), never a value (`a < b`, `i<n`)
* or an all-caps macro.
*/
function cppTypePosition(state: EditorState, pos: number): boolean {
if (includePosition(state, pos)) return true;
const line = state.doc.lineAt(pos);
const before = line.text.slice(0, pos - line.from);
if (/\btemplate\s*$/.test(before)) return true;
const name = /(?:^|[^\w])(\w+)$/.exec(before)?.[1];
if (!name || /\boperator$/.test(before)) return false;
return CPP_TEMPLATES.has(name) || (/^[A-Z]/.test(name) && /[a-z]/.test(name));
}
const ANGLE_PAIR_RULES: Record<string, (state: EditorState, pos: number) => boolean> = {
java: javaTypePosition,
typescript: tsTypePosition,
@@ -367,6 +449,10 @@ const ANGLE_PAIR_RULES: Record<string, (state: EditorState, pos: number) => bool
kotlin: cLikeTypePosition,
csharp: cLikeTypePosition,
rust: rustTypePosition,
c: includePosition,
cpp: cppTypePosition,
"objective-c": includePosition,
"objective-cpp": cppTypePosition,
};
/** The `<>` pairs the smart angle brackets inserted; `>` steps over their closing half. */
+4 -16
Переглянути файл
@@ -227,16 +227,14 @@
}
.find {
display: grid;
grid-template-columns: [mode] auto [field] minmax(0, 420px) [actions] fit-content(50%) [close] minmax(
min-content,
1fr
);
grid-template-columns: [mode] auto [field] minmax(0, max(240px, 33%)) [actions] fit-content(50%) minmax(0, 1fr);
align-items: start;
row-gap: var(--space-1);
padding: var(--space-1-5) var(--space-2);
}
.findExpand {
grid-area: 1 / mode;
margin-block-start: var(--space-1);
margin-inline-end: var(--space-1);
}
.findField {
@@ -249,15 +247,6 @@
.replaceField {
min-width: 0;
}
.findClose {
grid-area: 1 / close;
justify-self: end;
margin-inline-start: var(--space-1);
}
.findExpand,
.findClose {
margin-block-start: var(--space-1);
}
.findButtons,
.replaceButtons {
display: flex;
@@ -289,7 +278,7 @@
@container editor-find (width < 500px) {
.find {
grid-template-columns: [mode] auto [field] minmax(0, 1fr) [close] auto;
grid-template-columns: [mode] auto [field] minmax(0, 1fr);
}
.findButtons,
.replaceButtons {
@@ -321,8 +310,7 @@
.replaceButtons {
grid-column: mode / -1;
}
.findExpand,
.findClose {
.findExpand {
grid-row: 2;
margin-block-start: 0;
}
+1 -1
Переглянути файл
@@ -710,8 +710,8 @@ export function FindPanel({ target, version, replace, seq, onReplaceShown, onClo
onClick={() => setFilterMenu(true)}
/>
<IconButton ref={moreRef} icon="more" title="More" size="small" onClick={() => setMoreMenu(true)} />
<IconButton icon="close" title="Close" shortcut="⎋" size="small" onClick={close} />
</div>
<IconButton icon="close" title="Close" shortcut="⎋" size="small" className={styles.findClose} onClick={close} />
{replace && (
<>
<div ref={replaceBoxRef} className={styles.replaceField}>
+3 -1
Переглянути файл
@@ -410,9 +410,11 @@ describe("Refactor menu actions", () => {
});
describe("requested code action kind", () => {
it("asks typescript-language-server for all refactorings, other servers for the kind", () => {
it("asks typescript-language-server and clangd for all refactorings, other servers for the kind", () => {
expect(requestKind("refactor.extract", "typescript")).toBe("refactor");
expect(requestKind("refactor.extract", "javascriptreact")).toBe("refactor");
expect(requestKind("refactor.extract", "c")).toBe("refactor");
expect(requestKind("refactor.extract", "cpp")).toBe("refactor");
expect(requestKind("refactor.extract", "java")).toBe("refactor.extract");
expect(requestKind("source.organizeImports", "typescript")).toBe("source.organizeImports");
});
+14 -2
Переглянути файл
@@ -62,8 +62,20 @@ async function askServer(view: EditorView, signal?: AbortSignal, only?: string[]
}
}
/** typescript-language-server returns refactorings only when `only` names `refactor` itself. */
const WHOLE_REFACTOR_KIND = new Set(["javascript", "javascriptreact", "typescript", "typescriptreact"]);
/**
* Servers that return refactorings only when `only` names `refactor` itself: typescript-language-server,
* and clangd, whose tweaks are all of kind `refactor`.
*/
const WHOLE_REFACTOR_KIND = new Set([
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"c",
"cpp",
"objective-c",
"objective-cpp",
]);
/** The code action kind to ask `language`'s server for, to get the refactorings of `kind`. */
export function requestKind(kind: string, language: string): string {
+41 -27
Переглянути файл
@@ -39,14 +39,18 @@ export type ToggleOption = {
[K in keyof ViewOptions]-?: ViewOptions[K] extends boolean ? K : never;
}[keyof ViewOptions];
export const OPTION_LABELS: Array<[ToggleOption, string]> = [
const APPEARANCE_OPTIONS: Array<[ToggleOption, string]> = [
["showHidden", "Show Hidden Files"],
["showExcluded", "Show Excluded Files"],
["showMembers", "Show Members"],
["showRootPaths", "Show Root Paths"],
["horizontalScroll", "Horizontal Scrolling"],
["compact", "Compact Middle Packages"],
["foldersFirst", "Sort Folders First"],
];
const FOLDERS_FIRST: [ToggleOption, string] = ["foldersFirst", "Sort Folders First"];
const BEHAVIOR_OPTIONS: Array<[ToggleOption, string]> = [
["autoscrollFromSource", "Always Select Opened File"],
["autoscrollToSource", "Autoscroll to Source"],
["singleClickOpen", "Open Files with Single Click"],
@@ -54,8 +58,7 @@ export const OPTION_LABELS: Array<[ToggleOption, string]> = [
["previewTab", "Enable Preview Tab"],
];
/** The first entries of OPTION_LABELS are Appearance options, the rest Behavior. */
const APPEARANCE_OPTIONS = 7;
export const OPTION_LABELS = [...APPEARANCE_OPTIONS, FOLDERS_FIRST, ...BEHAVIOR_OPTIONS];
/** Header controls of the Project tool window (IDEA: Locate, Expand/Collapse All). */
export function ProjectHeaderActions() {
@@ -78,35 +81,46 @@ export function ProjectHeaderActions() {
);
}
export const SORT_LABELS: Array<[SortKey, string]> = [
["name", "Sort by Name"],
["type", "Sort by Type"],
["modified", "Sort by Modification Time"],
export const SORT_LABELS: Array<[key: SortKey, actionLabel: string, menuLabel: string]> = [
["name", "Sort by Name", "Name"],
["type", "Sort by Type", "Type"],
["modified", "Sort by Modification Time", "Modification Time"],
];
/** View options in the header's "⋮" menu (IDEA: Project › Options › Appearance / Behavior). */
/** Project view options in the header's "⋮" menu. */
export function useProjectHeaderMenu(): MenuItem[] {
const options = useProjectTree((s) => s.options);
const unity = useProjectTree((s) => s.mode === "unity");
return [
{ kind: "header", label: "Appearance" },
...(unity
? [
option("showUnityMeta", "Show Meta Files", options),
option("showUnityGenerated", "Show Generated Files", options),
]
: []),
...OPTION_LABELS.slice(0, APPEARANCE_OPTIONS).map(([key, label]) => option(key, label, options)),
{ kind: "separator" },
...SORT_LABELS.map(([sortBy, label]): MenuItem => ({
id: `sort.${sortBy}`,
label,
checked: options.sortBy === sortBy,
run: () => setViewOption("sortBy", sortBy),
})),
{ kind: "separator" },
{ kind: "header", label: "Behavior" },
...OPTION_LABELS.slice(APPEARANCE_OPTIONS).map(([key, label]) => option(key, label, options)),
{
label: "Behavior",
submenu: BEHAVIOR_OPTIONS.map(([key, label]) => option(key, label, options)),
},
{
label: "Appearance",
submenu: [
...(unity
? [
option("showUnityMeta", "Show Meta Files", options),
option("showUnityGenerated", "Show Generated Files", options),
]
: []),
...APPEARANCE_OPTIONS.map(([key, label]) => option(key, label, options)),
],
},
{
label: "Sort By",
submenu: [
...SORT_LABELS.map(([sortBy, , label]): MenuItem => ({
id: `sort.${sortBy}`,
label,
checked: options.sortBy === sortBy,
run: () => setViewOption("sortBy", sortBy),
})),
{ kind: "separator" },
option(...FOLDERS_FIRST, options),
],
},
];
}
+16
Переглянути файл
@@ -118,6 +118,22 @@
.sourceLabels .labelFile {
font-size: var(--fs-small);
}
.labelFile.revisionPath {
display: inline-flex;
color: var(--fg-muted);
font-size: var(--fs-ui);
}
.revisionDirectory,
.revisionFilename {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.revisionFilename {
/* Let the directory shrink first, then elide the filename if it still exceeds the path's width. */
flex: none;
max-width: 100%;
}
.badge {
padding: 0 5px;
border-radius: var(--radius-small);
+25 -8
Переглянути файл
@@ -111,6 +111,23 @@ import styles from "./DiffEditor.module.css";
/** Commands of the focused diff viewer (diff.* actions, vcs.nextChange / prevChange). */
export { focusedDiffNavigator, type DiffNavigator };
interface PaneTitle {
label: string;
detail?: string;
revisionPath?: string;
}
function PaneTitleDetail({ detail, revisionPath }: PaneTitle) {
if (!revisionPath) return detail ? <span className={styles.labelFile}>{detail}</span> : null;
const filenameStart = revisionPath.lastIndexOf("/") + 1;
return (
<span className={clsx(styles.labelFile, styles.revisionPath)}>
{filenameStart > 0 && <span className={styles.revisionDirectory}>{revisionPath.slice(0, filenameStart)}</span>}
<span className={styles.revisionFilename}>{revisionPath.slice(filenameStart)}</span>
</span>
);
}
interface Views {
/** The right / unified editor (chunks live here). */
b: EditorView;
@@ -1371,7 +1388,7 @@ export function DiffEditor({
const canStage = editableB && isWorktree(right) && left.type === "rev" && !!useVcs.getState().root;
const hasSource = !!source;
const paneTitle = (s: DiffSide): { label: string; detail?: string } => {
const paneTitle = (s: DiffSide): PaneTitle => {
if (s.type === "worktree" || s.type === "text") return { label: sideLabel(s), detail: s.labelDetail };
if (s.type !== "rev") return { label: sideLabel(s) };
const file = s.path ?? path;
@@ -1379,13 +1396,13 @@ export function DiffEditor({
const commit = !s.label && s.rev === "HEAD" && root ? heads[root]?.headCommit : null;
return {
label: commit ? commit.slice(0, 8) : sideLabel(s),
detail: root && file.startsWith(`${root}/`) ? file.slice(root.length + 1) : file,
revisionPath: root && file.startsWith(`${root}/`) ? file.slice(root.length + 1) : file,
};
};
const titleA = paneTitle(left);
const titleB = paneTitle(right);
const captionA = [titleA.label, titleA.detail].filter(Boolean).join(" ");
const captionB = [titleB.label, titleB.detail].filter(Boolean).join(" ");
const captionA = [titleA.label, titleA.revisionPath ?? titleA.detail].filter(Boolean).join(" ");
const captionB = [titleB.label, titleB.revisionPath ?? titleB.detail].filter(Boolean).join(" ");
const sourceLabels = "labelDetail" in left || "labelDetail" in right;
const labels = clsx(styles.labels, sourceLabels && styles.sourceLabels);
@@ -1591,7 +1608,7 @@ export function DiffEditor({
<div className={labels}>
<span className={styles.label} title={captionA}>
<span className={styles.labelText}>{titleA.label}</span>
{titleA.detail && <span className={styles.labelFile}>{titleA.detail}</span>}
<PaneTitleDetail {...titleA} />
{eolDiffers && eolA && <span className={styles.badge}>{badgeA}</span>}
{editableA && (
<span className={styles.badge}>
@@ -1601,7 +1618,7 @@ export function DiffEditor({
</span>
<span className={styles.label} title={captionB}>
<span className={styles.labelText}>{titleB.label}</span>
{titleB.detail && <span className={styles.labelFile}>{titleB.detail}</span>}
<PaneTitleDetail {...titleB} />
{eolDiffers && eolB && <span className={styles.badge}>{badgeB}</span>}
{editableB && (
<span className={styles.badge}>{left.type === "rev" ? tx("working copy") : tx("editable")}</span>
@@ -1612,10 +1629,10 @@ export function DiffEditor({
<div className={labels}>
<span className={styles.label} title={sourceLabels ? `${captionA} → ${captionB}` : undefined}>
<span className={styles.labelText}>{sideLabel(left)}</span>
{sourceLabels && titleA.detail && <span className={styles.labelFile}>{titleA.detail}</span>}
{sourceLabels && <PaneTitleDetail {...titleA} />}
{eolDiffers && eolA && <span className={styles.badge}>{badgeA}</span>} →
<span className={styles.labelText}>{sideLabel(right)}</span>
{sourceLabels && titleB.detail && <span className={styles.labelFile}>{titleB.detail}</span>}
{sourceLabels && <PaneTitleDetail {...titleB} />}
{eolDiffers && eolB && <span className={styles.badge}>{badgeB}</span>}
</span>
</div>
+10
Переглянути файл
@@ -496,7 +496,17 @@
flex-direction: column;
min-height: 0;
}
.detailsBar {
height: auto;
min-height: 32px;
flex-wrap: wrap;
padding-block: var(--space-0-5);
}
.detailsCount {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-left: 4px;
color: var(--fg-subtle);
font-size: var(--fs-ui);
+20 -15
Переглянути файл
@@ -176,21 +176,21 @@ export function CommitDetails({ commits, fileHistory = false }: { commits: Commi
const treeRef = useRef<TreeHandle>(null);
const [diffToReveal, setDiffToReveal] = useState<{ key: string } | null>(null);
const syncingDiff = useRef(false);
const affectedPaths = filters.paths?.length ? filters.paths : filters.path;
const changes = useMemo(() => {
const changes = files ?? [];
const paths = filters.paths?.length ? filters.paths : filters.path ? [filters.path] : [];
return onlyAffected && paths.length
? changes.filter((c) =>
paths.some((p) => {
const matches = (rel: string) => {
const abs = absolutePath(rel, c.repo);
return abs === p || abs.startsWith(`${p}/`) || (!many && commit?.historyPath === rel);
};
return matches(c.path) || (c.oldPath != null && matches(c.oldPath));
}),
)
: changes;
}, [files, commit, many, filters.path, filters.paths, onlyAffected]);
if (!onlyAffected || !affectedPaths) return changes;
const paths = typeof affectedPaths === "string" ? [affectedPaths] : affectedPaths;
return changes.filter((c) =>
paths.some((p) => {
const matches = (rel: string) => {
const abs = absolutePath(rel, c.repo);
return abs === p || abs.startsWith(`${p}/`) || (!many && commit?.historyPath === rel);
};
return matches(c.path) || (c.oldPath != null && matches(c.oldPath));
}),
);
}, [files, commit, many, affectedPaths, onlyAffected]);
const lineTotals = useMemo(() => {
if (!showLineStats || !changes.length) return null;
if (changes.some((f) => f.added === undefined || f.removed === undefined)) return null;
@@ -289,10 +289,12 @@ export function CommitDetails({ commits, fileHistory = false }: { commits: Commi
{ kind: "header", label: "Group By" },
{ kind: "action", action: "vcs.log.changes.groupByDirectory" },
{ kind: "separator" },
{ kind: "action", action: "vcs.log.changes.diffPreview" },
toggle("Show Only Affected Changes", logOptions(), "showOnlyAffected"),
{ kind: "header", label: "Show" },
toggle("Show lines added and deleted", logOptions(), "showLineStats"),
toggle("Show Changes from Parents", logOptions(), "changesFromParents"),
{ kind: "separator" },
{ kind: "header", label: "Layout" },
{ kind: "action", action: "vcs.log.changes.diffPreview" },
{
label: "Diff Preview Location",
submenu: (["editor", "right", "bottom"] as const).map((location) => ({
@@ -368,6 +370,9 @@ export function CommitDetails({ commits, fileHistory = false }: { commits: Commi
actionArg={chosenChanges}
disabled={readOnly || !chosenChanges.length || new Set(chosenChanges.map((c) => c.repo)).size > 1}
/>
{affectedPaths && (
<IconButton icon="folder" action="vcs.log.changes.showOnlyAffected" size="small" pressed={onlyAffected} />
)}
<IconButton icon="eye" title="View Options" size="small" aria-haspopup="menu" onClick={openViewOptions} />
{!many && fromParents && commit.parents.length > 1 && (
<button
+9
Переглянути файл
@@ -253,6 +253,15 @@ export function registerLogPaneActions(): () => void {
toggled: () => logOptions().groupByDirectory,
run: () => updateLogOptions({ groupByDirectory: !logOptions().groupByDirectory }),
},
{
id: "vcs.log.changes.showOnlyAffected",
title: "Show Only Affected Changes",
category: "Git Log",
when: LOG,
hidden: true,
toggled: () => logOptions().showOnlyAffected,
run: () => updateLogOptions({ showOnlyAffected: !logOptions().showOnlyAffected }),
},
{
id: "vcs.log.changes.diffPreview",
title: "Show Diff Preview",
+8 -1
Переглянути файл
@@ -1529,6 +1529,11 @@
"Disable plugin": "Disable plugin",
"{names} need {name} and stop while it is disabled. Disable it anyway?": "{names} need {name} and stop while it is disabled. Disable it anyway?",
"{names} needs {name} and stops while it is disabled. Disable it anyway?": "{names} needs {name} and stops while it is disabled. Disable it anyway?",
"Appearance": "Appearance",
"Behavior": "Behavior",
"Sort By": "Sort By",
"Type": "Type",
"Modification Time": "Modification Time",
"Show Root Paths": "Show Root Paths",
"Workspace": "Workspace",
"Disable Server": "Disable Server",
@@ -3033,5 +3038,7 @@
"ID:": "ID:",
"Homepage:": "Homepage:",
"Mail:": "Mail:",
"A folder with this name already exists and is not empty": "A folder with this name already exists and is not empty"
"A folder with this name already exists and is not empty": "A folder with this name already exists and is not empty",
"Show Only Affected Changes": "Show Only Affected Changes",
"Layout": "Layout"
}
+4 -1
Переглянути файл
@@ -5904,6 +5904,7 @@
"No live templates to surround with": "没有可用于包围的实时模板",
"Sort by Name": "按名称排序",
"Sort by Type": "按类型排序",
"Modification Time": "修改时间",
"Sort by Modification Time": "按修改时间排序",
"Add Mouse Shortcut": "添加鼠标快捷键",
"Click here with Ctrl, Alt or Command held, or use a middle or side mouse button": "按住 Ctrl、Alt 或 Command 在此点击,或使用鼠标中键或侧键",
@@ -9356,5 +9357,7 @@
"Signed by:": "签名者:",
"ID:": "ID:",
"Homepage:": "主页:",
"Mail:": "邮件:"
"Mail:": "邮件:",
"Show Only Affected Changes": "仅显示受影响的变更",
"Layout": "布局"
}