Skip to main content

Chat User Guide

Copilot4Eclipse-Chat (Chat) brings GitHub Copilot's Chat features to the Eclipse platform. These features are powered by OpenAI's GPT-4 model specialized for the programming and devops domains. An operating context size of approximately 8,192 tokens, enables the model to consider a large portion of code or conversation at once, resulting in more relevant and contextually aware responses.

Chat is a good complement to Copilot4Eclipse's real-time code suggestions feature. It supports a wide range of productivity use-cases such as:

  • Assistance with frameworks, programming language features and best practices
  • Analyzing and explaining code
  • Recommending code fixes and simplifications
  • Generation of test cases and code documentation

Copilot4Eclipse Chat Overview

Learn more about about GitHub Copilot Chat.

1. Getting Started With Chat

Chat provides a friendly conversational user interface known as the Chat Panel and context-menu actions (right-click) for directly invoking Chat commands from within Eclipse editors and other views.

1.1 Opening the Chat Panel

To view the Chat Panel use the the Copilot4Eclipse main menu or the Statusbar menu to select the "Open Chat Panel" action.

You can also open the Chat Panel from the context-menu (right-click) in most Eclipse text editors.

2. Chat Panel Overview

The Chat Panel is where your conversation with Copilot takes place. The main components of the Chat Panel are the Message Area and the Prompt Panel. The general sequence of a Chat dialog follows:

  1. You submit questions and instruction to Chat in the form of free-form text or predefined commands through the Prompt Panel.
  2. Chat forwards the request to the GitHub Copilot agent which typically begins streaming a response back within 1-2 seconds of submission.
  3. As a Chat response is incrementally received it is accumulated segment by segment into a new message in the Message Area.

  1. Message Area - List of messages between the user and Copilot
  2. Prompt Panel - Area for entering questions and request to Chat
  3. Send Button - Button for submitting requests to Chat
  4. New Conversation - Create a new conversation and clear the message area
  5. Clear Messages - Remove all messages from Message Area while retaining the conversation context
  6. Add File References - Add files to the current Chat context

2.1 Asking Chat Questions (Prompting)

Let's talk about prompts and prompting Chat.

A "prompt" is the input that you give to a large language model (LLM) such as the one powering GitHub Copilot, which it uses to generate a response. For example, if you were to input the sentence,

Translate the the following JavaScript code in to Java code "let x = 'abc';"

into a language model, the entire sentence would be considered the prompt.

"Prompting" is the act of providing a prompt. In the context of language models, it's the process of designing and inputting prompts that effectively communicate the desired task to the model. Good prompting involves crafting prompts that are clear, concise, and unambiguous, to help the model generate the most accurate and useful output.

We use the Prompt Panel to create prompts in the form of questions, requests and instruction for Copilot Chat. We then prompt Chat by clicking the Send Button to transmit the prompt to Copilot Chat. A Chat response is returned as a stream which is incrementally updated in the Message Area.

2.1.1 Tips For Creating Effective Prompts

Creating effective prompts for GitHub Copilot or any AI model is an art. Here are some tips and best practices:

  1. Be Specific: The more specific your prompt, the more specific the response will be. If you're vague or ambiguous, the AI might not understand exactly what you're asking for.

  2. Provide Context: If your question relates to a specific piece of code or a specific programming concept, provide that context in your prompt. This can help the AI generate a more accurate response.

  3. Use Correct Terminology: Use the correct programming terminology in your prompts. This can help the AI understand your question better and provide a more accurate response.

  4. Ask for What You Want: If you want a piece of code, ask for it. If you want an explanation of a concept, ask for it. Be clear about what you're asking for.

  5. Experiment: If you're not getting the response you want, try rephrasing your prompt or asking your question in a different way. Different prompts can elicit different responses from the AI.

  6. Use Full Sentences: While it's not always necessary, using full sentences can sometimes help the AI understand your prompt better.

  7. Avoid Jargon: Unless it's necessary for your question, avoid using jargon in your prompts. This can make your question clearer and easier for the AI to understand.

  8. Keep It Short: Long, complex prompts can be harder for the AI to understand. Try to keep your prompts short and to the point.

Remember, creating effective prompts is a skill that can take some practice to develop. Don't be discouraged if your initial prompts don't get the responses you're hoping for. Keep experimenting and refining your prompts, and you'll get better over time.

2.1.1 Slash Commands

Chat provides a set of predefined commands known as slash commands that you use to prompte Chat. They are calls slash commands because the name of the command starts with a '/' character. You can view the available slash commands in the Prompt Panel by entering a '/' character or from Copilot4Eclipse context-menu within most Eclipse text editors.

2.2 Managing the Conversation Context

The context of a Chat conversation is all the information that Chat has about the conversation. It consists of your prompt history, Chat responses, user profile, IDE information, the active editor source code and selected text, project meta-info and any project files attached as references. This context helps Chat generate responses that are relevant and useful to your request.

You can add and remove file references to the context as well as delete previously executed prompts and their associated responses.

2.2.1 Deleting a Prompt

You can remove any user prompt and it's Chat response from a conversation by hovering over the user message you want to delete and clicking the 'X' button.

2.2.2 Adding a File Reference to the Chat Context

You can create as many file references for a Chat context as the Prompt Panel UI will support. Chat provides 2 mechanisms for adding an explicit file reference to the Chat context. The first is to use the "Add Reference File" button (+) in the Prompt Panel. The second approach is to use the context-menu action "Reference File(s) in Chat Panel" from an Eclipse editor, the Project Explorer or Package Explorer.

Adding a File Reference from the Prompt Panel

  1. Begin by clicking the (+) button on the Prompt Panel to open the File Selection dialog.
  2. Select 1 or more files followed by the OK button.
  3. The referenced files will appear near the bottom of the Prompt Panel.

Adding a File Reference from the Editor Context-Menu

From either the Project Explorer or Package Explorer select 1 or more files that you wish to add as references to the current Chat context. Then right-click to open the context-menu and select Copilot4Eclipse > Reference File(s) in the Chat Panel

You can also use a similar menu action from most Eclipse text editors to add the editor's input file to the Chat context.

2.2.3 Removing a File Reference

You can remove a file reference by clicking the 'X' next the references name in the Prompt Panel.

2.3 Providing Feedback - Rating a Chat Response

You can optionally provide Chat feedback by rating a response using the thumbs-up and thumbs-down buttons. This feedback helps improve future Chat accuracy.

2.4 Creating a new Conversation

When you open the Chat Panel a new conversation is created. If at any point of using the Chat Panel you wish to abandon the current conversation and create a new one, click the '+' button on Chat Panel's toolbar area.

2.5 Clearing Messages

If the Message Area becomes cluttered you can quickly remove all messages without affecting the conversation and context. Select the "Clear Messages" button on the Chat Panel toolbar.