File tree Expand file tree Collapse file tree
commands/generate-commit-message-command
packages/ui/src/components/editor/panel/PromptField/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 get_git_repository ,
44 prepare_staged_changes
55} from '../../utils/git-repository-utils'
6+ import { display_token_count } from '../../utils/display-token-count'
67import { get_commit_message_config } from './utils/get-commit-message-config'
78import { build_commit_message_prompt } from './utils/build-commit-message-prompt'
89import { generate_commit_message_with_api } from './utils/generate-commit-message-with-api'
@@ -122,8 +123,11 @@ export const generate_commit_message_command = (
122123 const { was_empty_stage, message_prompt } = data
123124
124125 await vscode . env . clipboard . writeText ( message_prompt )
126+ const token_count = Math . floor ( message_prompt . length / 4 )
125127 vscode . window . showInformationMessage (
126- 'Commit message prompt copied to clipboard'
128+ `Commit message prompt of about ${ display_token_count (
129+ token_count
130+ ) } tokens copied to clipboard.`
127131 )
128132
129133 if ( was_empty_stage ) {
Original file line number Diff line number Diff line change @@ -96,9 +96,32 @@ export const prepare_staged_changes = async (
9696 staged_changes . length == 0 &&
9797 repository . state . workingTreeChanges . length > 0
9898 ) {
99- const files_to_stage = repository . state . workingTreeChanges . map (
100- ( change : any ) => change . uri . fsPath
101- )
99+ const items = repository . state . workingTreeChanges . map ( ( change : any ) => {
100+ const relative_path = path . relative (
101+ repository . rootUri . fsPath ,
102+ change . uri . fsPath
103+ )
104+ const dir_name = path . dirname ( relative_path )
105+
106+ return {
107+ label : path . basename ( relative_path ) ,
108+ description : dir_name == '.' ? '' : dir_name ,
109+ picked : true ,
110+ fsPath : change . uri . fsPath
111+ }
112+ } )
113+
114+ const selected = await vscode . window . showQuickPick ( items , {
115+ canPickMany : true ,
116+ title : 'Unstaged Files' ,
117+ placeHolder : 'Select files to commit'
118+ } )
119+
120+ if ( ! selected || selected . length == 0 ) {
121+ return null
122+ }
123+
124+ const files_to_stage = selected . map ( ( item ) => item . fsPath )
102125 const file_args = files_to_stage
103126 . map ( ( file : string ) => `"${ file . replace ( / " / g, '\\"' ) } "` )
104127 . join ( ' ' )
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments