Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,42 @@
"command": "pochi.clearGithubInfo",
"title": "Clear GitHub Info",
"category": "Pochi"
},
{
"command": "pochi.comments.deleteThread",
"title": "Delete Thread",
"icon": "$(trash)",
"category": "Pochi"
},
{
"command": "pochi.comments.addComment",
"title": "Add Comment",
"icon": "$(comment-add)",
"category": "Pochi"
},
{
"command": "pochi.comments.deleteComment",
"title": "Delete Comment",
"icon": "$(trash)",
"category": "Pochi"
},
{
"command": "pochi.comments.startEditComment",
"title": "Edit Comment",
"icon": "$(edit)",
"category": "Pochi"
},
{
"command": "pochi.comments.saveEditComment",
"title": "Save",
"icon": "$(save)",
"category": "Pochi"
},
{
"command": "pochi.comments.cancelEditComment",
"title": "Cancel",
"icon": "$(close)",
"category": "Pochi"
}
],
"menus": {
Expand Down Expand Up @@ -249,6 +285,30 @@
{
"command": "pochi.clearGithubInfo",
"title": "Pochi: Clear GitHub Info"
},
{
"command": "pochi.comments.deleteThread",
"when": "false"
},
{
"command": "pochi.comments.addComment",
"when": "false"
},
{
"command": "pochi.comments.deleteComment",
"when": "false"
},
{
"command": "pochi.comments.startEditComment",
"when": "false"
},
{
"command": "pochi.comments.saveEditComment",
"when": "false"
},
{
"command": "pochi.comments.cancelEditComment",
"when": "false"
}
],
"view/title": [
Expand All @@ -262,6 +322,42 @@
"when": "view == pochiSidebar",
"group": "navigation@2"
}
],
"comments/commentThread/context": [
{
"command": "pochi.comments.addComment",
"when": "commentController == 'pochi-comments'"
}
],
"comments/commentThread/title": [
{
"command": "pochi.comments.deleteThread",
"when": "commentController == 'pochi-comments' && commentThread =~ /canDelete/"
}
],
"comments/comment/title": [
{
"command": "pochi.comments.deleteComment",
"group": "inline@0",
"when": "commentController == 'pochi-comments'"
},
{
"command": "pochi.comments.startEditComment",
"group": "inline@1",
"when": "commentController == 'pochi-comments'"
}
],
"comments/comment/context": [
{
"command": "pochi.comments.saveEditComment",
"group": "inline@0",
"when": "commentController == 'pochi-comments'"
},
{
"command": "pochi.comments.cancelEditComment",
"group": "inline@1",
"when": "commentController == 'pochi-comments'"
}
]
},
"keybindings": [
Expand Down
2 changes: 2 additions & 0 deletions packages/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import * as vscode from "vscode";
import { CompletionProvider } from "./code-completion";
import { PochiAuthenticationProvider } from "./integrations/auth-provider";
import { CommandManager } from "./integrations/command";
import { CommentController } from "./integrations/comment-controller";
import { DiffChangesContentProvider } from "./integrations/editor/diff-changes-content-provider";
import { DiffOriginContentProvider } from "./integrations/editor/diff-origin-content-provider";
import { WorktreeManager } from "./integrations/git/worktree";
Expand Down Expand Up @@ -87,6 +88,7 @@ export async function activate(context: vscode.ExtensionContext) {
container.resolve(TerminalLinkProvider);
container.resolve(DiffChangesContentProvider);
container.resolve(WorktreeManager);
container.resolve(CommentController);
}

// This method is called when your extension is deactivated
Expand Down
55 changes: 55 additions & 0 deletions packages/vscode/src/integrations/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ import { getServerBaseUrl } from "@getpochi/common/vscode-webui-bridge";
import { inject, injectable, singleton } from "tsyringe";
import * as vscode from "vscode";
// biome-ignore lint/style/useImportType: needed for dependency injection
import {
type Comment,
CommentController,
type Thread,
} from "./comment-controller";
// biome-ignore lint/style/useImportType: needed for dependency injection
import { PochiConfiguration } from "./configuration";
import { DiffChangesContentProvider } from "./editor/diff-changes-content-provider";
// biome-ignore lint/style/useImportType: needed for dependency injection
Expand Down Expand Up @@ -61,6 +67,7 @@ export class CommandManager implements vscode.Disposable {
private readonly nesDecorationManager: NESDecorationManager,
private readonly worktreeManager: WorktreeManager,
private readonly worktreeInfoProvider: GitWorktreeInfoProvider,
private readonly commentController: CommentController,
) {
this.registerCommands();
}
Expand Down Expand Up @@ -597,6 +604,54 @@ export class CommandManager implements vscode.Disposable {
},
),

vscode.commands.registerCommand(
"pochi.comments.deleteThread",
async (thread?: Thread) => {
if (thread) {
await this.commentController.deleteThread(thread);
}
},
),

vscode.commands.registerCommand(
"pochi.comments.addComment",
async (commentReply?: vscode.CommentReply | undefined) => {
if (commentReply) {
await this.commentController.addComment(commentReply);
}
},
),

vscode.commands.registerCommand(
"pochi.comments.deleteComment",
async (comment?: Comment, thread?: Thread) => {
if (comment && thread) {
await this.commentController.deleteComment(comment, thread);
}
},
),

vscode.commands.registerCommand(
"pochi.comments.startEditComment",
async (comment: Comment, thread: Thread) => {
await this.commentController.startEditComment(comment, thread);
},
),

vscode.commands.registerCommand(
"pochi.comments.saveEditComment",
async (comment: Comment) => {
await this.commentController.saveEditComment(comment);
},
),

vscode.commands.registerCommand(
"pochi.comments.cancelEditComment",
async (comment: Comment) => {
await this.commentController.cancelEditComment(comment);
},
),

vscode.commands.registerCommand(
"pochi.openPochiLayoutOrTerminal",
async (...args) => {
Expand Down
Loading