A minimal C code indexer for VSCode that provides Go to Definition functionality. This extension parses C code using tree-sitter and builds an in-memory index of functions, structs, and typedefs.
- Go to Definition (Ctrl+click or F12) for C functions and types
- Support for multiple definitions with the same name (shows a picker)
- Workspace-wide indexing of C source files
- Auto-reindexing when files are changed or created
- Node.js and npm
- Visual Studio Code
- Clone this repository
- Run
npm installto install dependencies - Run
npm run compileto build the extension - Press F5 in VSCode to launch a new window with the extension loaded
- Open a folder containing C source files
- Wait for the indexing to complete
- Position cursor on a function call or type reference
- Press F12 or Ctrl+click to go to its definition
- If multiple definitions are found, a picker will be shown
The extension uses tree-sitter to parse C files and extract symbol definitions:
- On activation, it scans all C files in the workspace
- It builds an in-memory index of functions, structs, and typedefs
- When you use "Go to Definition", it looks up the symbol in the index
- If found, it navigates to the definition location
This is a proof of concept with the following limitations:
- Limited support for C preprocessor directives
- No support for complex include path resolution
- May not handle all C language constructs correctly
- Limited to Go to Definition functionality (no Find References, etc.)
None currently.
This is a proof of concept and not a full-featured C language extension. For production use, consider using the official C/C++ extension or clangd.
- Support for include path configuration
- More robust C preprocessor handling
- Support for Find All References
- Support for Hover information
- Symbol renaming support