lsp-config
npx machina-cli add skill blvp/cc-lspctl/lsp-config --openclawLSP Configuration Skill
Provides guidance for configuring Language Server Protocol (LSP) servers in Claude Code using the lspctl plugin.
Overview
The lspctl plugin enables Mason-like LSP management for Claude Code:
- Define servers in a Lua config file (compatible with Neovim)
- Generate a marketplace with individual LSP plugins
- Install binaries and plugins as needed
Quick Start
1. Create Config File
Create ~/.claude/lsp-config.lua (user-level) or .claude/lsp-config.lua (project-level):
return {
ensure_installed = {
"lua_ls", -- Lua
"pylsp", -- Python (with ruff/isort)
"pyright", -- Python (type checking)
"ts_ls", -- TypeScript/JavaScript
"rust_analyzer", -- Rust
"gopls", -- Go
},
servers = {
pylsp = {
settings = {
pylsp = {
plugins = {
ruff = { enabled = true, lineLength = 80 },
isort = { enabled = true, profile = "black" }
}
}
}
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
checkOnSave = { command = "clippy" }
}
}
}
}
}
2. Generate Marketplace
/lspctl:sync
This creates a marketplace at ~/.claude/generated-lsp-marketplace/ (or project-level).
3. Install Plugins
/plugin install lsp-python-pylsp@generated-lsp
/plugin install lsp-rust@generated-lsp
Or install all:
/lspctl:install-all
Available Commands
| Command | Description |
|---|---|
/lspctl:list | Show available servers and status |
/lspctl:sync | Generate marketplace from config |
/lspctl:install <server> | Install specific server |
/lspctl:install-all | Install all configured servers |
/lspctl:uninstall <server> | Uninstall server plugin |
/lspctl:uninstall --all | Remove all and deregister marketplace |
Supported LSP Servers
| Server | Language | Binary |
|---|---|---|
| lua_ls | Lua | lua-language-server |
| pylsp | Python | pylsp |
| pyright | Python | pyright-langserver |
| ts_ls | TypeScript/JS | typescript-language-server |
| rust_analyzer | Rust | rust-analyzer |
| gopls | Go | gopls |
| clangd | C/C++ | clangd |
| jsonls | JSON | vscode-json-language-server |
| yamlls | YAML | yaml-language-server |
| bashls | Bash | bash-language-server |
Server Settings Reference
Python (pylsp with ruff)
pylsp = {
settings = {
pylsp = {
plugins = {
ruff = { enabled = true, lineLength = 80 },
isort = { enabled = true, profile = "black" },
pycodestyle = { enabled = false },
pyflakes = { enabled = false },
mccabe = { enabled = false }
}
}
}
}
Python (pyright)
pyright = {
settings = {
python = {
analysis = {
typeCheckingMode = "basic", -- "off", "basic", "standard", "strict"
autoSearchPaths = true,
useLibraryCodeForTypes = true
}
}
}
}
Lua
lua_ls = {
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
runtime = { version = "LuaJIT" },
workspace = { checkThirdParty = false }
}
}
}
Rust
rust_analyzer = {
settings = {
["rust-analyzer"] = {
checkOnSave = { command = "clippy" },
files = { excludeDirs = { ".git", "target" } }
}
}
}
TypeScript
ts_ls = {
settings = {
typescript = {
preferences = {
quoteStyle = "single"
}
}
}
}
Troubleshooting
LSP not starting
-
Check if binary is installed:
which <command> -
Run with debug logging:
claude --enable-lsp-logging -
Check logs in
~/.claude/debug/
Config not parsing
-
Validate Lua syntax:
lua -c ~/.claude/lsp-config.lua -
Test parser:
lua ${CLAUDE_PLUGIN_ROOT}/scripts/parse-lua-config.lua ~/.claude/lsp-config.lua
Plugin not found
-
Ensure marketplace was generated:
/lspctl:sync -
Check marketplace was added to settings:
cat ~/.claude/settings.json | grep generated-lsp
Migrating from Neovim
Your Neovim LSP config uses lspconfig server names (e.g., lua_ls, pylsp). The lspctl plugin uses the same naming convention.
To migrate:
- Copy
ensure_installedarray from your mason-lspconfig setup - Copy server settings from your
vim.lsp.config()calls - Run
/lspctl:sync
Source
git clone https://github.com/blvp/cc-lspctl/blob/main/plugins/lspctl/skills/lsp-config/SKILL.mdView on GitHub Overview
lspctl provides Mason-like LSP management for Claude Code. You define servers in a Lua config, generate a marketplace, and install binaries and plugins as needed. This makes LSP setup reproducible per project or per user.
How This Skill Works
Create a Lua config at ~/.claude/lsp-config.lua or project level to declare ensure_installed servers and per server settings. The lspctl plugin reads this config, builds a marketplace, and supports commands to sync, install, and uninstall servers.
When to Use It
- First time LSP setup in Claude Code
- Migrating existing lspconfig setups
- Managing multiple servers across projects
- Importing Mason style config into Claude Code
- Troubleshooting LSP integration and startup
Quick Start
- Step 1: Create a Lua config at user level or project level with ensure_installed and per server settings
- Step 2: Run /lspctl:sync to generate the marketplace in the generated-lsp-marketplace folder
- Step 3: Install servers with /plugin install <server>@generated-lsp or /lspctl:install-all
Best Practices
- Keep lsp-config.lua under version control for reproducibility
- Pin binaries and servers in ensure_installed to avoid drift
- Use dedicated per server settings blocks for critical options
- Run lspctl:sync regularly to refresh the marketplace
- Verify startup with /lspctl:list before installing servers
Example Use Cases
- Enable pylsp with ruff and isort in pylsp plugins
- Configure pyright with typeCheckingMode and autoSearchPaths
- Tailor lua_ls with globals vim, LuaJIT runtime, and workspace checkThirdParty
- Configure rust_analyzer with checkOnSave clippy and exclude target dirs
- Adjust ts_ls preferences to set quoteStyle to single