Skip to content

Fix image input in Chat UI and silence extension console errors#12886

Open
ArnavGarg7 wants to merge 8 commits into
continuedev:mainfrom
ArnavGarg7:fix-image-input-and-console-errors
Open

Fix image input in Chat UI and silence extension console errors#12886
ArnavGarg7 wants to merge 8 commits into
continuedev:mainfrom
ArnavGarg7:fix-image-input-and-console-errors

Conversation

@ArnavGarg7

@ArnavGarg7 ArnavGarg7 commented Jun 23, 2026

Copy link
Copy Markdown

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

  • Modifies the image paste and upload mechanism to insert the image at the active selection/cursor using editor.commands.insertContent, properly delegating schema resolution to TipTap.
  • Wraps the yaml.schemas registration with an extension availability check so it doesn't throw a CodeExpectedError.
  • Suppresses the AST Tracker error log for non-AST files like .yaml and .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

    • Insert images at the active selection via chain().focus().insertContent() for paste and upload; clipboard paste replaces the current selection.
    • Register YAML schemas only if redhat.vscode-yaml is installed.
    • Suppress "Document not found in AST tracker" logs for .yaml, .yml, .json, .md.
    • Stabilize IntelliJ Autocomplete test: start on a clean line with Esc + Enter x3, retry up to 10; Tab to accept, Enter to retry; throw an exception with debug text; avoid unresolved SDK commands.
    • Remove unused JUnit import to fix Kotlin test compilation.
  • Refactors

    • Applied Prettier formatting to satisfy CI checks.

Written for commit 813b5d7. Summary will update on new commits.

Review in cubic

Copilot AI review requested due to automatic review settings June 23, 2026 15:52
@ArnavGarg7 ArnavGarg7 requested a review from a team as a code owner June 23, 2026 15:52
@ArnavGarg7 ArnavGarg7 requested review from sestinj and removed request for a team June 23, 2026 15:52
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 23, 2026
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ArnavGarg7

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Re-trigger cubic

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.schemas when redhat.vscode-yaml is 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.

Comment on lines +258 to +261
editor.commands.insertContent({
type: "image",
attrs: { src: dataUrl }
});
Comment on lines 290 to 293
editor.commands.insertContent({
type: "image",
attrs: { src: dataUrl }
});
Comment thread core/nextEdit/DocumentHistoryTracker.ts Outdated
Comment on lines +64 to +66
if (!documentPath.endsWith(".yaml") && !documentPath.endsWith(".json") && !documentPath.endsWith(".md")) {
console.error(`Document ${documentPath} not found in AST tracker`);
}
Comment thread core/nextEdit/DocumentHistoryTracker.ts Outdated
Comment on lines +87 to +89
if (!documentPath.endsWith(".yaml") && !documentPath.endsWith(".json") && !documentPath.endsWith(".md")) {
console.error(`Document ${documentPath} not found in AST tracker`);
}
Comment thread core/nextEdit/DocumentHistoryTracker.ts Outdated
Comment on lines +112 to +114
if (!documentPath.endsWith(".yaml") && !documentPath.endsWith(".json") && !documentPath.endsWith(".md")) {
console.error(`Document ${documentPath} not found in AST tracker`);
}
@ArnavGarg7

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 23, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Image input completely broken and ignored in Chat UI due to AST tracker and YAML schema errors on Windows

2 participants