feat: generate rust-project.json for LSP

Add a CMake module that writes rust-project.json on every configure so
rust-analyzer can resolve the no-Cargo crate layout, sysroot crates,
and proc-macro attributes without Cargo.

Co-Authored-By: qwen (lmstudio/qwen3.8-27b@q3_k_xl): LSP setup
This commit is contained in:
2026-09-05 05:29:23 +02:00
parent c3a7680e36
commit d5728334d6
5 changed files with 82 additions and 0 deletions
+3
View File
@@ -4,6 +4,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_program(RUSTC rustc REQUIRED)
# Generate rust-project.json for rust-analyzer (LSP) support.
include(cmake/RustLSP.cmake)
set(RUST_MACRO_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macros/src/lib.rs")
set(RUST_MACRO "${CMAKE_CURRENT_BINARY_DIR}/rslibc_macros${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(RUST_LIBRARY_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/lib.rs")