Skip to content

Commit 8c60ea0

Browse files
committed
add setting for double click opening a diff
1 parent 51ce549 commit 8c60ea0

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,6 @@ node_modules/
119119
*.code-workspace
120120
.history
121121
.vscode
122+
123+
# vim stuff
124+
*.swp

schema/plugin.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
"description": "Disable all branch operations (new, switch) when there are changed/staged files",
1818
"default": false
1919
},
20+
"doubleClickDiff": {
21+
"type": "boolean",
22+
"title": "Show diff on double click",
23+
"description": "If true doubling clicking a file in the changed files list will open a diff",
24+
"default": true
25+
},
2026
"historyCount": {
2127
"type": "integer",
2228
"title": "History count",

src/gitMenuCommands.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export namespace CommandIDs {
2121
export const gitInit = 'git:init';
2222
export const gitOpenUrl = 'git:open-url';
2323
export const gitToggleSimpleStaging = 'git:toggle-simple-staging';
24+
export const gitToggleDoubleClickDiff = 'git:toggle-double-click-diff';
2425
export const gitAddRemote = 'git:add-remote';
2526
export const gitClone = 'git:clone';
2627
}
@@ -115,6 +116,15 @@ export function addCommands(
115116
}
116117
});
117118

119+
/** add toggle for double click opens diffs */
120+
commands.addCommand(CommandIDs.gitToggleDoubleClickDiff, {
121+
label: 'Double click opens diff',
122+
isToggled: () => !!settings.composite['doubleClickDiff'],
123+
execute: args => {
124+
settings.set('doubleClickDiff', !settings.composite['doubleClickDiff']);
125+
}
126+
});
127+
118128
/** Command to add a remote Git repository */
119129
commands.addCommand(CommandIDs.gitAddRemote, {
120130
label: 'Add remote repository',

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,7 @@ function createGitMenu(
161161

162162
menu.addItem({ command: CommandIDs.gitToggleSimpleStaging });
163163

164+
menu.addItem({ command: CommandIDs.gitToggleDoubleClickDiff });
165+
164166
return menu;
165167
}

0 commit comments

Comments
 (0)