Skip to content

Commit 8ebaeb5

Browse files
committed
Add Go to File button and improve focus handling in staged changes quick pick
1 parent f23e6bc commit 8ebaeb5

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎apps/editor/src/utils/git-repository-utils.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,13 @@ export const prepare_staged_changes = async (
117117
label: path.basename(relative_path),
118118
description: dir_name == '.' ? '' : dir_name,
119119
picked: true,
120-
fsPath: change.uri.fsPath
120+
fsPath: change.uri.fsPath,
121+
buttons: [
122+
{
123+
iconPath: new vscode.ThemeIcon('go-to-file'),
124+
tooltip: 'Go to File'
125+
}
126+
]
121127
}
122128
})
123129

@@ -128,6 +134,7 @@ export const prepare_staged_changes = async (
128134
quick_pick.canSelectMany = true
129135
quick_pick.title = 'Unstaged Files'
130136
quick_pick.placeholder = 'Select files to commit'
137+
quick_pick.ignoreFocusOut = true
131138
quick_pick.buttons = [
132139
{
133140
iconPath: new vscode.ThemeIcon('close'),
@@ -142,6 +149,13 @@ export const prepare_staged_changes = async (
142149
}
143150
})
144151

152+
quick_pick.onDidTriggerItemButton((event) => {
153+
if (event.button.tooltip == 'Go to File') {
154+
const uri = vscode.Uri.file(event.item.fsPath)
155+
vscode.window.showTextDocument(uri, { preview: true })
156+
}
157+
})
158+
145159
quick_pick.onDidAccept(() => {
146160
resolve(Array.from(quick_pick.selectedItems))
147161
quick_pick.hide()

0 commit comments

Comments
 (0)