Skip to content

Commit

Permalink
feat(commands): add edit functionality for NL outlines
Browse files Browse the repository at this point in the history
  • Loading branch information
Sma1lboy committed Sep 4, 2024
1 parent 9278a74 commit 7b9643e
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions clients/vscode/src/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { InlineCompletionProvider } from "./InlineCompletionProvider";
import { ChatViewProvider } from "./chat/ChatViewProvider";
import { GitProvider, Repository } from "./git/GitProvider";
import CommandPalette from "./CommandPalette";
import { showOutputPanel } from "./logger";
import { getLogger, showOutputPanel } from "./logger";
import { Issues } from "./Issues";
import { NLOutlinesProvider } from "./NLOutlinesProvider";

Expand Down Expand Up @@ -440,7 +440,7 @@ export class Commands {

quickPick.show();
},
"chat.edit.generateNatureLanguageOutlines": async () => {
"chat.edit.generateNLOutlines": async () => {
const editor = window.activeTextEditor;
if (!editor) {
return;
Expand Down Expand Up @@ -513,6 +513,34 @@ export class Commands {
},
);
},
"chat.edit.editNLOutline": async () => {
const editor = window.activeTextEditor;
if (!editor) return;
const position = editor.selection.active;
const line = position.line;
const content = this.nlOutlinesProvider.getOutline(editor.document.uri.toString(), line);
getLogger().info("get content");
if (!content) return;

getLogger().info("shown");
window.showInformationMessage(content);
const quickPick = window.createQuickPick();
quickPick.items = [{ label: content }];
quickPick.placeholder = "Edit NL Outline content";
quickPick.value = content;

quickPick.onDidAccept(async () => {
const newContent = quickPick.value;
quickPick.hide();

await this.nlOutlinesProvider.updateNLOutline(editor.document.uri.toString(), line, newContent);

window.showInformationMessage(`Updated NL Outline: ${newContent}`);
});

quickPick.show();
return;
},
"chat.edit.stop": async () => {
this.chatEditCancellationTokenSource?.cancel();
},
Expand Down

0 comments on commit 7b9643e

Please sign in to comment.