Jetbrains - Fix autocomplete statusbar reflect #5240
Merged
+155
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
This PR fixes an
IllegalArgumentException: argument type mismatcherror 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
MarkdownStringobject (as per VSCode's API), it was serialized and sent to the JetBrains side, but the receiving method expected a simpleString?type, causing the reflection-based method invocation to fail.Implementation
The fix involved updating the type signatures in
MainThreadStatusBarShape.ktto be more flexible and align with VSCode's StatusBarItem API:Key Changes:
Changed
tooltipparameter type fromString?toAny?MarkdownStringobjectsMarkdownStringis used, it gets serialized as a Map with properties likevalue,isTrusted,supportThemeIcons,supportHtml, andurisAny?type allows the method to accept both simple strings and serialized MarkdownString objectsChanged
accessibilityInformationparameter type fromBoolean?toAny?labelandroleproperties, not a BooleanAny?to match the actual API contractAdded
extractTooltipText()helper methodvalueproperty from the MapCreated comprehensive test coverage
ReflectUtilsStatusBarTest.ktwith tests for:How to Test
Alternative Test (if you don't have autocomplete credits):
test setEntry with MarkdownString-like tooltip objecttest