Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@catrielmuller
Copy link
Contributor

@catrielmuller catrielmuller commented Jan 20, 2026

Context

This PR fixes an IllegalArgumentException: argument type mismatch error that occurred when enabling autocomplete (Ghost Provider) in the JetBrains plugin. The error was triggered when the Ghost service attempted to update the status bar with autocomplete information, causing the plugin to crash and preventing users from using the autocomplete feature.

The root cause was a type mismatch in the RPC communication between the VSCode extension host and the JetBrains plugin. When the Ghost service set the status bar tooltip to a MarkdownString object (as per VSCode's API), it was serialized and sent to the JetBrains side, but the receiving method expected a simple String? type, causing the reflection-based method invocation to fail.

Implementation

The fix involved updating the type signatures in MainThreadStatusBarShape.kt to be more flexible and align with VSCode's StatusBarItem API:

Key Changes:

  1. Changed tooltip parameter type from String? to Any?

    • VSCode's StatusBarItem allows setting tooltips to either strings or MarkdownString objects
    • When a MarkdownString is used, it gets serialized as a Map with properties like value, isTrusted, supportThemeIcons, supportHtml, and uris
    • The new Any? type allows the method to accept both simple strings and serialized MarkdownString objects
  2. Changed accessibilityInformation parameter type from Boolean? to Any?

    • According to VSCode's API, this should be an object with label and role properties, not a Boolean
    • Changed to Any? to match the actual API contract
  3. Added extractTooltipText() helper method

    • Properly extracts the text value from both String and MarkdownString (Map) tooltips
    • Handles the serialized MarkdownString format by extracting the value property from the Map
  4. Created comprehensive test coverage

    • Added ReflectUtilsStatusBarTest.kt with tests for:
      • Double to Int conversion for priority values (ensuring the existing reflection logic still works)
      • Boolean accessibilityInformation handling
      • MarkdownString-like tooltip objects (simulating the actual error scenario)

How to Test

  1. Enable the JetBrains plugin in your IDE (IntelliJ IDEA, PyCharm, etc.)
  2. Configure a Ghost autocomplete provider:
    • Open Kilo Code settings
    • Navigate to Autocomplete settings
    • Enable autocomplete
  3. Open a code file and start typing

Alternative Test (if you don't have autocomplete credits):

  1. Run the new test suite:
    cd jetbrains/plugin
    pnpm test src/test/kotlin/ai/kilocode/jetbrains/util/ReflectUtilsStatusBarTest.kt
  2. All tests should pass, including the new test setEntry with MarkdownString-like tooltip object test

@changeset-bot
Copy link

changeset-bot bot commented Jan 20, 2026

🦋 Changeset detected

Latest commit: 6d297fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Jan 20, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .changeset/shy-numbers-joke.md - No issues
  • jetbrains/plugin/src/main/kotlin/ai/kilocode/jetbrains/actors/MainThreadStatusBarShape.kt - No issues
  • jetbrains/plugin/src/test/kotlin/ai/kilocode/jetbrains/util/ReflectUtilsStatusBarTest.kt - No issues

Summary: This PR fixes JetBrains autocomplete by updating type signatures in MainThreadStatusBarShape.kt to handle flexible JSON input:

  1. tooltip: Changed from String? to Any? to accept both plain strings and MarkdownString objects
  2. accessibilityInformation: Changed from Boolean? to Any? to accept accessibility information objects
  3. Added extractTooltipText() helper to properly extract text from both String and Map (MarkdownString) types
  4. Added comprehensive tests in ReflectUtilsStatusBarTest.kt covering Double priority handling, Boolean accessibilityInformation, and MarkdownString tooltip objects

The changes are well-structured and the test file correctly uses doInvokeMethod from the same package (ai.kilocode.jetbrains.util) without needing an explicit import.

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.

Autocomplete - Nothing happens with autocomplete activated

3 participants