Generate Code using AI in VS Code and Translate to Other Language

0 Comments
Editor Ratings:
User Ratings:
[Total: 0 Average: 0]




In this post, I will talk about a free and simple VS Code extension. CodeGeeX that allows you to generate code and even help you translate it into some other programming language. It is completely free to use and for now, it is a free open-source alternative to OpenAI Codex and GitHub Copilot. You can use it unlimited times and it supports multiple programming languages such as Python, C, C+, Rust, JavaScript, C#, and more.

CodeGeeX apart from code generation and translation, can also be used to generate code explanation as well. For now, only two IDEs are supported but, in the future, there will be support for more.

How to Generate Code using AI in VS Code and Translate to Other Language?

You simply start by installing CodeGeeX in VS Code editor. Search for it in the marketplace and then install it. After that, you can start using it right away. Unlike OpenAI and other AI code generators, it does not require any API key or registration.

CodeGeeX in Marketplace

Now, you open a new file and then add a comment explaining what code you want to generate. You can follow the commenting syntax for the programming language you are writing. For example, if you want to generate code for Python then use “#” in the beginning of the line to create comment. In the comment, explain what you want to generate with proper details. You can include function and variable names as well.

Define what code you want to generate

Press enter and then wait for a few seconds. It will highlight the code now. To add the generated code in the editor, just press tab.

CodeGeeX Generate Code using AI

There you have it. This way, you can now generate accurate code in VS Code. The code works perfectly. However, you must know it doesn’t always generate accurate code, sometimes, you may have to do a little tweaking to make it work.

CodeGeeX Code Generation in Action

Another thing you can do is translate a piece of code into other programming languages. So, just copy the code that you want to translate. Click on the icon of CodeGeeX from the sidebar and then the code converter will show up.

CodeGeeX Code Converter

Paste the code to convert. Set the source and target language from the dropdown now. Finally, click Translate and give it a few seconds. It will now convert your code into another language and will show it to you. You can copy this code and then use it anywhere you like.

CodeGeeX Code Converter in Action

This is how you can use CodeGeeX to generate code as well as convert it to another language. The process is very simple and it will definitely make the life of programmers very easy.

Closing thoughts:

Best part about CodeGeeX is you don’t need any API key or registration to use it. It is a free alternative to OpenAI’s Codex and GitHub Copilot. And not just VS Code but it works with JetBrains IDEs as well. So, if you are a JetBrains user then you can use it in pretty much the same way. As a demo, online version is available as well on its website that you can try.

Go to CodeGeex Website here: https://github.com/THUDM/CodeGeeX

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]
Free/Paid: Free

Leave A Reply

 

Get 100 GB FREE

Provide details to get this offer