Open benibenj opened 16 hours ago
I have no clue 😄 you're trying to handle this somewhere and add an attachment? Where does that happen?
I'd say register a proper model. Check out SCMInputBoxContentProvider
for what we do for scm: https://github.com/microsoft/vscode/blob/8154d87ae88246acb57adb56e18b5e579daa7628/src/vs/workbench/api/browser/mainThreadSCM.ts#L63
This will allow chat inputs to play nicely with a bunch of our other apis too
@benibenj looking at this after we merged the image paste provider for chat, but the Error applying edit 'Insert Relative Path': Unable to resolve resource chatSessionInput:input-0
shouldn't happen with the fix to isForSimpleWidget
if your intention is copy/paste a file and have it turn into an attachment, you can maybe try something similar to image paste, we could even combine them.
the issue with this approach is that I don't think you have any files, dataTransferItems, or types in the clipboard data, which is why i'm assuming for files we've used the RelativePathProvider
which has a DataTransferItem
with the correct info.
you can try uncommenting https://github.com/justschen/vscode/blob/896ff8934b0542ea59e929901b3f2db1c6349f03/src/vs/workbench/contrib/chat/browser/chatInputPart.ts#L91-L92 and registering it to see if you can get it to work, but at first pass, I ran into issues with the model being disposed
.
When copy pasting a resource into the chat, the copy paste editor throws with the following error:
Error applying edit 'Insert Relative Path': Unable to resolve resource chatSessionInput:input-0
(Can be reproduced by copying a file in the explorer and pasting into chat)This seems to happen because the copy paste provider tried to make a bulk edit. This step fails because the chat input editor does not have a text model content provider.
Should chat register a provider for the scheme? (
registerTextModelContentProvider('chatSessionInput', {...})
) or should the copy paste controller not perform a bulk edit for these types of "simple editors" and just use the default handler?// cc @jrieken