🔹 ExplainLlama is a VS Code extension that automatically fixes Java code and provides clear explanations using AI.
🔹 Powered by CodeLlama and Google Colab, it connects with an ngrok-exposed FastAPI server to process Java code instantly!
✅ Fix Java Code - Automatically corrects syntax and logic errors.
✅ Explain Fixes - Generates human-readable explanations of the changes.
✅ AI-Powered - Uses CodeLlama and advanced LLMs for intelligent debugging.
✅ Easy Setup - Just update the ngrok URL and start fixing!
git clone https://github.com/SuwanSankaja/explainllama.git
cd explainllama
npm install
code .
Then, press F5
to launch the ExplainLlama Extension in a new window.
- Open Google Colab and create a new notebook.
- Copy & Paste the Server Code (provided below) into a Colab cell.
- Run the cell to start the FastAPI server.
- Copy the ngrok public URL from the output.
- **Update **
CODELLAMA_API_URL
inextension.js
with the new ngrok URL.
# Install dependencies
!pip install fastapi uvicorn transformers torch accelerate pyngrok nest_asyncio
# Run the FastAPI server
!python server.py
Since ngrok changes its URL every time you restart Colab, update this manually in extension.js
:
const CODELLAMA_API_URL = "https://your-latest-ngrok-url.ngrok-free.app"; // Replace with new URL
After updating, restart the extension (F5
in VS Code).
- Open any Java file (
.java
). - Select buggy Java code.
- Open Command Palette (
Ctrl + Shift + P
). - Run "Fix Java Bug with ExplainLlama".
- The extension will fix your Java code.
- It will show an explanation of the changes in a beautiful WebView.
Issue | Solution |
---|---|
❌ Error fetching ngrok URL |
Ensure the FastAPI server is running in Colab and update the ngrok URL in extension.js . |
🔄 Command not found in VS Code | Restart the extension using F5 in VS Code. |
🚫 API calls fail | Manually test the ngrok URL with: curl -X GET "https://your-ngrok-url/get_ngrok_url" |
- Fixed code & explanations are displayed in a styled WebView.
- Icons & colors enhance the user experience.
- Future updates will include syntax highlighting for the fixed code.
Developed with ❤️ by SuwanSankaja
🔗 Powered by OpenAI, CodeLlama, and Google Colab
Star the repo ⭐ if you found this useful!