continue
continue copied to clipboard
initial commit for InlineCompletionProvider
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!
Deploy Preview for continuedev canceled.
| Name | Link |
|---|---|
| Latest commit | a17d29a16755ab25a2fd064ccbf053e1be63e945 |
| Latest deploy log | https://app.netlify.com/sites/continuedev/deploys/680b228e0089a400081028d2 |
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.
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
😱 Found 1 issue. Time to roll up your sleeves! 😱
@kkarnauk is the newest API version enabled by using platform and platformVersion set to 2023.3 and documented here?
@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.
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 🙂
@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) andInlineCompletionEvent.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
falsein 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
InlineCompletionTextElementto 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.
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:
When I start the intellij sandbox env with version 2024.2.6 and the AI Assistant Plugin I get this message:
When I start the intellij sandbox env with version 2024.3.6 and the AI Assistant Plugin I get this message:
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?
Closing in favor of https://github.com/continuedev/continue/pull/6947