Skip to content

fix(jetbrains): add dropped files as references - #12869

Merged
kirillk merged 2 commits into
mainfrom
glitter-organization
Aug 4, 2026
Merged

fix(jetbrains): add dropped files as references#12869
kirillk merged 2 commits into
mainfrom
glitter-organization

Conversation

@kirillk

@kirillk kirillk commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Issue

Fixes #12837

Context

JetBrains users could see the "Drop files here" overlay when dragging files into the session, but code files such as .php were silently ignored on drop. The accept path only checked advertised drag flavors, while the attachment extractor filtered out anything that was not an image or a hardcoded text extension.

Implementation

Dropped non-image files are now added as file:// reference parts with text/plain, matching the existing @-mention flow so the CLI reads the files as prompt context. Images keep the existing embedded attachment behavior and model capability gate.

The prompt drop path also falls back to reading file data from the DnDEvent transferable if IntelliJ's attached object extraction returns nothing, which helps native/Linux file-list drops. Accepted drops that resolve to no usable files now show a warning instead of failing silently.

Screenshots / Video

Image drop

GIF Recording 2026-08-04 at 11 53 39 AM

Text drop

GIF Recording 2026-08-04 at 12 09 55 PM

How to Test

Manual/local verification

  • Agent ran ./gradlew :frontend:test --tests 'ai.kilocode.client.session.model.PromptAttachmentExtractorTest' --tests 'ai.kilocode.client.session.ui.PromptPanelTest' --tests 'ai.kilocode.client.session.SessionUiLayoutTest' from packages/kilo-jetbrains/ successfully.
  • Agent ran ./gradlew typecheck from packages/kilo-jetbrains/ successfully.
  • Agent ran git diff --check successfully.
  • Pre-push hook ran bun turbo typecheck --filter=!@kilocode/kilo-jetbrains successfully.
  • Pre-push hook ran bun turbo typecheck --filter=@kilocode/kilo-jetbrains successfully.

Reviewer test steps

  1. Launch the JetBrains plugin locally.
  2. Drag a .php or other code file from the Project view onto the prompt input and send a prompt that asks about it.
  3. Confirm the file appears as an attachment chip and the model receives/read the file context.
  4. Repeat the drop over the transcript/session area, not just the prompt input, and confirm the same prompt attachment behavior.
  5. Drag an image file and confirm image attachments still behave as before.

Blocked checks and substitute verification

  • None.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Get in Touch

N/A

@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review of cee2e369..9b6085e2 (2 files). Both previous suggestions are resolved: the empty-result warning now uses neutral wording ("No files could be added.") covering the shared drop/paste path, and PromptAttachmentExtractorTest now covers the directory branch, asserting the application/x-directory reference attachment and its file part. The new test's assertions match the current PromptAttachmentExtractor implementation. No new issues found in the changed code.

Files Reviewed (2 files)
  • packages/kilo-jetbrains/frontend/src/main/resources/messages/KiloBundle.properties
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/model/PromptAttachmentExtractorTest.kt
Previous Review Summary (commit cee2e36)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit cee2e36)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-jetbrains/frontend/src/main/resources/messages/KiloBundle.properties 218 New empty-result warning says "drop" but is also shown on the paste path
packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/model/PromptAttachment.kt 62 Directory branch (application/x-directory reference) has no test coverage

The change is well-scoped: dropped non-image files become file:// + text/plain reference parts, matching the existing @-mention flow (mentionFileParts), and the CLI explicitly handles both text/plain reads and application/x-directory listings for file: parts. The model-capability gate correctly still blocks images while allowing references, the transferable fallback in dropFiles is guarded by the flavor check, and no memory-leak concerns were introduced (no new listeners/subscriptions; text files are no longer base64-embedded, which reduces memory pressure). Changeset is present and user-facing. Both findings are minor polish items.

Fix these issues in Kilo Cloud

Files Reviewed (6 files)
  • .changeset/jetbrains-file-drop-references.md
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/model/PromptAttachment.kt - 1 issue
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/prompt/PromptPanel.kt
  • packages/kilo-jetbrains/frontend/src/main/resources/messages/KiloBundle.properties - 1 issue
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/model/PromptAttachmentExtractorTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/ui/PromptPanelTest.kt

Reviewed by kimi-k3 · Input: 91.9K · Output: 4.2K · Cached: 156.3K

Review guidance: REVIEW.md from base branch main

@kirillk
kirillk merged commit 38176b5 into main Aug 4, 2026
24 checks passed
@kirillk
kirillk deleted the glitter-organization branch August 4, 2026 16:33
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
fix(jetbrains): add dropped files as references
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jetbrains IDEs: 'drop files here to add them to the prompt' doesn't work

2 participants