Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>CodePro: Multi-Language Code GeneratorNew to Visual Studio Code? Get it now.

CodePro: Multi-Language Code Generator

Raja Mouli Ankireddy

|
65 installs
| (0) | Free
CodePro generates the quick prototype to speed up your workflow, it's user-friendly access make it the perfect solution for developers looking to save time and boost productivity. Give it a try and experience the power of automatic code generation today!
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

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:

  1. Go to https://platform.openai.com/account/api-keys. You will need to log in (or sign up) to your OpenAI account.
  2. Click "Create new secret key", and copy it.
  3. You should then paste it into VS Code extension workspace settings. Authentication
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
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft