# 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 `<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 as `cmake .. -DFOO=bar`.
[coc.nvim]: https://github.com/neoclide/coc.nvim
[vim-lsp]: https://github.com/prabirshrestha/vim-lsp
Raw data
{
"_id": null,
"home_page": null,
"name": "cmake-language-server",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.8.0",
"maintainer_email": null,
"keywords": "cmake, completion, vim, lsp",
"author": "Regen",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/cc/ce/4b14dcaac4359fc9bdcb823763c7984b72e16ff2bf1c709bbc963cc0e0bc/cmake_language_server-0.1.10.tar.gz",
"platform": null,
"description": "# cmake-language-server\n[![PyPI](https://img.shields.io/pypi/v/cmake-language-server)](https://pypi.org/project/cmake-language-server)\n[![AUR version](https://img.shields.io/aur/version/cmake-language-server)](https://aur.archlinux.org/packages/cmake-language-server/)\n[![GitHub Actions (Tests)](https://github.com/regen100/cmake-language-server/workflows/Tests/badge.svg)](https://github.com/regen100/cmake-language-server/actions)\n[![codecov](https://codecov.io/gh/regen100/cmake-language-server/branch/master/graph/badge.svg)](https://codecov.io/gh/regen100/cmake-language-server)\n[![GitHub](https://img.shields.io/github/license/regen100/cmake-language-server)](https://github.com/regen100/cmake-language-server/blob/master/LICENSE)\n\nCMake LSP Implementation.\n\nAlpha Stage, work in progress.\n\n## Features\n- [x] Builtin command completion\n- [x] Documentation for commands and variables on hover\n- [x] Formatting (by [`cmake-format`](https://github.com/cheshirekow/cmake_format))\n\n## Commands\n\n- `cmake-language-server`: LSP server\n\n## Installation\n\n```bash\n$ pip install cmake-language-server\n```\n\n### Tested Clients\n\n- Neovim ([neoclide/coc.nvim][coc.nvim], [prabirshrestha/vim-lsp][vim-lsp])\n\n#### Neovim\n\n##### coc.nvim\n\n```jsonc\n \"languageserver\": {\n \"cmake\": {\n \"command\": \"cmake-language-server\",\n \"filetypes\": [\"cmake\"],\n \"rootPatterns\": [\n \"build/\"\n ],\n \"initializationOptions\": {\n \"buildDirectory\": \"build\"\n }\n }\n }\n```\n\n##### vim-lsp\n\n```vim\nif executable('cmake-language-server')\n au User lsp_setup call lsp#register_server({\n \\ 'name': 'cmake',\n \\ 'cmd': {server_info->['cmake-language-server']},\n \\ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'build/'))},\n \\ 'whitelist': ['cmake'],\n \\ 'initialization_options': {\n \\ 'buildDirectory': 'build',\n \\ }\n \\})\nendif\n```\n\n### Configuration\n* `buildDirectory`\n This language server uses CMake's file API to get cached variables.\n The API communicates using `<buildDirectory>/.cmake/api/`.\n `buildDirectory` is relative path to the root uri of the workspace.\n To configure the build tree, you need to run the cmake command such as `cmake .. -DFOO=bar`.\n\n\n[coc.nvim]: https://github.com/neoclide/coc.nvim\n[vim-lsp]: https://github.com/prabirshrestha/vim-lsp\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CMake LSP Implementation",
"version": "0.1.10",
"project_urls": {
"Repository": "https://github.com/regen100/cmake-language-server"
},
"split_keywords": [
"cmake",
" completion",
" vim",
" lsp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "499ff7f664128af0ca0e3aee22e3c9f9e0ecf43b22b6b368f1ef3420f8e667ba",
"md5": "af96bedc5a1b9141827b1348656b3105",
"sha256": "aee91723443df51b226d26b5607f9430121f6aea6cccbea1ad31be3cd96934bb"
},
"downloads": -1,
"filename": "cmake_language_server-0.1.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "af96bedc5a1b9141827b1348656b3105",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.8.0",
"size": 9615,
"upload_time": "2024-04-20T12:58:57",
"upload_time_iso_8601": "2024-04-20T12:58:57.677098Z",
"url": "https://files.pythonhosted.org/packages/49/9f/f7f664128af0ca0e3aee22e3c9f9e0ecf43b22b6b368f1ef3420f8e667ba/cmake_language_server-0.1.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ccce4b14dcaac4359fc9bdcb823763c7984b72e16ff2bf1c709bbc963cc0e0bc",
"md5": "0a5eb31983187b1d8519ef29fe33b39b",
"sha256": "dbc627dc1e549fc7414f459bdb340812acd84a0c8727b92e73c4bd348e6311bf"
},
"downloads": -1,
"filename": "cmake_language_server-0.1.10.tar.gz",
"has_sig": false,
"md5_digest": "0a5eb31983187b1d8519ef29fe33b39b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.8.0",
"size": 11852,
"upload_time": "2024-04-20T12:58:58",
"upload_time_iso_8601": "2024-04-20T12:58:58.847223Z",
"url": "https://files.pythonhosted.org/packages/cc/ce/4b14dcaac4359fc9bdcb823763c7984b72e16ff2bf1c709bbc963cc0e0bc/cmake_language_server-0.1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-20 12:58:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "regen100",
"github_project": "cmake-language-server",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "cmake-language-server"
}