CMake LSP Implementation
Project description
cmake-language-server
CMake LSP Implementation.
Alpha Stage, work in progress.
Features
- Builtin command completion
- Documentation for commands and variables on hover
- Formatting
Commands
cmake-language-server
: LSP serverpython -m cmake_language_server.formatter
: CLI frontend for formatting
Installation
$ pip install cmake-language-server
Tested Clients
- Neovim (neoclide/coc.nvim, prabirshrestha/vim-lsp)
Neovim
coc.nvim
"languageserver": {
"cmake": {
"command": "cmake-language-server",
"filetypes": ["cmake"],
"rootPatterns": [
"build/"
],
"initializationOptions": {
"buildDirectory": "build"
}
}
}
vim-lsp
if executable('cmake-language-server')
au User lsp_setup call lsp#register_server({
\ 'name': 'cmake',
\ 'cmd': {server_info->['cmake-language-server']},
\ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'build/'))},
\ 'whitelist': ['cmake'],
\ 'initialization_options': {
\ 'buildDirectory': 'build',
\ }
\})
endif
Configuration
buildDirectory
This language server uses CMake's file API to get cached variables. The API communicates using<buildDirectory>/.cmake/api/
.buildDirectory
is relative path to the root uri of the workspace. To configure the build tree, you need to run the cmake command such ascmake .. -DFOO=bar
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cmake-language-server-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 224a18f36c73e7f182e7066673de94ba7803aca41e0fc5aaaac6d798aee0cfbc |
|
MD5 | 9127687e8d64df8694b5ad48c88ed9b2 |
|
BLAKE2b-256 | f228520dd4cfe34f69c6fb48465c8f392b869642770ee639d50e7862797206c6 |
Close
Hashes for cmake_language_server-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e6cade80282a0e1a46faea0411eeafcc89a27b25a06088b245a28b5a4aff15c |
|
MD5 | 2ba61d665d8609d411fe9ea47e74c8d3 |
|
BLAKE2b-256 | 28ec9f6e472054ec9bba51de3c2838faced17d7bf9f2bbb8c0228a81bf707a9e |