@@ -5,7 +5,7 @@ import * as path from 'path';
5
5
import { execSync } from 'child_process' ;
6
6
7
7
let gooseTerminal : vscode . Terminal | undefined ;
8
- const terminalName = '🪿 goose agent 🪿' ;
8
+ const terminalName = '🪿 goose chat 🪿' ;
9
9
const tempFilePath = path . join ( os . tmpdir ( ) , 'goose_open_files.txt' ) ;
10
10
const tempFilePathDirty = path . join ( os . tmpdir ( ) , 'goose_unsaved_files.txt' ) ;
11
11
@@ -24,7 +24,7 @@ export function activate(context: vscode.ExtensionContext) {
24
24
return ; // Exit activation if goose is not installed
25
25
}
26
26
27
- vscode . window . showInformationMessage ( 'goose agent starting, this may take a minute.. 🕐 ' ) ;
27
+ vscode . window . showInformationMessage ( 'goose agent starting, this may take a minute.. ⏰ ' ) ;
28
28
29
29
30
30
const updateOpenFiles = ( ) => {
@@ -59,7 +59,6 @@ export function activate(context: vscode.ExtensionContext) {
59
59
gooseTerminal . show ( ) ;
60
60
61
61
} ) ;
62
-
63
62
context . subscriptions . push ( openTerminalDisposable ) ;
64
63
65
64
// Automatically open the terminal when the extension activates
@@ -94,8 +93,39 @@ export function activate(context: vscode.ExtensionContext) {
94
93
95
94
gooseTerminal ?. show ( ) ;
96
95
} ) ;
97
-
96
+
98
97
context . subscriptions . push ( sendToGooseDisposable ) ;
98
+
99
+
100
+
101
+
102
+ // Completion suggestion: ask Goose to finish it
103
+ vscode . languages . registerCodeActionsProvider ( '*' , {
104
+ provideCodeActions ( document : vscode . TextDocument , range : vscode . Range , context : vscode . CodeActionContext , token : vscode . CancellationToken ) {
105
+ const codeAction = new vscode . CodeAction ( 'Ask Goose to finish it' , vscode . CodeActionKind . QuickFix ) ;
106
+ codeAction . command = { command : 'extension.askGooseToFinishIt' , title : 'Ask Goose to finish it' } ;
107
+ return [ codeAction ] ;
108
+ }
109
+ } ) ;
110
+
111
+ const askGooseToFinishItCommand = vscode . commands . registerCommand ( 'extension.askGooseToFinishIt' , async ( ) => {
112
+ const editor = vscode . window . activeTextEditor ;
113
+ if ( ! editor ) {
114
+ return ;
115
+ }
116
+
117
+ const document = editor . document ;
118
+ const selection = editor . selection ;
119
+ const filePath = document . uri . fsPath ;
120
+ const startLine = selection . start . line + 1 ;
121
+
122
+ document . save ( ) ;
123
+
124
+
125
+ gooseTerminal ?. sendText ( `There is some unfinished code around ${ startLine } in file ${ filePath } , can you please try to complete it as best makes sense.` ) ;
126
+ gooseTerminal ?. show ( ) ;
127
+ } ) ;
128
+ context . subscriptions . push ( askGooseToFinishItCommand ) ;
99
129
}
100
130
101
131
export function deactivate ( ) {
0 commit comments