AI LSP
An AI-powered Language Server that provides intelligent semantic code analysis beyond what traditional LSPs can detect. Built with modern Python tools and designed to integrate seamlessly with any LSP-compatible editor.
What It Does
AI LSP focuses exclusively on semantic issues that require deep understanding:
- Logic errors in algorithms and business logic
- Subtle race conditions and concurrency issues
- Architectural problems and design pattern violations
- Security vulnerabilities requiring context understanding
- Performance anti-patterns needing semantic analysis
- Complex data flow issues
- Domain-specific best practice violations
- Accessibility issues requiring UX understanding
What it doesn't do: Traditional LSP tasks like syntax errors, type errors, undefined variables, or basic formatting - your regular LSP handles those perfectly.
Features
- 🧠 AI-Powered Analysis: Uses advanced language models for semantic code understanding
- ⚡ Debounced Analysis: Smart delays prevent AI spam during rapid typing
- 🔧 Code Actions: Provides automated fixes for detected issues
- 🎯 Multi-Language: Supports Python, JavaScript, TypeScript, Rust, Go, Java, C/C++, and Lua
- ⚖️ Async Architecture: Non-blocking analysis with race condition protection
Installation
From PyPI
uv add ai-lsp
# or
pip install ai-lsp
From Source
git clone https://github.com/benomahony/ai-lsp
cd ai-lsp
uv sync
Setup
Environment Variables
Set your AI provider API key:
# For Google AI (default)
export GOOGLE_API_KEY="your-api-key"
# Or for OpenAI
export OPENAI_API_KEY="your-openai-key"
Configuration
Configure via environment variables or .env file:
AI_LSP_MODEL=google-gla:gemini-2.5-pro # Default model
DEBOUNCE_MS=1000 # Analysis delay (milliseconds)
Supported models:
google-gla:gemini-2.5-pro(default)gpt-4o- Any model supported by
pydantic-ai
Editor Integration
Neovim (LazyVim)
Create ~/.config/nvim/lua/plugins/ai-lsp.lua:
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
["ai-lsp"] = {
mason = false,
cmd = { "ai-lsp" },
filetypes = { "python", "javascript", "typescript", "rust", "go", "lua", "java", "cpp", "c" },
},
},
},
},
}
VS Code
Add to your settings.json:
{
"ai-lsp.command": ["uvx", "ai-lsp"],
"ai-lsp.filetypes": ["python", "javascript", "typescript", "rust", "go", "lua", "java", "cpp", "c"]
}
Or if you have it installed in your active environment:
{
"ai-lsp.command": ["ai-lsp"],
"ai-lsp.filetypes": ["python", "javascript", "typescript", "rust", "go", "lua", "java", "cpp", "c"]
}
Other Editors
Any LSP client can use AI LSP with these settings:
{
"command": ["uvx", "ai-lsp"],
"filetypes": ["python", "javascript", "typescript", "rust", "go", "lua", "java", "cpp", "c"],
"rootPatterns": [".git", "pyproject.toml", "package.json", "Cargo.toml", "go.mod"]
}
Example Analysis
Given this Python code:
def authenticate(username, password):
if password == 'admin123': # AI LSP will flag this
print(f'User {username} authenticated') # And suggest logging
return True
else:
print('Authentication failed')
return False
AI LSP might detect:
-
Security Issue: Hardcoded password
'admin123'- Severity: Error
- Suggestion: Use environment variables or secure credential storage
-
Best Practice: Using
printstatements- Severity: Warning
- Code Action: Replace with
logging.info()
Troubleshooting
Common Issues
LSP not starting:
- Verify
ai-lspcommand is in PATH:which ai-lsp - Check log file for errors (default:
ai-lsp.log) - Ensure API keys are set correctly
No diagnostics appearing:
- Check file type is supported
- Verify AI model has API access
- Look for errors in log file
Performance issues:
- Increase
DEBOUNCE_MSto reduce API calls - Use a faster model like
gpt-4o-mini - Check network connectivity to AI provider
Debug Mode
Enable verbose logging:
ai-lsp --log-level DEBUG --log-file debug.log
License
MIT License - see LICENSE for details.
Metadata
Release files for ai-lsp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_lsp-0.1.0.tar.gz | 101.9 kB | With provenance | Details for ai_lsp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_lsp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ai_lsp-0.1.0-py3-none-any.whl |
Total release size: 109.6 kB
Release files / ai_lsp-0.1.0.tar.gz
| Download URL | ai_lsp-0.1.0.tar.gz |
|---|---|
| Size | 101.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ff7283c5d64a03a52b6ccfad4af191af0fc26f944bbb7ca6d06f1cb98b96192
|
|
BLAKE2b-256 checksum How to use checksums |
270f79346326dfc13e2e70fada867c2ca43ea3fb4234a0429a58f96b6a65d216
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2025.
Transparency logRelease files / ai_lsp-0.1.0-py3-none-any.whl
| Download URL | ai_lsp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f34dc978ac1c945112e52bbd5095ccac849bf6c81a140bd666cf00e500101c48
|
|
BLAKE2b-256 checksum How to use checksums |
07a0f853a4034849c528e97367290e9ed856d0be4bb002f4b19baf50d525729b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2025.
Transparency logSecurity for ai-lsp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ai_lsp-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.