CodeBuddy is a powerful Visual Studio Code extension that integrates various generative AI models to enhance your coding workflow and productivity.
This extension provides a wide range of AI-powered features to assist developers in their daily coding tasks, from code generation and refactoring and to unit test creation.
https://marketplace.visualstudio.com/items?itemName=fiatinnovations.ola-code-buddy
- Local codebase indexing. Perform retrieval-augmented generation (RAG) on the codebase.
- Context Pinning. Pin directories, and files, (functions, classes, etc.) as persistent context. AI Models to reference these items for every suggestion, across Chat and Commands.
- Persistent Context. AI model to use certain context throughout a conversation and across different conversations by configuring the Context.
- Create Code base Documentation.
- Orchestrator. Coordinate AI model activities with Agent capabilities, through tools and function calling.
- Access to real-time data.
- Support for local LLMs such as Ollama
- Code search. Search code across the entire codebase
.
├── src/
│ ├── events/
│ ├── providers/
│ ├── services/
│ ├── test/
│ ├── webview/
│ ├── constant.ts
│ ├── extension.ts
│ └── utils.ts
├── CHANGELOG.md
├── CONTRIBUTING.md
├── package.json
├── README.md
└── tsconfig.json
Key Files:
src/extension.ts
: Main entry point for the extensionsrc/events/
: Contains event handlers for various CodeBuddy featuressrc/providers/
: Implements providers for different AI models and webviewssrc/services/
: Contains service classes for chat management and AI model integrationpackage.json
: Defines extension metadata, dependencies, and configuration
- Ensure you have Visual Studio Code version 1.78.0 or higher installed.
- Install the CodeBuddy extension from the Visual Studio Code Marketplace.
- Open VS Code settings (File > Preferences > Settings).
- Search for "CodeBuddy" in the settings search bar.
- Configure the following settings:
- Select the Generative AI model (Gemini, Groq, Anthropic, or XGrok)
- Enter the API key for your chosen model
- Choose your preferred font family and chat view theme
- Open a JavaScript or TypeScript file in VS Code.
- Right-click on selected code to access CodeBuddy features in the context menu.
- Use the CodeBuddy panel in the Activity Bar to access the chat interface.
- Code Comments: Generate meaningful comments for your code.
- Code Review: Get AI-powered code reviews and suggestions.
- Code Refactoring: Automatically refactor selected code.
- Code Optimization: Optimize your code for better performance.
- Code Explanation: Get detailed explanations of complex code snippets.
- Unit Test Generation: Automatically generate unit tests for your code.
- Commit Message Generation: Create meaningful commit messages based on your changes.
- Interview Question Generation: Generate interview questions based on your code.
- Code Chart Generation: Create visual representations of your code structure.
-
Generate comments for a complex function:
- Select the function in your code editor.
- Right-click and choose "CodeBuddy. Add comment to selected code."
-
Get a code review:
- Select a block of code or an entire file.
- Right-click and select "CodeBuddy. Review these selected code."
-
Generate a unit test:
- Select the function or class you want to test.
- Right-click and choose "CodeBuddy. Generate Unit Test."
-
Ask CodeBuddy a question:
- Open the CodeBuddy chat panel from the Activity Bar.
- Type your question and press Enter.
-
API Key Issues:
- Problem: "Failed to generate content" error message.
- Solution: Double-check your API key in the CodeBuddy settings.
-
Model Selection:
- Problem: Features not working as expected.
- Solution: Ensure you've selected the correct AI model in the settings.
-
Performance Issues:
- Problem: Slow response times from CodeBuddy.
- Solution: Check your internet connection and consider switching to a faster AI model.
To enable debug mode:
- Open the Output panel in VS Code (View > Output).
- Select "CodeBuddy" from the dropdown menu.
- Look for debug information and error messages in the output.
When a user interacts with CodeBuddy, the following data flow occurs:
- User Input: The user selects code or enters a query in the CodeBuddy chat panel.
- Extension Processing: The
extension.ts
file handles the user's action and routes it to the appropriate event handler in theevents/
directory. - AI Model Integration: The selected AI model (Gemini, Groq, Anthropic, or XGrok) is invoked through the corresponding provider in the
providers/
directory. - API Request: The provider sends a request to the AI service's API with the user's input and any necessary context.
- Response Processing: The AI service's response is received and processed by the provider.
- User Interface Update: The processed response is sent back to the user interface, either updating the code editor or the chat panel.
[User Input] -> [Extension] -> [Event Handler] -> [AI Provider] -> [AI API]
|
[User Interface] <- [Extension] <- [Event Handler] <- [AI Provider] <-'
Note: The chat history and other session data are managed by the ChatManager
service to maintain context across interactions.
N/A - This is a Visual Studio Code extension and does not require separate deployment.
N/A - This project does not have a dedicated infrastructure stack.