# CMake Language Server?

**URL:** https://discourse.cmake.org/t/cmake-language-server/7035
**Category:** Development
**Created:** [December 8, 2022, 10:54am UTC](https://discourse.cmake.org/t/cmake-language-server/7035 "2022-12-08T10:54:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![leha-bot](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leha-bot/32/921_2.png) [@leha-bot](https://discourse.cmake.org/u/leha-bot)
#### Post date: [December 8, 2022, 10:54am UTC](https://discourse.cmake.org/t/cmake-language-server/7035/1 "2022-12-08T10:54:26Z")

</div>

I suggest implementing the Language Server Protocol inside CMake for ease of use inside any compliant IDE.  
Some notes about architecture design will be later in this topic.

What do you think about this idea?  
Kind regards,  
Alex.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [December 8, 2022, 1:23pm UTC](https://discourse.cmake.org/t/cmake-language-server/7035/2 "2022-12-08T13:23:01Z")

</div>

Design will need to (likely) rework a lot of CMake internals because CMake is _very_ stateful and asking questions about _this point_ of the configure needs to (generally) be asked when CMake is at that point in processing the file. The statefulness means processing from the beginning again (and potentially rerunning any `execute_process` and other not-so-cheap commands).

Note that there are debugging proposals (not sure if they leverage LSP or not): [https://gitlab.kitware.com/cmake/cmake/-/issues/21510](https://gitlab.kitware.com/cmake/cmake/-/issues/21510)

---

<div class="post-metadata">

### Author: ![hinell](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hinell/32/2657_2.png) [@hinell](https://discourse.cmake.org/u/hinell)
#### Post date: [May 11, 2023, 10:48pm UTC](https://discourse.cmake.org/t/cmake-language-server/7035/3 "2023-05-11T22:48:11Z")

</div>

Totally in favor of it. We should leverage existing codebse and provide support for LSP servers. Would be nice. If anyone interested on working on a PR, let me know!

There are a couple of implementations already btw, so we can use them as reference, e.g.:

- In Rust: [GitHub - Decodetalkers/neocmakelsp: Another cmake lsp](https://github.com/Decodetalkers/neocmakelsp)
- In Python: [GitHub - regen100/cmake-language-server: CMake LSP Implementation](https://github.com/regen100/cmake-language-server)

I think they are inefficient.
