A powerful VS Code extension that provides AI-powered assistance for Perl development, featuring intelligent code suggestions, error detection, and context-aware recommendations.
- Comment-to-Code: Write comments starting with
#
and get intelligent code suggestions - Context-Aware Suggestions: Leverages your project structure, imports, and variable definitions for accurate code generation
- Smart Caching: Prevents duplicate requests for the same comments, improving performance
- Sidebar Integration: Select any code block to see alternative implementations in the sidebar
- Copy to Clipboard: One-click copying of suggested code alternatives
- Real-time Updates: Suggestions update automatically as you select different code blocks
- Real-time Analysis: Automatic error detection as you type with configurable debounce timing
- Visual Indicators: Errors are highlighted directly in your code with detailed descriptions
- AI-Powered: Uses advanced AI to detect logical and syntactical issues beyond traditional linting
- Project Structure Analysis: Automatically indexes your Perl codebase for better context
- Import Resolution: Tracks and resolves module imports and dependencies
- Variable Definition Tracking: Understands variable scope and definitions across files
- Symbol Usage Analysis: Identifies how symbols are used throughout your project
- LanceDB Integration: Uses LanceDB for high-performance vector storage and semantic search
- Embedding-Based Matching: Leverages MiniLM embeddings to find semantically similar code
- Intelligent Code Retrieval: Finds relevant code examples based on context and meaning, not just keywords
- Persistent Index: Maintains a persistent vector database for fast startup and consistent performance
-
Install the Extension
# Clone the repository git clone <repository-url> cd git_check/VsCodeExtension # Install dependencies npm install
-
Package the Extension
# Install vsce if you haven't already npm install -g vsce # Package the extension vsce package
-
Install in VS Code
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Click the "..." menu and select "Install from VSIX..."
- Select the generated
.vsix
file
This extension requires the Programming Assistant AI Bot backend server to be running:
# Start the backend server (typically on port 8000)
cd ../backend
python -m uvicorn main:app --reload
.pl
- Perl scripts.pm
- Perl modules.t
- Perl test files
Access settings through File > Preferences > Settings
and search for "Perl Code Generation":
Setting | Default | Description |
---|---|---|
perlCodeGeneration.relevantCodeCount |
3 |
Number of relevant code examples to retrieve for context |
perlCodeGeneration.indexOnStartup |
true |
Automatically index the Perl codebase when extension activates |
perlCodeGeneration.contextWindowSize |
15 |
Number of lines to consider around cursor for context |
perlCodeGeneration.useMemoryIndex |
true |
Use in-memory index instead of LanceDB for module resolution |
The extension uses LanceDB for vector-based semantic search to provide more intelligent code suggestions:
- Database Location: Stored in your system's temp directory under
perl-code-gen-lancedb
- Vector Dimensions: Uses 384-dimensional vectors (MiniLM-L6-v2 embeddings)
- Table Schema: Stores code content, file paths, titles, and vector embeddings
- Automatic Indexing: Builds vector index during workspace initialization
{
"perlCodeGeneration.relevantCodeCount": 5,
"perlCodeGeneration.indexOnStartup": true,
"perlCodeGeneration.contextWindowSize": 20,
"perlCodeGeneration.useMemoryIndex": false
}
Note: Set useMemoryIndex
to false
to enable LanceDB vector search for enhanced semantic code matching.
-
Write a Comment: Start any line with
#
followed by your description# Create a subroutine that validates email addresses
-
Get Suggestions: The extension will automatically generate code based on your comment
# Create a subroutine that validates email addresses sub validate_email { my ($email) = @_; return $email =~ /^[^\s@]+@[^\s@]+\.[^\s@]+$/; }
- Select Code: Highlight any block of Perl code
- View Sidebar: Check the "Perl Code Suggestions" panel in the sidebar
- Copy Alternatives: Click on any suggestion to copy it to your clipboard
- Automatic Detection: Errors are automatically detected as you type
- Visual Feedback: Problematic code is underlined with error descriptions
- Configurable Timing: Adjust detection sensitivity in settings
VsCodeExtension/
βββ extension.js # Main extension entry point
βββ package.json # Extension manifest and configuration
βββ sidebarprovider.js # Sidebar suggestions provider
βββ api/
β βββ api.js # Backend API communication
βββ collectors/ # Context and code analysis
β βββ contextCollector.js
β βββ definitionCollector.js
β βββ importDefinitionAnalyzer.js
β βββ perlImportAnalyzer.js
β βββ repoMapProvider.js
βββ commands/
β βββ commands.js # VS Code command implementations
βββ embeddings/
β βββ miniLmEmbeddings.js # MiniLM embedding generation
βββ indexers/ # Codebase indexing and search
β βββ codebaseIndexer.js
β βββ codeStructureIndex.js
β βββ vectorIndex.js # LanceDB vector operations
βββ parsers/
β βββ treeSitter.js # Tree-sitter parser integration
βββ utils/
β βββ checkErrors.js # Error detection utilities
β βββ debounce.js # Performance optimization
βββ test/
βββ extension.test.js # Unit tests
Access commands through the Command Palette (Ctrl+Shift+P):
Perl: Index Codebase
- Manually trigger codebase indexingPerl: Show Suggestions
- Display code suggestions panelPerl: debugName
- Debug module name resolutionPerl: debugImports
- Debug import analysis
- Indexing Progress: Progress notifications during codebase analysis
- Error Count: Status bar indicator showing detected errors
- Backend Connection: Visual feedback for backend server connectivity
-
Backend Connection Failed
Error: Backend server is not running
Solution: Ensure the backend server is running on
http://localhost:8000
-
No Code Suggestions
No specific code suggestions received from AI
Solution: Check that your selection contains valid Perl code and the backend is responding
-
Indexing Failed
Failed to initialize indexer
Solution: Ensure you have a workspace folder open with Perl files
-
LanceDB Connection Issues
Error initializing LanceDB
Solution: Check write permissions to temp directory and ensure sufficient disk space for vector database
Enable debug logging by checking the "Perl Code Generation" output channel:
View > Output > Perl Code Generation
npm test
# Install dependencies
npm install
# Run in development mode
# Press F5 in VS Code to launch Extension Development Host
# Lint code
npm run lint
# Package extension
vsce package
- VS Code: Version 1.60.0 or higher
- Node.js: Version 14.0 or higher
- Backend Server: Programming Assistant AI Bot backend running on port 8000
- LanceDB: For vector-based semantic search (automatically installed with extension)
- Perl: For testing and validation (optional)
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is part of the Programming Assistant AI Bot system. Please refer to the main project license for usage terms.
- Frontend Interface:
../frontend
- Web-based chat interface - Backend API:
../backend
- AI processing server - Documentation: Full project documentation