Skip to content

rruusu/code-intelligence

 
 

Repository files navigation

Code Intelligence

This Eclipse plugin enhances the Java Development Tools (JDT) with AI code completion and reasoning in a chat view.

Installation

The update site is hosted on https://chabicht.github.io/code-intelligence/update-site/.

In Eclipse, open Help -> Install New Software....
In the dialog, click on Add... and enter the new repository information. For Location, use the URL above.

Screenshot: Add Repository

Make sure the "Contact all update sites" box is checked, some dependencies are hosted in the update site of your Eclipse distribution.

Usage

Completion

The completion feature is integrated in the JDT completion proposal mechanism.
So when you invoke it by e.g. pressing Ctrl + Space, an AI completion is triggered by default.

Screenshot: invocation of the plugin

What also works really well is adding a // TODO comment above where you want an ai completion.

Screenshot: invocation of the plugin with a TODO comment

Chat

You can open a (for now rudimentary) chat view. Go to Window -> Show View -> Other... and select the Code Intelligence Chat view.

Screenshot: Show chat view

Screenshot: Example of the chat view.

Adding context information

If you select text in a Java editor, that selection is added automatically to the context of the next chat message.
Screenshot: Selection as context
Screenshot: Selection as context

You also can right-click on several Java code items such as files, classes, fields, search results, etc.
Screenshot: Adding search results as context

It's important to be careful with the amount of context you add. Depending on the model used too much information can easily overwhelm the model or become expensive in terms of API fees.

Configuration

Open the preferences: Window -> Preferences -> Code Intelligence.

Screenshot: Plugin configuration page

Here you can add connections to different API providers and configure the model you want to use for code completion and chat requests.

Ollama connection settings

Screenshot: Ollama configuration

  • Use Type Ollama.
  • For the Base URI, use the host and port your Ollama instance is running.
    Default is http://localhost:11434.
  • Usually you don't need an API key.

OpenAI connection settings

Screenshot: OpenAI configuration

  • Use Type OpenAI.
  • For the Base URI, use https://api.openai.com/v1.
  • You have to create an API key in the OpenAI Platform settings.
    Note: This doesn't work with a ChatGPT subscription. You need to set up API access.
    For a tutorial, cf. e.g. this video on YouTube.

Groq.com connection settings

Screenshot: Groq configuration

  • Use Type OpenAI.
  • For the Base URI, use https://api.groq.com/openai/v1.
  • You have to create an API key in the Groq playground.

Gemini connection settings

Screenshot: Gemini configuration

  • Use Type Gemini.
  • For the Base URI, use https://generativelanguage.googleapis.com/v1beta.
  • You have to create an API key in the Google AI Studio settings.

Anthropic connection settings

Screenshot: Anthropic configuration

  • Use Type Anthropic.
  • For the Base URI, use https://api.anthropic.com/v1.
  • You have to create an API key in the Anthropic Console settings.

X.ai/Grok connection settings

Screenshot: X.ai configuration

  • Use Type X.ai.
  • For the Base URI, use https://api.x.ai/v1.
  • You have to create an API key in the X.ai Console settings.

DeepSeek connection settings

Screenshot: DeepSeek configuration

  • Use Type OpenAI.
  • For the Base URI, use https://api.deepseek.com.
  • You have to create an API key in the DeepSeek platform.

Model selection

The model is identified by [Connection Name]/[Model ID], so assuming your OpenAI connection was named OpenAI, to use GPT-4o-Mini, you would enter OpenAI/gpt-4o-mini.

Clicking on Change... opens a dialog where you can select a model from the enabled connections.

Prompt Templates

For an intro to writing custom prompts, see PROMPT-TEMPLATES.md.

Customizing code completion behaviour

By default the an AI request happens when a code completion is triggered.

You can change that behaviour in the settings under Java -> Editor -> Content Assist -> Advanced.

Screenshot: content assist configuration

  • If Code Intelligence is selected in the 'default' section, it is called every time a completion is triggered.
  • If Code Intelligence is selected in the cycling section, it is triggered when you cycle through the different proposal kinds.

About

Eclipse plugin that enhances the Java Development Tools (JDT) with AI powered productivity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 88.8%
  • HTML 10.0%
  • CSS 1.2%