GitHub Copilot – AI Coding Assistance Tool

Martin Čajka / 09.01.2024

Since the release of ChatGPT, artificial intelligence has become the hottest topic of 2023 not only amongst technically skilled people, but also the whole public became almost obsessed with possibilities that AI offers. It’s almost certain that this demand for AI and investments in this area will continue in forthcoming years on a major level.

And one of the biggest questions this advent of artificial intelligence brought for people in the IT industry is: “Will we be replaced by AI eventually?” The answer is yet unclear, but in the next few years, AI will be here to mainly help and support software developers, QAs, DevOps, and people in other industry related positions. It already does so by AI coding assistants and AI code completion tools. Many tools have been released so far, but today we’ll have a look on one of the most well-known tool in this area called GitHub Copilot.

What is GitHub Copilot

GitHub Copilot is built on OpenAI Codex that is built on top of GPT-3. It is trained on all publicly available GitHub repositories, and it has support for all the languages used on GitHub. Of course, the best support and best code completions are for languages that are mostly used in GitHub repos such as JavaScript, Python, C#, Java, etc. It supports the following IDEs – Visual Studio Code, Visual Studio, all JetBrains IDEs, Neovim. Currently the best plugins are available for VS Code, where also some experimental features are already available for users. GitHub Copilot is a paid tool, but it offers a 30-day trial period, which is sufficient for deciding if you want to pay for it or not.

Right now, Copilot offers following main functionalities:

  • Code completion
  • Code generation based on comment
  • Generating more code snippets alternatives to choose from
  • Asking questions directly in code using comments (no need to search using browser)

Engineers at GitHub are already working on further releases of Copilot and other AI tools that will make development more efficient. This whole initiative is called GitHub Copilot X and it will bring following features:

  • More coding support in different areas
  • Based on GPT-4
  • Voice coding – writing code using voice commands
  • Copilot docs – provide docs/tutorials directly in IDE (no need to switch to browser to look for information)
  • Pull Request descriptions – tool writes pool requests comments by tracking your work
  • CLI – assistant for CLI
  • Creates unit tests, explain code, translate to another programming language… – already present in GitHub Copilot labs extension in VS Code)

Let’s see how it works!

In the following section you will find a few examples with video sessions showing how GitHub Copilot can help you during the development process.

1. Copilot helping with code completions, understanding and completing patterns, providing implementation based on class, method, field names.

GitHub Copilot – code generation based on class, methods and fields naming.mp4

2. Writing regex based on definition provided as comment.  

GitHub Copilot – Regex.mp4

3. Answering questions using comments.

GitHub Copilot – answering questions.mp4

4. Help in real test driven development (TDD) – based on test GitHub Copilot can provide you with actual implementation.

GitHub Copilot – TDD.mp4

5. Learning new programming language concepts.

GitHub Copilot – learning new programming language.mp4

Pros and cons:

+ Writing boilerplate code (define what you want and let copilot finish it).

+ Speed up your development especially in case of repeating patterns in your code base (copilot is quite good at learning from code you have already written.

+ Good companion on diving into a new programming language if you have already good programming experiences in another language (can let a copilot explain and show new syntax, and features of another language). Also good for refreshing concepts, or preparation for job interviews.

+ It’s way of how software will be developed in next years.

+ It’s fun 🙂

– It’s not a suitable tool for complete beginners in software development, as without at least basic understanding of programming concepts, spending time with Copilot would be inefficient (going through some tutorials is a better option)

Sometimes it produces buggy, inefficient code or completely useless suggestions (hopefully gets better in further iterations)

Martin Čajka

I’m a QA guy with a strong focus on both frontend and backend test automation, and with passion for digging into new technologies and figuring out how AI can support us in what we do. Beside ones and zeros I love enjoying nature in all its forms.

Share:

Stay tuned

Be among the first who get to know the latest developments, innovations, & trends.