LSP Setup
Configure Language Server Protocol (LSP) to enable code intelligence, diagnostics, and smarter AI assistance in Kodezi CLI.
The Language Server Protocol (LSP) allows Kodezi CLI to understand your code with deep intelligence, including real-time diagnostics, type checking, symbol resolution, and structural analysis. With LSP configured, Kodezi becomes significantly smarter and more accurate.
What LSP Provides
LSP integration enhances Kodezi CLI with powerful code intelligence capabilities:
- Syntax validation: Real time syntax checking
- Type checking: Type system validation
- Error diagnostics: Detailed error messages and locations
- Symbol information: Access to code structure and definitions
- Auto completion context: Intelligent code completion suggestions
Supported Languages
Kodezi CLI supports any language that provides an LSP server, including:
Common LSP Servers:
- JavaScript / TypeScript
- Python
- Go
- Rust
- Java
- C / C++
- PHP
- Ruby
- Kotlin
- C#
- Swift
- And many more
If a language has an LSP server, Kodezi can use it.
Install LSP Servers
Choose a language below and follow the installation instructions.
TypeScript/JavaScript
Install the TypeScript language server:
npm install -g typescript typescript-language-serverConfiguration:
{
"lsp": {
"typescript": {
"command": "typescript-language-server",
"args": ["--stdio"]
}
}
}Python
Install the Python language server:
pip install python-lsp-serverConfiguration:
{
"lsp": {
"python": {
"command": "pylsp",
"args": []
}
}
}Go
Install gopls:
go install golang.org/x/tools/gopls@latestConfiguration:
{
"lsp": {
"go": {
"command": "gopls",
"args": []
}
}
}Rust
Install rust analyzer:
rustup component add rust-analyzerConfiguration:
{
"lsp": {
"rust": {
"command": "rust-analyzer",
"args": []
}
}
}LSP Configuration
You can configure LSP servers in:
Global Config
~/.config/kodezi-cli/kodezi-cli.jsonProject Config
kodezi-cli.jsonExample Full Configuration
{
"lsp": {
"typescript": {
"command": "typescript-language-server",
"args": ["--stdio"],
"filetypes": ["ts", "tsx", "js", "jsx"],
"root_markers": ["package.json", "tsconfig.json"]
},
"python": {
"command": "pylsp",
"args": [],
"filetypes": ["py"],
"root_markers": ["setup.py", "pyproject.toml"]
}
}
}Configuration Options
| Field | Description |
|---|---|
| command | Required. The LSP server executable. |
| args | Command line arguments to start the server. |
| env | Custom environment variables. |
| filetypes | File extensions supported by this server. |
| root_markers | Files used to detect project root (important!). |
| init_options | Additional options passed during server initialization. |
| options | Server specific configurations. |
| disabled | Disable a server without deleting config. |
Project Specific Configuration
Add to kodezi-cli.json in your project:
{
"lsp": {
"typescript": {
"init_options": {
"preferences": {
"strictNullChecks": true
}
}
}
}
}Useful when:
- A project requires strict rules
- You use specific tsconfig or venv
- Different repos use different LSP setups
Environment Variables
Use environment variables for custom paths:
{
"lsp": {
"python": {
"env": {
"PYTHONPATH": "/custom/path"
}
}
}
}Using LSP
Once configured, LSP runs automatically. The AI uses LSP diagnostics to:
- Detect errors before running code
- Understand type systems
- Validate changes immediately
- Access symbol definitions
Troubleshooting
Advanced Configuration
Custom Root Markers
{
"lsp": {
"typescript": {
"root_markers": [
"package.json",
"tsconfig.json",
".git"
]
}
}
}Server Specific Settings
{
"lsp": {
"python": {
"options": {
"pylsp": {
"plugins": {
"pycodestyle": {"enabled": true},
"pylint": {"enabled": true}
}
}
}
}
}
}Related Topics
- Settings: All configuration options
- Configuration: Configuration overview
- MCP Setup: Extend Kodezi CLI with tools