Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/regen100/cmake-language-server
CMake LSP Implementation
https://github.com/regen100/cmake-language-server
Last synced: 12 days ago
JSON representation
CMake LSP Implementation
- Host: GitHub
- URL: https://github.com/regen100/cmake-language-server
- Owner: regen100
- License: mit
- Created: 2019-11-11T16:24:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T07:03:43.000Z (6 months ago)
- Last Synced: 2024-10-12T23:04:48.394Z (about 1 month ago)
- Language: Python
- Size: 165 KB
- Stars: 333
- Watchers: 9
- Forks: 25
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# cmake-language-server
[![PyPI](https://img.shields.io/pypi/v/cmake-language-server)](https://pypi.org/project/cmake-language-server)
[![AUR version](https://img.shields.io/aur/version/cmake-language-server)](https://aur.archlinux.org/packages/cmake-language-server/)
[![GitHub Actions (Tests)](https://github.com/regen100/cmake-language-server/workflows/Tests/badge.svg)](https://github.com/regen100/cmake-language-server/actions)
[![codecov](https://codecov.io/gh/regen100/cmake-language-server/branch/master/graph/badge.svg)](https://codecov.io/gh/regen100/cmake-language-server)
[![GitHub](https://img.shields.io/github/license/regen100/cmake-language-server)](https://github.com/regen100/cmake-language-server/blob/master/LICENSE)CMake LSP Implementation.
Alpha Stage, work in progress.
## Features
- [x] Builtin command completion
- [x] Documentation for commands and variables on hover
- [x] Formatting (by [`cmake-format`](https://github.com/cheshirekow/cmake_format))## Commands
- `cmake-language-server`: LSP server
## Installation
```bash
$ pip install cmake-language-server
```### Tested Clients
- Neovim ([neoclide/coc.nvim][coc.nvim], [prabirshrestha/vim-lsp][vim-lsp])
#### Neovim
##### coc.nvim
```jsonc
"languageserver": {
"cmake": {
"command": "cmake-language-server",
"filetypes": ["cmake"],
"rootPatterns": [
"build/"
],
"initializationOptions": {
"buildDirectory": "build"
}
}
}
```##### vim-lsp
```vim
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 `/.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 as `cmake .. -DFOO=bar`.[coc.nvim]: https://github.com/neoclide/coc.nvim
[vim-lsp]: https://github.com/prabirshrestha/vim-lsp