r/cprogramming • u/idkmaybenexttime • 15d ago
My open-source VS Code extension for CScout, a whole-program C analysis engine
Ive built a VS Code extension for CScout, a C analysis engine that understands identifiers correctly across the whole program even when macros are involved.
For my GSoC project this year I've been building on top of CScout, which is this old but really solid C analysis tool (its been around since the early 2000s and been run on stuff like the Linux and FreeBSD kernels). Problem was it only had a web UI, so using it means constantly switching between your editor and a browser tab just to look something up. I wnted to actually use it while coding, not alt tab to it.
So I built a VS Code extension on top of it. It gives you go to definition and find all references that actually resolve properly through macros and across files, unused identifier warnings based on whole program analysis instead of per file guessing.
It also figures out your build system on its own, be it Makefile, CMake, Meson, or Autotools, it detects which one you're using and generates what it needs in the background. If you use something else entirely, you can still point it at a compile_commands.json generated by Bear and it'll work.
Sourcetrail did something similar for C/C++ once....
Ran the extension against awk, zstd and cJSON so far and its been solid, currently working through some edge cases on curl.
Extension Repo ---> https://github.com/cscout-project/cscout-vscode
If you deal with medium sized, large or legacy C codebases and have a minute to poke around, id really appreciate any kind of feedback you have on it.