Getting Started with Codebuddy - JetBrains Plugin

Getting Started

Welcome to the exciting world of AI-enhanced coding with Codebuddy! This blog post will guide you through the initial steps of using Codebuddy and help you understand how to unlock its full potential.

If you haven't already installed the Jetbrains plugin, please do so by going to the Codebuddy Jetbrains Plugin Page and installing the plugin into any Jetbrains IDE.

Authentication

Once installed, you will see the Codebuddy icon on the left or right side of the IDE.

Screenshot of Codebuddy icon

You can click there to open the Codebuddy AI panel. You will need to login to your Codebuddy account before you can start using it. Simply click anywhere on the Codebuddy panel to start that process. It's a very quick and easy process if you already have a Github account. If not, create a Github account and continue this process.

Keep in mind that your IDE will need to be fully indexed before anything displays on the Codebuddy panel, even after you've authenticated successfully.

Understanding how Codebuddy works

Codebuddy is an AI-powered coding tool designed to assist you in your software development journey. It can make sweeping, multi-tiered changes across your existing projects, create new files, and even engage in a detailed conversation about your code. It excels at multi-file changes. It is important to understand however that you control the context of each message you send to Codebuddy. You select which files to include, whether or not to include the filesystem directory and files listing (filetree), and you control how much chat history Codebuddy sees with each message through conversation controls.

Including files as context

By default, any files you have open in your editor will be included as context. You can see the list of files that will be sent along at the bottom of the Codebuddy panel when it's open. We recommend using this approach as part of your workflow. You can also include library dependencies, however they may not be included by default. Instead you'd have to check the checkbox at the top of the file to "Select for Codebuddy". This will force the file to be included, even if the file isn't open or not part of your project. Generally files that are not part of your project will not be included automatically as context simply by being open.

Including the filetree structure

By default, this is unchecked. You can find the option by clicking on the gear icon beside the Codebase checkbox. This opens an "advanced" panel for extra options. It can sometimes be beneficial to include the filetree listing as part of your prompt, just to give Codebuddy an idea of your existing file tree and directory structure for your project. However some projects are going to be very large and you may run into issues with context memory if this is checked for large projects. In many cases you also don't need this option, so it is necessary only on a case-by-case basis.

Codebase understanding

Codebuddy includes a Codebase checkbox, which is enabled by default when you first start using Codebuddy. This feature will generate a vector database of your entire repository and then attempt to select the most appropriate files based on your prompt, automatically. The feature works well especially when you're not familiar with the repository/codebase you're working on, HOWEVER it does add significant delays when processing your prompt and it is not recommended for use when you already have the necessary files open. As with all AI features, you also cannot trust it to be comprehensive. AI in general is not very good at creating exhaustive lists of things and instead excel at finding that "needle in a haystack". So you can't really ask it to "select all the files associated with x" and we don't recommend attempting this.

However it is great at answering questions like "how does authentication work in this project". For this it will automatically choose any files that relate to authentication to include in the prompt and then try to answer your question based on the files it thought were good candidates.

Projects with a lot of files will take some time to index the entire repository. If you have the Codebase checkbox checked, then your prompt will be processed once indexing is complete. If you don't need the Codebase feature then simply unchecking it will allow you to use the system even while indexing is still ongoing.

Multi-file changes automatically with the best LLMs available

Codebuddy is based on OpenAI and Anthropic LLMs and supports many different models, with new models being included as they are released by companies around the world. Rather than copying files into a ChatGPT prompt, you can simply open files to include them into your prompt, and/or use the Filetree checkbox to include the file and folder structure as part of your prompt. Codebuddy is much more than that however as it is also capable of applying code changes directly to your files as you discussed them with the AI.

Easily manage and maximize context memory

This is the context space dial. It tells you how much context memory space is available for you to fill with your prompt. Each time you speak with the AI, your prompt/message (including any files, previous conversation, and other inclusions) must fit within the context space of a single request to the LLM (like Sonnet or GPT4o). This dial helps you to maintain control over that. Screenshot of the context space dial Codebuddy relies on the context you provide to understand your project, which is done by opening files or checking the "Filetree" checkbox. When creating new files it can sometimes be beneficial to select the Filetree checkbox to include the filesystem directory structure with your prompt, which will help to inform the AI where new files should go. It is often not necessary to do this if you have a lot of files open already however, since it is able to infer the directory structure based on those file's paths. Please note that in the Jetbrains plugin, only the folders expanded in the left panel will be included. This feature helps you control the usage of your context memory. The context memory dial in the bottom-left corner of the screen indicates how much of your context memory you are using. If it's too much, you can reduce the amount of context memory left for your prompt and Codebuddy's response by unchecking files, removing messages in your conversation, starting a new conversation, or unchecking the filetree checkbox. The context dial tells you how much context memory your prompt is going to use but make sure you leave some space for Codebuddy's reply!

Don't include so much chat history, it's bad for you

We attempt to organize your conversations with Codebuddy in a smart way so you never include too much chat history with each change. When Codebuddy responds with file code changes, it assumes that the conversation is complete. However, you can continue from where you left off by using the Reply button on a message. This will ensure that your next message will be part of the same conversation and the entire conversation will be included with your prompt as context. This is not recommended however! It's better to let the code be the reference the AI needs to complete the task rather than relying on past conversations. Sticking with the same conversation can confuse the AI with multiple code changes being mixed in with the original files, and it also boxes the AI into a focused line of thinking when it's usually better to be more open minded.

Blank projects should start with a directory structure discussion

If you're starting a new project from scratch, Codebuddy won't know what directory structure to use unless you discuss it with the AI. This conversation is crucial to set up the basic structure of your new project. Starting a new project from scratch can sometimes be a challenge because there is nothing for Codebuddy to reference. For certain types of projects, like ones that use React, it might be best to use a tool like Create React App instead of getting Codebuddy to generate a new app for you from scratch. However, for smaller and simpler projects like Python projects or simple JavaScript components, you can start from scratch using Codebuddy. Just ensure to discuss the directory structure with Codebuddy first.

Use code references, and allow Codebuddy to generate and/or edit multiple files at once

Codebuddy is capable of making sweeping multi-tiered changes across an existing project. You can select UI components, services, controllers, and files that make up your project's views (like HTML, JavaScript, etc.) and ask Codebuddy to implement a feature that touches each file. All changes are applied to the files automatically, including the creation of new files. Codebuddy excels at creating new files from scratch or using reference files that exist in your project already. However, at the very least you will need to let Codebuddy know about your directory structure. You can do this by selecting the "Filetree" checkbox. This checkbox will include all of the files and folders that are currently expanded in the Project Hierarchy panel in your project. Only folders that have been expanded will be included in the filesystem. We do it this way so that you can control how much context space is being used since some projects may have thousands of files and folders and this would quickly overflow the context memory size constraints. Screenshot of the Filetree checkbox If you're starting a new project from nothing, simply discuss with Codebuddy the basic directory tree layout first before creating new files, or you'll have to rely on what it thinks is the most common directory layout for a project like yours.

Additional Features

Voice Input Capability

We're excited to introduce the Voice Input feature to Codebuddy's JetBrains plugin. This innovative feature allows you to communicate with Codebuddy using your voice, making the experience hands-free and more natural. By speaking directly to Codebuddy, you can express your ideas more thoroughly, which can significantly enhance the code generation process. The feature is especially useful when you find yourself explaining coding problems out loud, as it allows for clearer and more diverse expressions of your needs.

To activate Voice Input, use the default keyboard shortcut CTRL + Windows Key (or the equivalent on a Mac). Alternatively, you can click on the Codebuddy icon labeled "Ready" in the status bar at the bottom of the IDE to start speaking.

Personally I recommend rebinding the voice input to F12 for the regular voice input, and CTRL + F12 for the "Chat Only" variation of the voice input. This keybinding is usually already used for something, but usually something that isn't commonly used.

Voice input feature screenshot

Web Page Prompt Inclusions

The Web Page Prompt Inclusions feature is another exciting addition to the Codebuddy JetBrains plugin. With this feature, you can incorporate the content of any web page directly into your conversation with Codebuddy. Simply paste the URL of the web page - whether it's a blog post, online documentation, or a tutorial - and Codebuddy will convert it into a text document. This text becomes part of your prompt, allowing you to ask Codebuddy to implement the functionality described on the page or to discuss its content in depth, enriching your coding experience.

Click here to download the Codebuddy Chrome extension

Web page prompt inclusions feature screenshot

Codebuddy's Additional Editor Features

In addition to the usual workflow of talking to Codebuddy about your files and making code changes through the main panel, there are 2 other handy features that you will certainly make use of periodically.

Right-click context menu

Explain This

Select a section of code in the editor, right-click on it and go to Codebuddy -> Explain This. You will be prompted to ask a question about this specific area of the code. Your selected code snippet will be included along with your question in the usual conversational workflow, which makes it easier to target specific parts of your code without having to explain to Codebuddy where you're referring to. This can also be handy for files that are too large for the AI context memory size.

Quick Recode

This feature will prompt you to state what you wish to change about the selected code snippet. This unique feature will not enter into the usual Codebuddy conversational workflow and instead will execute your request immediately and quickly. This also means that none of the selected files will be included in your Quick Recode prompt. This feature is useful when the change you wish to make does not rely on any other parts of the code, usually for simple syntax or code structure changes. It's meant to be a quick alternative for syntactic changes.

Quick recode feature screenshot

You might also like...

Getting Started with Codebuddy - JetBrains Plugin