@@ -8,11 +8,11 @@ import {
88} from '../utils/intelligent-update-utils'
99import { dictionary } from '@shared/constants/dictionary'
1010
11- export const apply_clipboard_content_to_active_editor_command = (
11+ export const refactor_current_file_command = (
1212 context : vscode . ExtensionContext
1313) => {
1414 return vscode . commands . registerCommand (
15- 'codeWebChat.applyClipboardContentToActiveEditor ' ,
15+ 'codeWebChat.refactorCurrentFile ' ,
1616 async ( ) => {
1717 const editor = vscode . window . activeTextEditor
1818 if ( ! editor ) {
@@ -22,11 +22,31 @@ export const apply_clipboard_content_to_active_editor_command = (
2222 return
2323 }
2424
25+ let instruction : string | undefined
2526 const clipboard_content = await vscode . env . clipboard . readText ( )
2627 if ( ! clipboard_content ) {
27- vscode . window . showInformationMessage (
28- dictionary . information_message . CLIPBOARD_IS_EMPTY
28+ instruction = await vscode . window . showInputBox ( {
29+ prompt : 'Enter your refactoring instructions'
30+ } )
31+ } else {
32+ const choice = await vscode . window . showQuickPick (
33+ [ 'Clipboard' , 'Instructions' ] ,
34+ {
35+ placeHolder :
36+ 'Use clipboard content or enter new refactoring instructions?'
37+ }
2938 )
39+
40+ if ( choice == 'Clipboard' ) {
41+ instruction = clipboard_content
42+ } else if ( choice == 'Instructions' ) {
43+ instruction = await vscode . window . showInputBox ( {
44+ prompt : 'Enter your refactoring instructions'
45+ } )
46+ }
47+ }
48+
49+ if ( ! instruction ) {
3050 return
3151 }
3252
@@ -60,7 +80,7 @@ export const apply_clipboard_content_to_active_editor_command = (
6080 result = await vscode . window . withProgress (
6181 {
6282 location : vscode . ProgressLocation . Notification ,
63- title : `Applying clipboard content to active editor ` ,
83+ title : `Refactoring current file ` ,
6484 cancellable : true
6585 } ,
6686 async ( progress , token ) => {
@@ -82,7 +102,7 @@ export const apply_clipboard_content_to_active_editor_command = (
82102 reasoning_effort : intelligent_update_config . reasoning_effort ,
83103 file_path : file_path ,
84104 file_content : original_content ,
85- instruction : clipboard_content ,
105+ instruction,
86106 cancel_token : cancel_token_source . token ,
87107 on_chunk : ( tokens_per_second , total_tokens ) => {
88108 if ( estimated_total_tokens > 0 ) {
0 commit comments