feat: improve VS Code editor chat actions
Targets active editor chat before falling back to sidebar Adds session open-in-editor action in the VS Code sidebar Uses attachment badges for VS Code file and selection context
This commit is contained in:
@@ -199,6 +199,37 @@ export class ChatViewProvider implements vscode.WebviewViewProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public addContextSelection(selection: { filePath: string; filename: string; text: string }) {
|
||||
if (!this._view) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._view.show(true);
|
||||
this._view.webview.postMessage({
|
||||
type: 'command',
|
||||
command: 'addContextSelection',
|
||||
payload: selection,
|
||||
});
|
||||
}
|
||||
|
||||
public addFileAttachments(files: Array<{ filePath: string; fileName: string; fileSize: number | null }>) {
|
||||
if (!this._view) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cleanedFiles = files.filter((entry) => entry.filePath.trim().length > 0 && entry.fileName.trim().length > 0);
|
||||
if (cleanedFiles.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._view.show(true);
|
||||
this._view.webview.postMessage({
|
||||
type: 'command',
|
||||
command: 'addFileAttachments',
|
||||
payload: { files: cleanedFiles },
|
||||
});
|
||||
}
|
||||
|
||||
public addFileMentions(paths: string[]) {
|
||||
if (!this._view) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user