Logic Pilot - VSCode Extension
Logic Pilot is a VSCode extension that integrates AI-powered code generation directly into your TypeScript development workflow.
Features
- Configuration Management: Easy setup of API URL and authentication key
- Connection Testing: Verify your API connection with a simple test button
- Context Menu Integration: Right-click on selected TypeScript code to generate AI-powered code suggestions
- TypeScript Support: Works with both
.ts and .tsx files
Installation
From Source
- Clone or download the extension files
- Open the folder in VSCode
- Install dependencies:
npm install
- Compile the TypeScript:
npm run compile
- Press
F5 to launch a new Extension Development Host window
Package and Install
- Install vsce (Visual Studio Code Extension manager):
npm install -g vsce
- Package the extension:
vsce package
- Install the generated
.vsix file:
code --install-extension logic-pilot-1.0.0.vsix
Setup
- Open Command Palette (
Ctrl+Shift+P / Cmd+Shift+P )
- Run "Configure Logic Pilot"
- Enter your API URL and authentication key
- Click "Test Connection" to verify the setup
- Click "Save Configuration"
Usage
- Open a TypeScript file (
.ts or .tsx )
- Select the text you want to use as a prompt for code generation
- Right-click and select "Generate Code with Logic Pilot"
- The generated code will be inserted below your selected text
API Requirements
Your API endpoint should support:
- Ping endpoint:
GET /app/ping - Returns 200 status for connection testing
- Generate endpoint:
POST /prompt/generate - Accepts JSON with prompt field and returns JSON with code field
{
"code": "// Generated TypeScript code\nconst example = 'Hello World';"
}
Configuration
The extension stores configuration in VSCode settings:
logicPilot.apiUrl : Your API endpoint URL
logicPilot.authKey : Your authentication key
Commands
logicPilot.configure : Opens the configuration panel
logicPilot.generateCode : Generates code based on selected text (also available in context menu)
Development
Project Structure
├── package.json # Extension manifest
├── tsconfig.json # TypeScript configuration
├── src/
│ └── extension.ts # Main extension code
└── out/ # Compiled JavaScript output
Building
npm run compile # Compile TypeScript
npm run watch # Watch for changes and recompile
Troubleshooting
Common Issues
- "Logic Pilot is not configured": Run the configuration command and set up your API URL and auth key
- "Connection failed": Verify your API URL is correct and accessible
- "No code returned": Check that your API returns data in the expected format
- Context menu not appearing: Ensure you're in a TypeScript file and have text selected
Debug Mode
When running in debug mode (F5), check the Debug Console for detailed error messages and API responses.
License
MIT License - Feel free to modify and distribute as needed.
| |