Skip to content

Conversation

@sestinj
Copy link
Contributor

@sestinj sestinj commented Apr 25, 2025

WIP migrating to the native JetBrains InlineCompletionProvider API. This may not be picked up again for a week or two. If anyone comes across this and has interest in cleaning up more of the details to get it across the finish line earlier, please feel free to help out!

@sestinj sestinj requested a review from a team as a code owner April 25, 2025 05:50
@sestinj sestinj requested review from Patrick-Erichsen and removed request for a team April 25, 2025 05:50
@netlify
Copy link

netlify bot commented Apr 25, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit a17d29a
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/680b228e0089a400081028d2

@kkarnauk
Copy link

kkarnauk commented May 5, 2025

Hi! Sorry to bother you, I'm one of the authors of the Inline Completion API in IntelliJ. I noticed that you're using an older version of the API, which was part of a highly experimental stage and is no longer available in the platform. I recommend switching to the version introduced in IntelliJ 2024.1. It's much more stable and production-ready now. Please let me know if you have any questions.

@sestinj
Copy link
Contributor Author

sestinj commented May 6, 2025

Thanks for reaching out @kkarnauk! The purpose of this PR is to migrate to the new API, which we are very excited to do. We need a bit more time to be able to prioritize finishing this, but plan to get to it very soon

null,
{ response ->
val responseObject = response as Map<*, *>
val completions = responseObject["content"] as List<*>
Copy link

Choose a reason for hiding this comment

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

Unsafe type casting of response content. The code assumes the content is List<> while other parts of the codebase (CoreMessengerManager.kt and IdeProtocolClient.kt) handle it as Map<, *>. This inconsistency will cause ClassCastException at runtime. Add type checking before casting and proper error handling.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

@recurseml
Copy link

recurseml bot commented Jun 13, 2025

😱 Found 1 issue. Time to roll up your sleeves! 😱

@coinzz
Copy link

coinzz commented Jul 18, 2025

@kkarnauk is the newest API version enabled by using platform and platformVersion set to 2023.3 and documented here?

@kkarnauk
Copy link

@coinzz I'd suggest to use the API starting from 2024.1. The one in 2023.3 has lots of deprecated methods/classes. They may be removed at some point of time (since almost 2 years already passed).

Unfortunately, there is no documentation on the IJ page. There are lots of KDocs in the code, though.

@coinzz
Copy link

coinzz commented Jul 24, 2025

Unfortunately, there is no documentation on the IJ page. There are lots of KDocs in the code, though.

@kkarnauk ah no worries, do you have a link to the current implementation with the KDocs for me then? I have scheduled a meeting with a colleague to take a look on that next friday 🙂

@kkarnauk
Copy link

kkarnauk commented Jul 24, 2025

@coinzz great to hear, thanks a lot for that!

Basically, you need to implement this interface.

A brief overview:

  • Implement isEnabled(event) to let the platform know whether your provider is applicable in the current context.
    • The implementation should be fast as it's called on EDT.
    • Usually, a provider is enabled on InlineCompletionEvent.DocumentChange (== a typing in an editor) and InlineCompletionEvent.DirectCall (== a user invokes the inline completion by shortcut).
    • There are also other built-in events. If you lack of the default events, please use InlineCompletionEvent.ManualCall.
    • If the completion of your plugin is disabled by some setting, please return false in this case. It's important to let other providers work in case your provider is unavailable.
  • Implement getSuggestion(request).
    • It is called on a background thread, so it may do some heavy stuff/internet access.
    • The result is basically a flow of some elements. If you need to render gray text, please use InlineCompletionGrayTextElement
    • There is InlineCompletionTextElement to provide colorful suggestions.
    • If you need to jump over a few symbols in the editor (e.g., a suggestion inserts text at several close offsets in the editor), please use InlineCompletionSkipTextElement.
    • Please do not create your own implementations of InlineCompletionElement. Otherwise, it would not work in the Remote Development setup.
  • If you need a custom handling when your suggestion is inserted into the editor, please override insertHandler.
  • A bonus. There is a native support for the Remote Development setup.

@coinzz
Copy link

coinzz commented Aug 5, 2025

I had some build problems which I figured out now. But @kkarnauk I still was not able to take a deeper look at your brief overview, because I still try to create a testable environment. So far I figured out:

  • I guess I need to use:
    • platformVersion=2024.3
    • key="ORG_GRADLE_PROJECT_platformVersion" value="2024.3.6"
    • I need to install the Jetbrains AI Plugin to test, since the Full Line Code Completion Plugin is an Ultimate Plugin (I did this manually in the sandbox env, because I was not able to add this plugin via gradle yet). Without any Inline Completion Plugin the settings look like this:
2024 3 6_no-plugin

When I start the intellij sandbox env with version 2024.2.6 and the AI Assistant Plugin I get this message:

2024 2 6

When I start the intellij sandbox env with version 2024.3.6 and the AI Assistant Plugin I get this message:

2024 3 6 Only this one is talking about "Built-in local inline completion", therfore I guessed that I need to update this far. But it could be only a textual issue as well? I guess the goal is as described in the ticket (#2061) to disable the "Enable Tab autocompletion" and then being able to enable "Enable cloud completion suggestions" on one of the screenshots. So which version do you think @kkarnauk ?

And @sestinj should I fork this branch and do a draft PR into this branch, because I guess I am not allowed to push directly here and this is your branch?

@RomneyDa
Copy link
Collaborator

RomneyDa commented Aug 6, 2025

Closing in favor of #6947

@RomneyDa RomneyDa closed this Aug 6, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PRs Aug 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2025
@sestinj sestinj deleted the nate/intellij-autocomplete-official-api branch October 17, 2025 22:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants