What problem does this solve?
When working with Bison/Flex grammars, the generated C files (.tab.c, lex.yy.c) are the actual files processed by clangd for go-to-definition, find references, etc. Navigating between the source .y/.l and the generated C requires manually searching for the matching #line directive — there is no direct jump.
Proposed solution
Add two editor context menu commands:
Show in Source (generated → .y/.l): available inside generated files only (detected by their header). Reads the nearest #line N "file.y" above the cursor and jumps to that file at the correct line. No configuration required.
Show in Generated File (.y/.l → generated): available inside .y/.l files. Locates the generated file via CMake detection (already in place), then Makefile, then fallback to $filename.tab.c / lex.yy.c, then workspace-wide search. Navigates to the matching line using #line directives. Shows a clear error if the file hasn't been generated yet.
Notes
What problem does this solve?
When working with Bison/Flex grammars, the generated C files (
.tab.c,lex.yy.c) are the actual files processed by clangd for go-to-definition, find references, etc. Navigating between the source.y/.land the generated C requires manually searching for the matching#linedirective — there is no direct jump.Proposed solution
Add two editor context menu commands:
Show in Source(generated →.y/.l): available inside generated files only (detected by their header). Reads the nearest#line N "file.y"above the cursor and jumps to that file at the correct line. No configuration required.Show in Generated File(.y/.l→ generated): available inside.y/.lfiles. Locates the generated file via CMake detection (already in place), then Makefile, then fallback to$filename.tab.c/lex.yy.c, then workspace-wide search. Navigates to the matching line using#linedirectives. Shows a clear error if the file hasn't been generated yet.Notes
#linepaths may be relative or absolute depending on the build system — handle both