fix(lsp): PR #117 round 1 — CMake config via initializationOptions

cmake-language-server does NOT pull a `workspace/configuration` section:
it reads `buildDirectory` from the `initialize` request's
`initializationOptions`, and drives its project model off CMake's File
API under `<buildDirectory>/.cmake/api/` (not `compile_commands.json`).
The `settings = { cmake = {} }` block — and the documented
`settings.cmake.buildDirectory` override — were therefore inert, leaving
conventional out-of-source project data unavailable.

Replace it with `init_options = { buildDirectory = "build" }` (the
conventional out-of-source dir; users override `init_options.buildDirectory`
from init.lua), and correct the comment. The wiring test now asserts
`config.cmake.init_options.buildDirectory == "build"` — bite-verified
against the pre-fix lsp.lua.

Gates: fmt; clippy -D warnings; --features crdt (1720); m4_acceptance
--skip basedpyright (109); GPU (59); full workspace sweep (zero
failures); git diff --check — all green. One `--lib` run flaked on
process::m6_1_pty_mode_lifecycle_started_then_exited (PTY-lifecycle
timing, the m6/m8 daemon-timing family); it passed in the crdt run, the
full sweep, and 4/4 isolated — unrelated to this Lua config change.
Change is Lua config + the acceptance assertion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJ9FQ832QwftJXCD9LeFan
This commit is contained in:
Levi Neuwirth 2026-07-14 17:03:05 +01:00
parent 7646dda583
commit ff2ce0f197
2 changed files with 18 additions and 6 deletions

View File

@ -168,15 +168,17 @@ pmacs.lsp.config.dockerfile = pmacs.lsp.config.dockerfile or {
}
-- CMake via cmake-language-server (the Python server). It speaks LSP over
-- stdio with no transport flag and pulls configuration via
-- `workspace/configuration` under the `cmake` section (empty ⇒ defaults,
-- present not null — same rationale as gopls). It reads
-- `build/compile_commands.json` for the project model. Users populate
-- `settings.cmake` (buildDirectory, …) from init.lua.
-- stdio with no transport flag. Unlike gopls/taplo it does NOT pull a
-- `workspace/configuration` section: it reads `buildDirectory` from the
-- `initialize` request's `initializationOptions`, and drives its project
-- model off CMake's File API under `<buildDirectory>/.cmake/api/` (not
-- `compile_commands.json`). So the config is an `init_options`, defaulting
-- to the conventional out-of-source `build/`; users override
-- `init_options.buildDirectory` from init.lua.
pmacs.lsp.config.cmake = pmacs.lsp.config.cmake or {
command = "cmake-language-server",
args = {},
settings = { cmake = {} },
init_options = { buildDirectory = "build" },
}
-- TOML via taplo. `taplo lsp stdio` serves LSP over stdio. taplo

View File

@ -6154,6 +6154,11 @@ fn m4_filename_map_resolves_special_files() {
out.plain_is_nil = f('notes.txt') == nil
out.cfg_docker = pmacs.lsp.config.dockerfile and pmacs.lsp.config.dockerfile.command
out.cfg_cmake = pmacs.lsp.config.cmake and pmacs.lsp.config.cmake.command
-- cmake-language-server reads buildDirectory from
-- initializationOptions, not workspace/configuration.
out.cmake_builddir = pmacs.lsp.config.cmake
and pmacs.lsp.config.cmake.init_options
and pmacs.lsp.config.cmake.init_options.buildDirectory
out.has_make_cfg = pmacs.lsp.config.make ~= nil
return out
",
@ -6181,6 +6186,11 @@ fn m4_filename_map_resolves_special_files() {
probe.get::<String>("cfg_cmake").unwrap(),
"cmake-language-server"
);
assert_eq!(
probe.get::<String>("cmake_builddir").unwrap(),
"build",
"cmake config passes buildDirectory via init_options (not a workspace/configuration section)"
);
assert!(
!probe.get::<bool>("has_make_cfg").unwrap(),
"Make has no language server, so no config.make"