Skip to content

Commit a05f5a4

Browse files
authored
Merge pull request #20 from square/more-minimal
trimming things down a bit
2 parents 3b6347a + 2b8daca commit a05f5a4

File tree

2 files changed

+13
-81
lines changed

2 files changed

+13
-81
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "goose-vscode",
3-
"version": "0.0.15",
3+
"version": "0.0.16",
44
"publisher": "michaelneale",
55
"icon": "goose-icon.png",
66
"main": "./out/extension.js",

src/extension.ts

+12-80
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ export function activate(context: vscode.ExtensionContext) {
2323
}
2424
}
2525

26-
vscode.window.showInformationMessage('goose agent starting, this may take a minute.. ⏰');
26+
2727

2828
let getTerminal = () => {
2929
if (!gooseTerminal || gooseTerminal.exitStatus !== undefined) {
30+
vscode.window.showInformationMessage('goose agent starting, this may take a minute.. ⏰');
3031
gooseTerminal = vscode.window.createTerminal({
3132
name: terminalName,
3233
message: 'Loading Goose Session...', // Add a message to make it clear what terminal is for
@@ -46,8 +47,8 @@ export function activate(context: vscode.ExtensionContext) {
4647
});
4748
context.subscriptions.push(openTerminalDisposable);
4849

49-
// Automatically open the terminal when the extension activates
50-
vscode.commands.executeCommand('extension.openGooseTerminal');
50+
// Automatically open the terminal when the extension activates
51+
//vscode.commands.executeCommand('extension.openGooseTerminal');
5152

5253

5354
let sendToGooseDisposable = vscode.commands.registerCommand('extension.sendToGoose', async () => {
@@ -101,23 +102,8 @@ export function activate(context: vscode.ExtensionContext) {
101102

102103
context.subscriptions.push(sendToGooseDisposable);
103104

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-
}
111-
});
112105

113-
// Completion suggestion: ask Goose to explain it
114-
vscode.languages.registerCodeActionsProvider('*', {
115-
provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken) {
116-
const codeAction = new vscode.CodeAction('Ask goose to explain it', vscode.CodeActionKind.QuickFix);
117-
codeAction.command = { command: 'extension.askGooseToExplainIt', title: 'Ask goose to explain it' };
118-
return [codeAction];
119-
}
120-
});
106+
121107

122108

123109

@@ -130,70 +116,16 @@ export function activate(context: vscode.ExtensionContext) {
130116
}
131117
});
132118

133-
134-
135-
// Register inline completion provider
136-
vscode.languages.registerInlineCompletionItemProvider('*', {
137-
provideInlineCompletionItems(document: vscode.TextDocument, position: vscode.Position) {
138-
const editor = vscode.window.activeTextEditor;
139-
if (!editor) {
140-
return;
141-
}
142-
143-
const completionItem = new vscode.InlineCompletionItem('complete with goose');
144-
completionItem.insertText = '';
145-
completionItem.command = { command: 'extension.askGooseToFinishIt', title: 'complete with goose' };
146-
return [completionItem];
147-
}
148-
});
149-
150-
// Register content completion extension
151-
vscode.languages.registerCompletionItemProvider('*', {
152-
provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) {
153-
const completionItem = new vscode.CompletionItem('Ask Goose to finish this code', vscode.CompletionItemKind.Text);
154-
completionItem.insertText = '';
155-
completionItem.command = { command: 'extension.askGooseToFinishIt', title: 'Ask Goose to finish this code' };
156-
return [completionItem];
157-
}
158-
}, '.');
159-
160-
161-
162-
const askGooseToFinishItCommand = vscode.commands.registerCommand('extension.askGooseToFinishIt', async () => {
163-
const editor = vscode.window.activeTextEditor;
164-
if (!editor) {
165-
return;
119+
// Completion suggestion: ask goose (general)
120+
vscode.languages.registerCodeActionsProvider('*', {
121+
provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken) {
122+
const codeAction = new vscode.CodeAction('Ask goose', vscode.CodeActionKind.QuickFix);
123+
codeAction.command = { command: 'extension.sendToGoose', title: 'Ask goose' };
124+
return [codeAction];
166125
}
167-
168-
const document = editor.document;
169-
const selection = editor.selection;
170-
const filePath = document.uri.fsPath;
171-
const startLine = selection.start.line + 1;
172-
173-
document.save();
174-
175-
getTerminal().sendText(`There is some unfinished code at line: ${startLine} in file: ${filePath}. ` +
176-
`Complete the code based on the context, from that line onwards. Do not delete content.`);
177126
});
178-
context.subscriptions.push(askGooseToFinishItCommand);
179-
180-
const askGooseToExplainItCommand = vscode.commands.registerCommand('extension.askGooseToExplainIt', async () => {
181-
const editor = vscode.window.activeTextEditor;
182-
if (!editor) {
183-
return;
184-
}
185-
186-
const document = editor.document;
187-
const selection = editor.selection;
188-
const filePath = document.uri.fsPath;
189-
const startLine = selection.start.line + 1;
190-
191-
document.save();
127+
192128

193-
getTerminal().sendText(`Explain the code on line: ${startLine} in file: ${filePath}. `);
194-
195-
});
196-
context.subscriptions.push(askGooseToExplainItCommand);
197129

198130
const askGooseToFix = vscode.commands.registerCommand('extension.askGooseToFix', async () => {
199131
const editor = vscode.window.activeTextEditor;

0 commit comments

Comments
 (0)