-
Notifications
You must be signed in to change notification settings - Fork 254
Add chat capability #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds interactive chat capabilities to the POML VSCode extension by introducing a prompt gallery, new chat participant integration, and passing inline context through the language server.
- Extend PreviewParams with
inlineContextand wire it through the LSP server - Register a new Prompt Gallery view with Add/Delete/Edit commands
- Implement
poml.runnerchat participant and update activation/contribution points
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/poml-vscode/panel/types.ts | Added inlineContext to PreviewParams for passing chat context |
| packages/poml-vscode/lsp/server.ts | Initialized server-side context from inlineContext |
| packages/poml-vscode/extension.ts | Registered prompt gallery, chat participant, and prompt commands |
| packages/poml-vscode/command/promptGallery.ts | Implemented Add/Delete/Edit prompt commands |
| packages/poml-vscode/command/index.ts | Exported new prompt gallery commands |
| packages/poml-vscode/chat/participant.ts | Created chat participant handler to route chat requests |
| packages/poml-vscode/chat/gallery.ts | Added PromptGalleryProvider and tree view registration |
| package.json | Bumped engine, added activationEvents, views, commands, chatParticipant |
| gallery/chat.poml | Added default POML chat template |
Comments suppressed due to low confidence (3)
packages/poml-vscode/command/promptGallery.ts:12
- [nitpick] New prompt gallery commands (AddPromptCommand, DeletePromptCommand, EditPromptCommand) lack unit tests; consider adding coverage for user inputs, validation, and state updates.
export class AddPromptCommand implements Command {
packages/poml-vscode/chat/participant.ts:2
- The import path for getClient uses the package name instead of a relative path; update it to use a relative import (e.g., '../extension') to ensure the module resolves correctly.
import { getClient } from 'poml-vscode/extension';
packages/poml-vscode/chat/participant.ts:3
- The types import should be relative ('../panel/types') rather than 'poml-vscode/panel/types' to match the extension's file structure and prevent resolution errors.
import { PreviewMethodName, PreviewParams, PreviewResponse } from 'poml-vscode/panel/types';
| throw new Error(`Error rendering POML: ${errorMessage}`); | ||
| } else { | ||
| console.log('Rendered POML:', response.content); | ||
| // stream.button('View Rendered Prompt', ) |
Copilot
AI
Jul 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This commented-out placeholder appears unfinished; consider removing it or implementing the intended button action to keep the codebase clean and clear.
| // stream.button('View Rendered Prompt', ) |
| getChildren(): PromptEntry[] { | ||
| return this.entries; |
Copilot
AI
Jul 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getChildren method signature should accept an optional element parameter (getChildren(element?: PromptEntry)), matching the TreeDataProvider interface to avoid type errors.
| getChildren(): PromptEntry[] { | |
| return this.entries; | |
| getChildren(element?: PromptEntry): PromptEntry[] { | |
| if (!element) { | |
| return this.entries; // Return root-level items | |
| } | |
| // Currently, no nested items are supported. Return an empty array for child items. | |
| return []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Prompt Comparison Fails with Object Recreation
The removePrompt and updatePrompt methods in PromptGalleryProvider rely on object reference equality to identify PromptEntry objects. This fails when PromptEntry objects are recreated (e.g., from storage) as they will be different instances. They should instead compare entries by a unique property, such as name.
packages/poml-vscode/chat/gallery.ts#L41-L49
poml/packages/poml-vscode/chat/gallery.ts
Lines 41 to 49 in ee8fd95
| removePrompt(entry: PromptEntry) { | |
| this.update(this.entries.filter(e => e !== entry)); | |
| } | |
| updatePrompt(entry: PromptEntry, newEntry: PromptEntry) { | |
| const list = this.entries.map(e => (e === entry ? newEntry : e)); | |
| this.update(list); | |
| } |
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.