mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-22 09:39:27 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddad5f0724 |
No files matched your search
@@ -11,6 +11,8 @@ use std::collections::BTreeMap;
|
||||
pub struct VcsSettings {
|
||||
/// Colour folders that contain changed files (project tree, tabs).
|
||||
pub show_dirty_directories: bool,
|
||||
/// Diffs the user opens show in an editor tab; off, in a separate window.
|
||||
pub diff_as_editor_tab: bool,
|
||||
/// Stop file history (Show History) after `history_limit` commits.
|
||||
pub limit_history: bool,
|
||||
pub history_limit: u32,
|
||||
@@ -55,6 +57,7 @@ impl Default for VcsSettings {
|
||||
Self {
|
||||
// IDEA's VcsConfiguration.SHOW_DIRTY_RECURSIVELY is off by default.
|
||||
show_dirty_directories: false,
|
||||
diff_as_editor_tab: true,
|
||||
limit_history: true,
|
||||
history_limit: 1000,
|
||||
git: GitSettings::default(),
|
||||
|
||||
@@ -12428,6 +12428,8 @@ export type VcsRoot = {
|
||||
export type VcsSettings = {
|
||||
/** Colour folders that contain changed files (project tree, tabs). */
|
||||
showDirtyDirectories?: boolean,
|
||||
/** Diffs the user opens show in an editor tab; off, in a separate window. */
|
||||
diffAsEditorTab?: boolean,
|
||||
/** Stop file history (Show History) after `history_limit` commits. */
|
||||
limitHistory?: boolean,
|
||||
historyLimit?: number,
|
||||
|
||||
@@ -752,6 +752,12 @@ export const VCS_PAGES: PageSpec[] = [
|
||||
key: "vcs.showDirtyDirectories",
|
||||
label: "Highlight directories that contain modified files in the Project tree",
|
||||
},
|
||||
{
|
||||
kind: "toggle",
|
||||
key: "vcs.diffAsEditorTab",
|
||||
label: "Open diff as editor tab",
|
||||
hint: "When off, diffs you open (changes, history, Compare) show in a separate window.",
|
||||
},
|
||||
{
|
||||
kind: "select",
|
||||
key: "vcs.confirmation.onPatchCreated",
|
||||
|
||||
@@ -8,6 +8,8 @@ import { showChangesDiff, type LogChange } from "../logChanges";
|
||||
|
||||
const front = vi.hoisted(() => ({ diff: vi.fn(), merge: vi.fn() }));
|
||||
vi.mock("../diffDialog", () => ({ openDiffDialog: front.diff, openMergeDiffDialog: front.merge }));
|
||||
const separate = vi.hoisted(() => vi.fn());
|
||||
vi.mock("../DiffWindow", () => ({ showDiffWindow: separate }));
|
||||
|
||||
/** Editor tabs the diffs open in (openDiff → the editor service). */
|
||||
const openInput = vi.fn(async () => undefined);
|
||||
@@ -75,3 +77,15 @@ it("opens a commit's file diff in the preview tab with the non-modal interface",
|
||||
await showChangesDiff([file]);
|
||||
expect(openInput).toHaveBeenLastCalledWith(expect.objectContaining({ kind: "diff" }), { preview: true, focus: true });
|
||||
});
|
||||
|
||||
it("opens diffs in a separate window when Open diff as editor tab is off", async () => {
|
||||
useProject.setState({ settings: { vcs: { diffAsEditorTab: false } } as Settings });
|
||||
await getAction("diff.compareTexts")!.run({ arg: texts, ctx: {} });
|
||||
expect(separate).toHaveBeenCalledWith(expect.objectContaining({ path: "/p/a.ts" }), expect.any(Function));
|
||||
expect(openInput).not.toHaveBeenCalled();
|
||||
// The modal commit interface still shows them in its front window.
|
||||
useProject.setState({ settings: { vcs: { diffAsEditorTab: false, commit: { nonModal: false } } } as Settings });
|
||||
await getAction("diff.compareTexts")!.run({ arg: texts, ctx: {} });
|
||||
expect(front.diff).toHaveBeenCalledTimes(1);
|
||||
expect(separate).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -209,7 +209,12 @@ export const opensDiffOnActivate = () => {
|
||||
* (`vcs.openDiff`, with review comments) call openDiff directly.
|
||||
*/
|
||||
export async function openVcsDiff(data: DiffData, opts: { preview?: boolean; focus?: boolean } = {}) {
|
||||
if (!vcsDiffInFront()) return openDiff(data, opts);
|
||||
if (!vcsDiffInFront()) {
|
||||
// Settings › Version Control › Confirmation: "Open diff as editor tab" off.
|
||||
if (workflowSettings().vcs.diffAsEditorTab || combinedOf(data)) return openDiff(data, opts);
|
||||
const { showDiffWindow } = await import("./DiffWindow");
|
||||
return showDiffWindow(data, () => void openDiff(data, opts));
|
||||
}
|
||||
const { openDiffDialog } = await import("./diffDialog");
|
||||
openDiffDialog(data);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ export const CLIENT_SETTINGS_KEYS = [
|
||||
"run.pinTabs",
|
||||
"externalDiff",
|
||||
"vcs.showDirtyDirectories",
|
||||
"vcs.diffAsEditorTab",
|
||||
"vcs.git.inlineBlame",
|
||||
"vcs.git.inlineBlameClickable",
|
||||
"vcs.git.showBranchInProjectView",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"Open diff as editor tab": "Open diff as editor tab",
|
||||
"When off, diffs you open (changes, history, Compare) show in a separate window.": "When off, diffs you open (changes, history, Compare) show in a separate window.",
|
||||
"Plain-text word lists (one word per line) or Hunspell .dic files; a .dic with its .aff beside it also accepts the inflected forms and compounds its rules allow. Relative paths resolve against the project root, ~/ against the home folder.": "Plain-text word lists (one word per line) or Hunspell .dic files; a .dic with its .aff beside it also accepts the inflected forms and compounds its rules allow. Relative paths resolve against the project root, ~/ against the home folder.",
|
||||
"Trust Folder": "Trust Folder",
|
||||
"No files selected": "No files selected",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"Open diff as editor tab": "以编辑器标签页打开差异",
|
||||
"When off, diffs you open (changes, history, Compare) show in a separate window.": "关闭后,打开的差异(更改、历史记录、比较)会显示在单独的窗口中。",
|
||||
"Plain-text word lists (one word per line) or Hunspell .dic files; a .dic with its .aff beside it also accepts the inflected forms and compounds its rules allow. Relative paths resolve against the project root, ~/ against the home folder.": "纯文本单词列表(每行一个词)或 Hunspell .dic 文件;旁边有同名 .aff 的 .dic 还会接受其规则允许的变形和复合词。相对路径基于项目根目录解析,~/ 表示主目录。",
|
||||
"MCP server instructions": "MCP 服务器说明",
|
||||
"MCP tools (deferred)": "MCP 工具(延迟加载)",
|
||||
|
||||
@@ -76,6 +76,8 @@ export interface CommitSettingsValid {
|
||||
|
||||
export interface VcsSettingsValid {
|
||||
showDirtyDirectories: boolean;
|
||||
/** Off: diffs the user opens show in a separate window. */
|
||||
diffAsEditorTab: boolean;
|
||||
limitHistory: boolean;
|
||||
historyLimit: number;
|
||||
git: GitSettingsValid;
|
||||
@@ -274,6 +276,7 @@ export const DEFAULT_WORKFLOW: WorkflowSettings = {
|
||||
vcs: {
|
||||
// IDEA's VcsConfiguration.SHOW_DIRTY_RECURSIVELY is off by default.
|
||||
showDirtyDirectories: false,
|
||||
diffAsEditorTab: true,
|
||||
limitHistory: true,
|
||||
historyLimit: 1000,
|
||||
git: {
|
||||
@@ -448,6 +451,7 @@ export function validateVcs(raw: unknown): VcsSettingsValid {
|
||||
const confirm = ["ask", "silently", "never"] as const;
|
||||
return {
|
||||
showDirtyDirectories: bool(v.showDirtyDirectories, d.showDirtyDirectories),
|
||||
diffAsEditorTab: bool(v.diffAsEditorTab, d.diffAsEditorTab),
|
||||
limitHistory: bool(v.limitHistory, d.limitHistory),
|
||||
historyLimit: num(v.historyLimit, d.historyLimit, L.historyLimit, true),
|
||||
git: {
|
||||
|
||||
Reference in new issue
Block a user