Add clangd LSP support

- Alter cmake config so it generates compile_commands.json
- Add clangd config
- Add to README a section descrbing how to set up clangd LSP
This commit is contained in:
Andrey Kalmykov 2024-02-09 18:13:17 +03:00
parent 8d18449bd1
commit 675f576ba1
2 changed files with 17 additions and 0 deletions

View File

@ -13,6 +13,8 @@ if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
"remove CMakeCache.txt and CMakeFiles.")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
file (STRINGS "${qucs-suite_SOURCE_DIR}/VERSION" QUCS_VERSION)
message(STATUS "Configuring Qucs: VERSION ${QUCS_VERSION}")

View File

@ -79,4 +79,19 @@ cd /your_installation prefix/bin
./qucs-s
~~~
### clangd LSP support
Clangd looks for `compile_commands.json` file in parent folders of the file it processes.
`compile_commands.json` should be generated along with other build configuration files
when you run `cmake` as part of building routine:
```
mkdir builddir
cd builddir
cmake .. -DCMAKE_INSTALL_PREFIX=/your_install_prefix/
```
If `compile_commands.json` is already there, create a symbolic link to it from project root dir:
```
cd project_root
ln -s ./builddir/compile_commands.json compile_commands.json
```
It may take some time to index files at first run. Clangd configuration is in `.clangd` file.