Vibe Coding - Using Gemini Code Assist



Gemini Code Assist is a very useful tool for developers. It can be directly integrated with existing IDEs like VS Code, JetBrains etc. Once installed, developer can use Gemini Code Assist as a pair programmer. Gemini Code Assist helps developers to work faster in their existing project within same IDE.

Step 1: Generating Code within Existing File

Open an existing project. Open a file and in Gemini Chat Window, mention the function or code you want to write. Gemini AI will create the required code and insert the same in the existing code.

For example, set following prompt −

Write a Java function to read a CSV file and get a list of values from email column. 

Step 2: Refine Existing Code

Gemini Code Assist can improve existing code to great extent. Just highlight the code you want to improve and use follow-up prompts to improve the code. For example, add error handling, improve performance, or refactor the code.

For example, set following prompt −

Add an optional parameter filter, to get filtered values of particular domain from email column . Add error handling code if file is not readable.

Step 3:Generate Unit Tests

Writing unit test cases is often the most time consuming activity of developers. Gemini Code Assist can create unit test cases as well within seconds after analyzing the code. It ensures that code is production ready.

Write Unit test cases of above function using JUnit. One test for successfully read of all emails, one which filters the emails of particular domain and one for file permission not present.
Advertisements