This extension for Visual Studio Code (VSCode) integrates with the OpenAI API to provide various code-related functionalities using the GPT-3.5 Turbo model. It allows you to leverage the power of OpenAI to enhance your coding experience.
Code Completion: Get code completion suggestions based on the selected code. The extension generates the next line of code or offers suggestions for completing a code snippet.
Code Summarization: Summarize the selected code by generating a brief description or explanation of its functionality.
Documentation Generation: Generate documentation for the selected code, including descriptions, usage examples, and other relevant information.
Code Refactoring: Get suggestions for refactoring the selected code, such as renaming variables or functions, improving code structure, or optimizing performance.
Error Handling: Receive suggestions for handling specific error scenarios or code snippets to catch and handle exceptions.
OpenAI API Key: Before using this extension, make sure you have a valid OpenAI API key. Visit the OpenAI website (https://www.openai.com) to get an API key if you don't have one already.
Install the extension in VSCode.
Set your OpenAI API key by replacing 'YOUR_OPENAI_API_KEY' in the code with your actual API key.
Open a code file in VSCode.
Select the code you want to perform a specific action on.
Use the following commands from the command palette or the VSCode menu:
Codr - Code Completion: Call OpenAI to get code completion suggestions for the selected code. (Shortcut: ctrl/cmd + alt + p)
Codr - Code Summarization: Summarize the selected code by generating a brief description.(Shortcut: ctrl/cmd + alt + s)
Codr - Code Documentation: Generate documentation for the selected code.(Shortcut: ctrl/cmd + alt + t)
Codr - Refractor Code: Get suggestions for refactoring the selected code.(Shortcut: ctrl/cmd + alt + f)
Codr - Error Handling: Receive suggestions for error handling.(Shortcut: ctrl/cmd + alt + e)
The results will be displayed as information messages in VSCode.