Skip to content

Commit 7e1a143

Browse files
committed
feat: clear command support
1 parent 8facc8c commit 7e1a143

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/commands/clear.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { useGitPanelView } from '@/views/webview'
2+
3+
export default function clearCommand() {
4+
useGitPanelView().clearSelection()
5+
}

src/commands/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { useCommands } from 'reactive-vscode'
22

33
import refreshCommand from './refresh'
44
import diffCommand from './diff'
5+
import clearCommand from './clear'
56

67
import { EXTENSION_SYMBOL } from '@/constant'
78

89
export function initCommands() {
910
useCommands({
1011
[`${EXTENSION_SYMBOL}.history.refresh`]: refreshCommand,
1112
[`${EXTENSION_SYMBOL}.openDiff`]: diffCommand(),
13+
[`${EXTENSION_SYMBOL}.history.clear`]: clearCommand,
1214
})
1315
}

src/constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const WEBVIEW_CHANNEL = {
99
// vscode to webview channel
1010
export const CHANNEL = {
1111
HISTORY: 'history',
12+
CLEAR_SELECTED: 'clear-selected',
1213
}
1314

1415
export const EXTENSION_SYMBOL = 'git-panel'

0 commit comments

Comments
 (0)