What is Codium AI

Codium AI has 2 flavors. One is a plugin for Visual studio code and the Jetbrains IDEs, the other is a Pull request helper for GitHub Bitbucket and Gitlab. The first flavor is a code completion tool that uses AI to help you write code. The second flavor is a tool that can help you with managing pull requests.

Both tools use generative AI to help you write better code, and to find bugs in your code. It can also help you find code smells and to improve your code quality.

The plugin

The main focus of the IDE plugin is automated testing. You can use CodiumAI to generate tests for your code. Besides, that is also has a chat feature and an advice feature. The chat feature can be used to ask questions about your code, and the advice feature will give you pointers on how to improve the quality of your code.

Installation

To install the plugin, you can go to the marketplace of your IDE and search for CodiumAI, install the plugin, and you are ready to go.

Chat functionality

The chat functionality can be used to ask questions to CodiumAI. You can ask questions about your code, and it will try to answer them. You can also use commands to make it perform tasks for you on the current file or selection of code.

The chat-bot itself is not the fastest, but it can be useful. the main reason that it is slow is that it waits for the complete answer from the AI before it shows the answer to you. This can take some time, but it is not a big issue.

It does provide valid answers with more context then just a code example. In the example below, I asked CodiumAI how I can improve the error handling of a function in my code. It gave me a valid answer with some context.

The context that you can provide to the chatbot is limited to the current file or the current selection of code. It can not be used to ask questions about other parts of your codebase.

It can also be used to ask more complex questions. For example, I asked CodiumAI to create me a EF query. the answer assumed some things about my code, but it was a valid answer.

The code that it generated was not perfect, but it was a good start. I could use it to improve my code.

using System;
using System.Linq;
using System.Threading.Tasks;
using ModularMonolith.Entities.Database;

public class ReportService
{
    private readonly ReadOnlyDbContext _context;

    public ReportService(ReadOnlyDbContext context)
    {
        _context = context;
    }

    public async Task GetVisitsReport(DateTime startDate, DateTime endDate)
    {
        var report = await _context.DbSet<Visit>()
            .Where(v => v.Date >= startDate && v.Date <= endDate)
            .GroupBy(v => new
            {
                CompanyId = v.CompanyId,
                Quarter = (v.Date.Month - 1) / 3 + 1,
                Year = v.Date.Year
            })
            .Select(group => new
            {
                CompanyId = group.Key.CompanyId,
                Quarter = group.Key.Quarter,
                Year = group.Key.Year,
                VisitCount = group.Count()
            })
            .ToListAsync();

        // Here you can process the report variable to display or use as needed
    }
}

Testing

The testing feature is the most interesting feature of CodiumAI. It can generate tests for your code. While generating the tests it will look for edge cases and generate tests for those as well. This is a very handy feature. It can help you locate possible blind spots in your code. You can configure the tests that it generates. You can set the test framework that you want to use, and you can set the nr of tests that you want to generate. You can also provide example test code to help the AI to generate the tests.

As you can see below, the tool searches for the happy path, and for some edge cases. It will generate tests for those cases as well.

After the tests are generated, you can review them, and you can run them. You can also edit the tests to your needs. You can add more tests, or you can remove tests that are not needed. The tool also provides you with some recommendations on how to improve the quality of your tests.

coduim-test-suggestions.png

Conclusion

The plugin is a handy tool. It can help you to write better code, and to find bugs in your code. It can also help you find code smells and to improve your code quality. The chat functionality is a nice feature, but it is not the fastest. The testing feature is the most interesting feature of CodiumAI. It can generate tests for your code. While generating the tests it will look for edge cases and generate tests for those as well. This is a very handy feature. It can help you locate possible blind spots in your code.

Share the Post:

Related Posts

Gen AI

Phind

What is Phind Phind is an online search engine that uses AI to help you find the information you need.

Read More