Inspiration
The idea for this project came from improving readability and maintainability, especially in large or messy codebases. There are linters out there for style, but they don't give deeper context or explanations. We wanted to make use of AI to include not just refactoring code but adding comments so that it is much clearer and easier to understand.
What it does
Our extension does code formatting with comments, making the structure and clarity of the code much better. Some key features include:
- Reformats code with standards depending on specific languages.
- Comments to explain code logic.
- Users may now select to utilize either the OpenAI, ClaudeAI, or Ollama AI assistant.
- Selective code formatting allows the user to reformat only blocks of code that they are working on, not necessarily an entire file.
How we built it
Writing this extension uses the language Typescript along with the VSCode API.
- AI Integration: OpenAI, ClaudeAI, and Ollama have been integrated for code formatting and commenting.
- Code Analysis: It leverages a little regex to find faults, and it does check for formatting issues with some basic syntax checking.
- UI: A brief explanation of how to enable the add-on, with animations for loading when the AI is working.
- API Calls: Ensuring to make the calls asynchronously while pulling formatted and commented code from AI services.
Challenges we ran into
- AI Integration: API calls and response parsing from various models were a bit fiddly. Consistent Formatting: The challenge was to make these AI suggestions work over many different languages.
- User Experience: The users find the AI formatting and comments useful but not overwhelming.
Accomplishments that we're proud of
- Multi-AI Support: Successfully integrated OpenAI, ClaudeAI and Ollama under one tool.
- Selective Formatting: The user can select certain blocks of code to be changed.
- Improved Readability of Code: Extension makes the code more readable and comprehensible.
What we learned
- AI for Code: The AI models can be very efficient in code understanding and add comments for context.
- VSCode API: This has boiled down to how to speak to the VSCode editor programmatically, perform manipulations of text and register commands. User Needs: The usability allows for flexibility in the use, such as block-level modification by the user.
What's next for VsCode Mama
- More AI Providers: Adding support to more AI models.
- Smarter Refactoring: Build more significant AI capabilities to refactor code, not just format it.
- Customization: Providing more user-configurable formatting style options.
Built With
- claudeai
- ollama
- openai
- visual-studio
Log in or sign up for Devpost to join the conversation.