A language server for the Kconfig configuration language used in Linux, Zephyr, U-Boot, coreboot, and other projects.
| LSP Method | Description |
|---|---|
textDocument/hover |
Keyword documentation and symbol help text |
textDocument/definition |
Jump to config / menuconfig definition |
textDocument/references |
Find all references to a symbol |
textDocument/completion |
Complete keywords and known symbols |
textDocument/publishDiagnostics |
Parse errors and undefined symbol warnings |
Full coverage of the Kconfig grammar defined in Documentation/kbuild/kconfig-language.rst:
- All entry types:
config,menuconfig,choice,comment,menu,if,source,mainmenu - All attributes:
bool,tristate,string,hex,int,prompt,default,def_bool,def_tristate,depends on,select,imply,visible if,range,help,modules,transitional,optional - Full expression syntax with correct precedence:
||,&&,=,!=,<,>,<=,>=,!,() - Macro invocations
$(...) - Line continuations
\
cargo install kconfig-lspcargo build --release
cp target/release/kconfig-lsp ~/.local/bin/vim.lsp.config.kconfig = {
root_markers = { '.git', 'Kconfig' },
cmd = { 'kconfig-lsp' },
filetypes = { 'kconfig' },
}
vim.lsp.enable('kconfig')Any LSP client that communicates over stdio can launch kconfig-lsp directly:
kconfig-lsp| Category | Tokens |
|---|---|
| Entry keywords | config menuconfig choice endchoice comment menu endmenu if endif source mainmenu |
| Type keywords | bool tristate string hex int |
| Attribute keywords | prompt default def_bool def_tristate depends on select imply visible range help modules transitional optional |
| Operators | = != < > <= >= ! && || ( ) |
| Literals | "double quoted" 'single quoted' |
| Macros | $(cc-option,...) $(success,...) |
cargo build
cargo testThe test suite includes:
- Lexer coverage for all keyword and operator tokens
- Parser correctness against a comprehensive Kconfig sample
- Semantic analysis: symbol definitions, references, type tracking
- Help text indentation parsing
- Real-world validation against the Linux kernel's
init/Kconfig
MIT