Repository navigation
Description
Context
#177 (merged in PR #178, released in v2.0.13) added clangd/VS Code config generation. It currently runs unconditionally at the tail of every successful WASM build: crates/fastled-cli/src/wasm_build.rs:1238-1265 calls clangd_config::write_clangd_config(...), writing compile_commands.json, .clangd, and .vscode/settings.json into the user's sketch directory on every compile.
Writing IDE configuration into a user's project by default is too intrusive: it creates untracked files in their repo (or dirties tracked ones), merges keys into an existing .vscode/settings.json (including disabling the MS C/C++ extension), and silently regenerates files the user may have deleted or customized.
A standalone --write-clangd[=DIR] flag already exists (crates/fastled-cli/src/cli.rs:80, dispatched in crates/fastled-cli/src/lib.rs:92-99) that generates the config without compiling.
Proposal
Make clangd config generation opt-in:
- Remove the unconditional hook in
run_build_streaming()(crates/fastled-cli/src/wasm_build.rs:1238-1265), or gate it behind a new boolean compile flag. - Add a
--clangdboolean flag to the compile path (incrates/fastled-cli/src/cli.rs, threaded through the build request intorun_build_streaming()): when passed alongside a normal compile, emit the config after a successful build (keeping the existing non-fatal warning behavior). - Keep
--write-clangd[=DIR]as the standalone no-compile generator, unchanged. - Update any docs/README mentions of automatic generation.
Acceptance criteria
-
fastled <sketch_dir>(and--just-compile) completes a successful build WITHOUT creating or modifyingcompile_commands.json,.clangd, or.vscode/settings.jsonin the sketch dir. -
fastled --clangd <sketch_dir>compiles AND emits all three files (same content as today). -
fastled --write-clangd <dir>still emits all three files without compiling. - Existing
clangd_configunit tests still pass; a test asserts the default compile path does not invoke config generation. - Config-write failure under
--clangdremains non-fatal to the build.
Decisions
- Mechanism: new
--clangdcompile flag + existing--write-clangd— gives both "generate while compiling" and "generate without compiling" ergonomics; user can rename the flag on review. - Default off with no env-var/config-file override — simplest behavior change matching the request; an opt-in persisted setting can be a follow-up if wanted.
- Priority: P2 — behavior shipped in v2.0.13 writes files into user projects by default; not data-destructive but should be fixed before wide adoption.
Related issues
- feat: emit clangd/VS Code config (compile_commands.json, .clangd, settings.json) so go-to-definition works for WASM sketches #177 / PR feat(cli): emit clangd/VS Code config for WASM sketches #178 — introduced the feature and the unconditional hook.
Activity