This guide provides step-by-step instructions to set up the doc-lsp Language Server with Kate editor.
- Kate editor installed (version 21.12 or later recommended for better LSP support)
- Python 3.11+ installed
- pip or uv package manager
First, install the doc-lsp server on your system:
# Using pip (system-wide)
pip install doc-lsp
# Or using uv (recommended)
uv tool install doc-lsp
# Or from source
git clone https://github.com/rochacbruno/doc_lsp.git
cd doc_lsp
pip install -e .After installation, verify it's available:
# Check if doc-lsp is in your PATH
which doc-lsp
# Test that it runs
doc-lsp --version-
Open Kate editor
-
Navigate to Settings:
- Click on
Settingsmenu - Select
Configure Kate...
- Click on
-
Enable the LSP Client plugin:
- In the configuration window, click on
Pluginsin the left sidebar - Find
LSP Clientin the list - Check the checkbox next to
LSP Clientto enable it - Click
Applybutton
- In the configuration window, click on
-
Restart Kate for the plugin to take effect
-
Open Kate Settings again:
Settings→Configure Kate...
-
Navigate to LSP Client:
- In the left sidebar, expand
Application - Click on
LSP Client
- In the left sidebar, expand
-
Configure Client Settings (optional but recommended):
- In the
Client Settingstab, check these options:- ✅ Show hover information
- ✅ Enable code completion
- ✅ Enable semantic highlighting
- ✅ Show diagnostic messages
- You may want to uncheck:
- ❌ Format on typing (doc-lsp doesn't provide formatting)
- ❌ Add parentheses upon function completion
- In the
-
Add doc-lsp Server Configuration:
- Click on the
User Server Settingstab - Copy and paste the following JSON configuration:
- Click on the
{
"servers": {
"doc-lsp-python": {
"command": ["doc-lsp"],
"rootIndicationFileNames": ["pyproject.toml", "setup.py", "requirements.txt", ".git"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^Python$"
},
"doc-lsp-yaml": {
"command": ["doc-lsp"],
"rootIndicationFileNames": [".git"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^YAML$"
},
"doc-lsp-json": {
"command": ["doc-lsp"],
"rootIndicationFileNames": ["package.json", ".git"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^JSON$"
},
"doc-lsp-toml": {
"command": ["doc-lsp"],
"rootIndicationFileNames": ["pyproject.toml", "Cargo.toml", ".git"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^TOML$"
},
"doc-lsp-ini": {
"command": ["doc-lsp"],
"rootIndicationFileNames": [".git"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^INI Files$"
},
"doc-lsp-properties": {
"command": ["doc-lsp"],
"rootIndicationFileNames": [".git"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^Java Properties$"
},
"doc-lsp-conf": {
"command": ["doc-lsp"],
"rootIndicationFileNames": [".git"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^Config$"
}
}
}- Apply the settings:
- Click
Apply - Click
OKto close the configuration dialog
- Click
If you prefer a simpler setup that works for all file types, you can use this configuration instead:
{
"servers": {
"doc-lsp": {
"command": ["doc-lsp"],
"rootIndicationFileNames": [".git", "pyproject.toml", "package.json"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^(Python|YAML|JSON|TOML|INI Files|Java Properties|Config)$"
}
}
}- Create a test file (e.g.,
test_settings.py):
# test_settings.py
SERVER = "localhost"
PORT = 8080
DEBUG = True
DATABASE_URL = "sqlite:///app.db"- Create the documentation file (
test_settings.py.md):
## SERVER
> The hostname or IP address of the server.
> Default: "localhost"
> Example: "192.168.1.100" or "api.example.com"
## PORT
> The port number the server listens on.
> Must be between 1024 and 65535.
> Default: 8080
## DEBUG
> Enable debug mode for development.
> **Warning**: Never enable in production!
> Default: False
## DATABASE_URL
> Database connection string.
> Supports: PostgreSQL, MySQL, SQLite
> Format: "dialect://user:password@host/database"-
Open the Python file in Kate
-
Test the features:
- Hover: Move your mouse over a variable (e.g.,
SERVER) - you should see a tooltip with the documentation - Completion: Start typing a variable name (e.g., type
DAT) and pressCtrl+Space- you should seeDATABASE_URLin the completion list with documentation
- Hover: Move your mouse over a variable (e.g.,
If something isn't working:
-
Open the LSP Client output:
- In Kate, look for the bottom panel
- Click on the
LSP Clienttab - You should see logs showing the server starting and any errors
-
Common issues and solutions:
-
"Command not found": Make sure
doc-lspis in your PATHecho $PATH which doc-lsp
-
Server not starting: Check if the command works manually
doc-lsp
-
No hover/completion: Ensure you have both the source file and
.mddocumentation file in the same directory
-
For .env files and other plain text files without standard highlighting modes:
{
"servers": {
"doc-lsp-env": {
"command": ["doc-lsp"],
"rootIndicationFileNames": [".git", ".env"],
"url": "https://github.com/rochacbruno/doc_lsp",
"highlightingModeRegex": "^(Plain Text|None)$",
"fileExtensions": [".env", ".env.example", ".env.local"]
}
}
}-
Check if doc-lsp is installed correctly:
doc-lsp --help
-
Try running doc-lsp manually to see any error messages:
doc-lsp
-
Check Kate's LSP Client logs for error messages
-
Verify the documentation file exists:
- For
config.py, you needconfig.py.md - For
settings.yaml, you needsettings.yaml.md
- For
-
Check the documentation file format:
- Headers should be
## VARIABLE_NAME - Documentation text follows the header
- Headers should be
-
Ensure the LSP server is running (check LSP Client tab)
- Make sure you're using the latest version of doc-lsp with the completion fix
- Try manually triggering completion with
Ctrl+Space - Check that the variable is documented in the
.mdfile
- File watching: doc-lsp watches for changes in
.mdfiles and updates documentation automatically - Multiple projects: Each project/folder can have its own documentation files
- Nested variables: doc-lsp supports nested variable documentation (e.g.,
DATABASE.HOST)