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-server

Configuration:

{
  "lsp": {
    "typescript": {
      "command": "typescript-language-server",
      "args": ["--stdio"]
    }
  }
}

Python

Install the Python language server:

pip install python-lsp-server

Configuration:

{
  "lsp": {
    "python": {
      "command": "pylsp",
      "args": []
    }
  }
}

Go

Install gopls:

go install golang.org/x/tools/gopls@latest

Configuration:

{
  "lsp": {
    "go": {
      "command": "gopls",
      "args": []
    }
  }
}

Rust

Install rust analyzer:

rustup component add rust-analyzer

Configuration:

{
  "lsp": {
    "rust": {
      "command": "rust-analyzer",
      "args": []
    }
  }
}

LSP Configuration

You can configure LSP servers in:

Global Config

~/.config/kodezi-cli/kodezi-cli.json

Project Config

kodezi-cli.json

Example 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

FieldDescription
commandRequired. The LSP server executable.
argsCommand line arguments to start the server.
envCustom environment variables.
filetypesFile extensions supported by this server.
root_markersFiles used to detect project root (important!).
init_optionsAdditional options passed during server initialization.
optionsServer specific configurations.
disabledDisable 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}
          }
        }
      }
    }
  }
}