Introduction
CodePro: The Multi-Language Code Generator, that can automatically generates code based on a plain text.
what CodePro can do for me?
Yes, you read it right, CodePro can automatically generates code based on a plain text in a single click. You can generate code in any language of your choice, including C#, python, javascript, typescript, html and many more. Simply open a file, type your requirement in plain text and click Ctrl + Enter to Generate code. Magic happens, and you get see the code in your editor. Review the code and validate.
Authentication
The pre-requisite for the code generation is an OpenAI API key. This is used by the extension to access the API and is only sent to OpenAI. Codex is currently free, so does not use up any credits on your account.
To find your OpenAI API key:
- Go to https://platform.openai.com/account/api-keys. You will need to log in (or sign up) to your OpenAI account.
- Click "Create new secret key", and copy it.
- You should then paste it into VS Code extension workspace settings.

Trigger |
Action |
Description |
ctrl + enter |
Generate code |
Generate code based on plain text |
alt + enter |
Optimize code |
Optimize code for a selected piece of code |
shift + ctrl + g |
Generate unit test code |
Generate unittest code for selected peice of code |
Note: if your plain text is multiline, then select the enter text and use ctrl + enter to generate code for complete query
get all files in the folder
open each file
print the first line of each file
Handle exceptions
import os
# Path to the folder containing the files
path = 'C:/files/'
# Get all files in the folder
files = os.listdir(path)
# Iterate over each file in the folder
for file in files:
# Open each file and print its first line
try:
with open(os.path.join(path, file)) as f:
print(f.readline())
except Exception as e:
print('Error occured while reading file', e)
Disclimer
OpenAI is evolving, it generates the code that is syntactically correct but probably does not meet the intended functionality. As a result, it's always recommended to thoroughly review, modify and test the generated code before git commit.
Version History
Version |
Improvements |
Description |
0.1.5 |
Power-packed functionality |
Generate documentation, and code review comments |
0.1.4 |
Started consuming MS OpenAI |
Removed all the references of OpenAI and started consuming the MS Open AI |
0.1.3 |
Refactored code |
No end user impact, just refacted some code snippets |
0.1.2 |
Chunked responses |
End users need not wait for the full response, they start see chunks instantly loading on their editors |
0.1.1 |
Optimize Code, Generate unit test code |
Optimize code for a selected piece of code, Generate unittest code for selected peice of code |