Welcome to the Code Assistant plugin for Visual Studio Code! This powerful tool enhances your coding experience by providing a suite of features to assist with code refactoring, generation, evaluation, and more. With integrated chat capabilities, you can also interact directly with GPT for additional support and insights.
Features
Code Refactoring: Easily refactor your code by selecting a code block, right-clicking, and choosing the refactor option. Confirm your choice to have the refactored code overwrite the selected block.
Code Modification: Similar to refactoring, select the code you want to modify, choose the appropriate option from the context menu, and confirm to apply the changes directly to your code.
Code Generation: Generate new code snippets or complete functions. Generated code will be inserted at the current cursor position upon confirmation.
Unit Test Generation: Automatically generate unit tests for your existing code. The generated tests will be added to your project, helping you maintain robust and reliable code.
Code Evaluation: Evaluate and review your code quality. Get feedback and suggestions to improve your coding practices.
Chat with GPT: Use the integrated chatbox on the left side to interact with GPT. Ask questions, get coding advice, or request code examples directly within VSCode.
Installation
Download and Install: Search for "Code Assistant" in the VSCode Extensions Marketplace and install it.
Configure API Key:
Go to the VSCode settings (File > Preferences > Settings or press Ctrl+,).
Search for "Code Assistant API Key".
Enter your API key into the configuration field.
Restart Plugin:
Open the command palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
Type restart plugin and select the command to restart the Code Assistant plugin.
Usage
Code Refactoring/Modification:
Select the block of code you want to refactor or modify.
Right-click to open the context menu and choose the desired action.
Confirm the action to apply changes to the selected code.
Code Generation:
Place the cursor where you want the generated code to appear.
Open the context menu and select the code generation option.
Confirm to insert the generated code at the cursor position.
Unit Test Generation:
Select the code or function you want to generate tests for.
Open the context menu and choose the unit test generation option.
Review and confirm to add the generated tests to your project.
Chat with GPT:
Open the chatbox on the left side of the VSCode window.
Start typing your questions or requests and interact with GPT directly.
Configuration
API Key: Ensure you configure your API key as described in the Installation section.
Plugin Restart: Always restart the plugin after updating the API key to apply the changes.
Troubleshooting
Plugin Not Working: Ensure your API key is correctly configured and that you have restarted the plugin.
Code Not Refactored/Modified: Verify that you have selected the correct code block and confirmed the action.