@@ -5,11 +5,10 @@ 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 chat 🪿 ' ;
8
+ const terminalName = '\u2728 goose chat \u2728 ' ;
9
9
10
10
export function activate ( context : vscode . ExtensionContext ) {
11
11
12
-
13
12
// Check if goose CLI is installed
14
13
const config = vscode . workspace . getConfiguration ( 'goose' ) ;
15
14
let defaultCommand = config . get ( 'defaultCommand' , "goose session start" ) ;
@@ -87,31 +86,30 @@ export function activate(context: vscode.ExtensionContext) {
87
86
}
88
87
editor . document . save ( ) ;
89
88
getTerminal ( ) . sendText ( textToAskGoose ) ;
89
+
90
+ // Check config for opening diff editor after Goose edits
91
+ const openDiffAfterEdit = config . get ( 'openDiffEditorAfterGooseEdits' , false ) ;
92
+ if ( openDiffAfterEdit ) {
93
+ // Watch for changes in the active text editor
94
+ const watcher = vscode . workspace . createFileSystemWatcher ( filePath ) ;
95
+ watcher . onDidChange ( ( ) => {
96
+ vscode . commands . executeCommand ( 'workbench.view.scm' ) ;
97
+ watcher . dispose ( ) ; // Stop watching after opening SCM view
98
+ } ) ;
99
+ }
90
100
} ) ;
91
101
92
102
context . subscriptions . push ( sendToGooseDisposable ) ;
93
103
94
-
95
- // Register code lens provider
96
- vscode . languages . registerCodeLensProvider ( '*' , {
97
- provideCodeLenses ( document : vscode . TextDocument , token : vscode . CancellationToken ) {
98
- const editor = vscode . window . activeTextEditor ;
99
- if ( ! editor ) {
100
- return [ ] ;
101
- }
102
- // Check for a blank line above the selection
103
- const line = editor . selection . start . line - 1 ;
104
- if ( line < 0 || document . lineAt ( line ) . isEmptyOrWhitespace ) {
105
- const codeLens = new vscode . CodeLens ( editor . selection , {
106
- command : 'extension.sendToGoose' ,
107
- title : '🪿 Ask Goose 🪿'
108
- } ) ;
109
- return [ codeLens ] ;
104
+ // Completion suggestion: ask goose (general) d
105
+ vscode . languages . registerCodeActionsProvider ( '*' , {
106
+ provideCodeActions ( document : vscode . TextDocument , range : vscode . Range , context : vscode . CodeActionContext , token : vscode . CancellationToken ) {
107
+ const codeAction = new vscode . CodeAction ( 'Ask goose to edit' , vscode . CodeActionKind . QuickFix ) ;
108
+ codeAction . command = { command : 'extension.sendToGoose' , title : 'Ask goose to edit it' } ;
109
+ return [ codeAction ] ;
110
110
}
111
- return [ ] ;
112
- }
113
111
} ) ;
114
-
112
+
115
113
// Completion suggestion: ask Goose to explain it
116
114
vscode . languages . registerCodeActionsProvider ( '*' , {
117
115
provideCodeActions ( document : vscode . TextDocument , range : vscode . Range , context : vscode . CodeActionContext , token : vscode . CancellationToken ) {
@@ -122,6 +120,7 @@ export function activate(context: vscode.ExtensionContext) {
122
120
} ) ;
123
121
124
122
123
+
125
124
// Completion suggestion: ask Goose to finish it
126
125
vscode . languages . registerCodeActionsProvider ( '*' , {
127
126
provideCodeActions ( document : vscode . TextDocument , range : vscode . Range , context : vscode . CodeActionContext , token : vscode . CancellationToken ) {
@@ -216,3 +215,4 @@ export function activate(context: vscode.ExtensionContext) {
216
215
217
216
}
218
217
218
+
0 commit comments