Fix image input in Chat UI and silence extension console errors#12886
Fix image input in Chat UI and silence extension console errors#12886ArnavGarg7 wants to merge 8 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Pull request overview
This PR fixes broken image attachments in the Chat UI by inserting images at the current cursor/selection (instead of position 0), and reduces noisy console errors in the VS Code extension by guarding YAML schema registration and suppressing certain AST tracker logs.
Changes:
- Update TipTap image paste/drop/upload behavior to insert at the active selection using
replaceSelectionWith/editor.commands.insertContent. - Only register
yaml.schemaswhenredhat.vscode-yamlis available to avoid configuration write errors. - Suppress “Document not found in AST tracker” error logs for selected non-AST file types.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts | Paste handler now inserts images at the selection instead of document start. |
| gui/src/components/mainInput/TipTapEditor/TipTapEditor.tsx | Drop/upload now uses TipTap commands to insert images at the cursor. |
| extensions/vscode/src/activation/activate.ts | Guard YAML schema registration behind YAML extension presence. |
| core/nextEdit/DocumentHistoryTracker.ts | Reduce console noise by suppressing missing-AST logs for certain extensions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| editor.commands.insertContent({ | ||
| type: "image", | ||
| attrs: { src: dataUrl } | ||
| }); |
| editor.commands.insertContent({ | ||
| type: "image", | ||
| attrs: { src: dataUrl } | ||
| }); |
| if (!documentPath.endsWith(".yaml") && !documentPath.endsWith(".json") && !documentPath.endsWith(".md")) { | ||
| console.error(`Document ${documentPath} not found in AST tracker`); | ||
| } |
| if (!documentPath.endsWith(".yaml") && !documentPath.endsWith(".json") && !documentPath.endsWith(".md")) { | ||
| console.error(`Document ${documentPath} not found in AST tracker`); | ||
| } |
| if (!documentPath.endsWith(".yaml") && !documentPath.endsWith(".json") && !documentPath.endsWith(".md")) { | ||
| console.error(`Document ${documentPath} not found in AST tracker`); | ||
| } |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Problem
The image attachment mechanism was completely broken on Windows because it tried to insert an inline image node at position 0 in the editor. This violates TipTap's schema and is silently dropped by ProseMirror. Additionally, there were harmless but alarming YAML schema and AST Tracker errors spamming the developer console.
Solution
editor.commands.insertContent, properly delegating schema resolution to TipTap.yaml.schemasregistration with an extension availability check so it doesn't throw aCodeExpectedError..yamland.json.Fixes #12845
Summary by cubic
Fixes broken image attachments in the Chat UI by inserting images at the cursor using TipTap chain/focus, and silences noisy console errors from YAML schema registration and the AST tracker.
Bug Fixes
redhat.vscode-yamlis installed.Refactors
Written for commit 813b5d7. Summary will update on new commits.