SourceSeek README
SourceSeek is a tool for browsing C/C++ source code using the database of cscope/ctags/readtags/global/gtags created.
It using the VSCode internerl interface of "Go to Definition", "Go to Reference", "Find All Reference", "Show Call Hierarchy" to navigate the code.
It also provides a outline view to show the code structure of the current file.
It has browser history window to show the browser history of the current project.
It provides a preview window to show the code of the function when the mouse hover on the function name.
It is to replace the VSCode C/C++ extension which is slow for large project like linux kernel.
It uses the database created by cscope/ctags, so don't need to compile the code like the clangd extension.
Other special feature:
- Call hierarchy export
- Modified cscope/ctags that can recognize macro definitions, non-active code not be anasysised.
- Edit windows show non-active code as grey color.
- Manual link for a symbol and definition, that can be used for function pointer.
- preview symbol definition and call hierarchy by mouse hover
Features
Building the Database
When you open a directory/workspace, the cscope/ctags database will be automatically built on the first search. You can also generate it in advance via command line:
- cscope -Rcbqk or first create a cscope.files file, then cscope -cbqk
- ctags --fields=+i -Rno tags
Outline Window
Displays the function structure in the file, and can toggle to show only functions

Jump to definition(F12)
Go to Definition in context menu or F12 or Ctrl+Click on a symbol
Jumps to the definition, if there are multiple definitions, shows an inline window

Go to Reference(Shift + F12)
Jumps to references, if there are multiple references, shows an inline window

Call Hierarchy Window(Shift+Alt+H)
show the call hierarchy of the current function

All References Window(Shift+Alt+F12)
show all references of the current symbol

Preview Window
When mouse hovering over a symbol, displays the definition in the right window
It can also show code in a popup window beside the mouse pointer by changing setting

You can also set to show preview in a hover window. By default, struct and macro will show in this window

Symbol Preview Panel
The preview also appears in a "Symbol Preview" panel next to Terminal/Problems at the bottom.
It shows the same content as the hover tip, and keeps it after the tip disappears, until the next tip replaces it.
It opens automatically on the first hover (the editor keeps focus) and can be toggled with View: Toggle Symbol Preview.
Global Search
Type # followed by a symbol prefix in the top bar to search for symbols across the entire workspace

Text Search
Double click on a word in edit window then right click to popup context menu and choose Search.

Browser History Record Window
The history window records the history of symbols searched for definition jumps, Call Hierarchy, and references. It automatically saves in the workspace directory and loads the history record when reopened.
You can also save to a file and load from a file using buttons.
You can filter to show only functions.

For symbol definitions, if a symbol has multiple definitions, they will be displayed in child nodes.

For symbol call chains, the CALLERS OF window displays a call chain layer by layer, which is recorded in the history as child nodes. A call chain can be copied to the clipboard.

You can copy the call chain to the clipboard and paste it to other places.

When you go to a function, and then continue go to a sub-function and so on, the history will record the calling stack.
Manually Map Function Pointer to Definition
For some function pointer calls, or multi-layer calls, you want to skip the intermediate calling process and directly call the key function. You can manually establish a function call link.
Click the function name symbol in the definition, and pop up the menu (Link Caller/Mark Definition), click it, and pop up the menu, you can select the caller, or cancel the menu to just mark a definition, for choosing in Link Definition.

Click the function name symbol in the definition, and pop up the menu (Link Definition/Mark Caller), click it, and pop up the menu, you can select the function name, or cancel the menu to mark a caller, for choosing in Link caller.

The menu will also display the function names in the history record and the marked functions in dialog for choosing.

You can right-click the menu to display the established call relationship

The call relationship will be displayed in the OUTPUT window

Status Bar Quick Settings
Click SourceSeek in the status bar to display several toggle switches

A menu for on/off some settings

- Enable mouse hover preview
- Use the same tab to open preview files or open a new tab for new files
- Whether to add hovered symbols to history
- Whether to preview in the right window or in hover tips
- Whether to display cscope/ctags/readtags command line.
Commands
Windows and Linux versions of cscope/ctags/readtags commands are pre-installed in the extension.
You can configure to use system-provided commands, that need set search path in system environment or specify the path for the commands in settings.

Requirements
It depends on the cscope/ctags/readtags tools.
Extension Settings
This extension contributes the following settings:
sourceseek.enableSourceSeek: Enable/disable this extension.
sourceseek.enableReferenceSearch: Enable/disable reference search.
sourceseek.enableDefinitionSearch: Enable/disable definition search.
sourceseek.enableCallHierarchy: Enable/disable call hierarchy.
sourceseek.enableWorkspaceSymbol: Enable/disable workspace symbol search.
sourceseek.enableDocumentSymbol: Enable/disable document symbol search.
sourceseek.HoverPreviewEnabled: Enable/disable hover preview.
sourceseek.openRightWindow: Enable/disable open preview in right window.
sourceseek.openInNewWindow: Enable/disable open preview in a new window.
sourceseek.hoverAddHistory: Enable/disable add hovered symbols to history.
sourceseek.useInternalExecutable: Enable/disable use internal executable.
sourceseek.executablePath: Set the path for cscope/ctags/readtags.
sourceseek.showCommand: Enable/disable show cscope/ctags/readtags command line.
sourceseek.databasePath: Set the path for cscope/ctags/readtags database.
sourceseek.cscope_database: Set the name for cscope database.
sourceseek.ctags_database: Set the name for ctags database.
sourceseek.excludedPaths: Set the excluded paths for cscope/ctags/readtags.
sourceseek.hoverCallerEnabled: Enable/disable showing Call Hierarchy on mouse hover. When enabled, hovering a symbol will also trigger the Call Hierarchy view.
Known Issues
mouse hover preview with tips is showing well
Release Notes
2.6.1
- Add the Show Reference menu item; compared with vscode's original functionality, add one-click display of the code lines where the symbol is referenced in all files, and add toggle buttons for filtering by this directory or this file
- Fix the option feature displayed in the right window.
- Add a Preview toggle.
- Add filename and line number to the Preview reference display, and add function name display.
- Add a button in the Preview panel for local variables to show references in this function.
- Sort multiple symbol lookup locations by proximity, showing the nearest symbol definitions: same file, same directory, same grandparent directory.
- Add line indicator to local variable definitions, 9 lines of context.
2.6.0
- Added support for using ctags/cscope on MAC systems, integrating modified versions of ctags/readtags/cscope that support macro definitions
- Added support for English/Chinese translation for selected text
- Add feature of recording code explain to markdonw file and also add to sourceseek-note.md
- Add En/zh-cn dual language support
2.5.3
- Added multiple preview window feature, with two side-by-side windows enabled by default, up to four, displayed alternately during preview
- Added preview window pin feature; once pinned, the window will no longer be updated and will be skipped during alternating display
- Added AI code explanation feature
- RawChat renders markdown-formatted responses as HTML when displaying answers
- Fixed GLM.flash issue by using user role instead of system role
- Added LLM URL settings entry in the status bar model selection menu
- Added progress bar and cancel button to Find All References
2.5.2
- Call tree view now supports switching between callers and callees
- Fixed syntax highlighting issue in the preview view
- Fixed macro definition search issue
2.5.1
- Added code note feature, recorded in sourceseek.note.md, viewable in a floating window in the editor
- Preview window split-screen feature changed to a title bar icon
2.5.0
- Static and non-static functions are now displayed differently in the outline window
- The focused function in the outline window now changes with the cursor position in the editor
- Enum constants in preview now display the complete enum definition
- Hover preview window can show multiple definition locations; after selection, it is displayed in the right window
2.4.3
- Added support for Excel file preview and clicking internal source code locations to display them in the right window, while also showing the complete line in the preview window
- Adjusted line spacing when displaying code in markdown
2.4.2
- Added hover window in the preview window for viewing symbol definitions; clicking the window makes the other preview window jump to that symbol's definition
- Call tree can be copied to a preview window, or a preview window can be copied to a new editor window
- Fixed code color rendering issue in the preview window
2.4.0
- Added a Preview Panel at the bottom; clicking a symbol allows previewing the symbol's definition, supporting functions, local variables, global variables, macros, and structures
- Added support for splitting the Preview Panel, using them alternately during preview
- Added support for switching the Preview Panel to a call tree; what previously opened a new editor window now displays in the Preview Panel
- The function call tree window can recursively display 5 levels
2.3.0
- add Symbol Preview panel next to Terminal, showing the hover tip content and keeping it after the tip disappears.
2.2.13
- add LLM proxy support
- add feature of switch model name
- add markdown preview with TOC panel and source code link jump feature, show code in right windows
you can use LLM to generate code flow of function call and easily jump to each function.
2.0.1
- Add AI LLM API server setting
1.8.2
- Add highlight toggle menu
- Add recusive search include file for typedef
- Add struct/union, highlight type for member definition
1.8.0
- Add highlight for struct/enum
- Add highlight for typedef from include file
1.7.4
- C++ outline description show only last level class name
- fix build database command bug
1.7.2
- add hobotkey ctrl+alt+a for finAssignment
- fix issue when ctrl+click on symbol and enable auto call-hierarchy, it will automatically jump back
1.7.0
- support C++ reference search by gtags/global
- support C++ call hierarchy by gtags-cscope
1.6.8
- support outline show hierarchy of struct/class/enum/namespace
1.6.6
- add click trigger option for mouse hover symbol to show call hierarchy
- fix 2 corner case related absolution path
- not add to history for symbol hover call hierarchy
- ignore EXPORT_SYMBOL for ctags when build database and show outline
1.6.4
- fix ctags/cscope open two many files issue when enable macro
- hover call hierarchy trigger by hover+click and get focus back
1.6.2
- Add support of "Find file inlcude this file"
- support include file like <linux.slab.h>
1.6.0
- Add SourceSeek submenu and add hover call hierarchy
- Fix deadloop when history full
- Add menu bar sourceseek
- Add support for file reference and go to file, find assignemnt(cscope -L6 -L7, -L8, -L9)
1.5.6
- if ctags does not find symbol, try to use cscope again
- generate cscope.files include .S file.
1.5.4
- fix absolution path issue for symbol jump and call hierarchy show
- fix delete history item issue
- support macro file for outline in win32
1.5.2
- support ctags -m for win32
1.5.0
- use exuberant-ctags replace universial-ctags for better performance
- fix ctags/cscope for code like "#if defined FEATURE_XXXXx"
- build database show progresss better
- reduce ctags/cscope size
1.4.6
- ctags/csope support IS_ENABLED macro
- ctags/csope support 2 macro files
- build database support 2 macro files(custom macro file and autoconf.h)
- support outline readtags with 2 macro files
- async for edit macor update
- Add option setting for hiarerchy caller whether to add to history
- limit to caller at max 20
- add check for call tree maintain.
1.4.4
- Edit show code support IS_ENABLED and defined XXX
1.4.2
- Hover in right windows, already show in tips, not jump
1.4.0
- support custom macro add/delete dialog
1.3.0
- support load a macro definition file and show non-active code as grey color.
- support toggle enable/disable show non-active code as grey
1.2.0
- support generate linux kernel cscope.files depend on .cmd file
- add -m support for ctags and cscope,(only linux)
for linux kernel, the file kernel/include/generated/autoconf.h include the macros, so
when creating ctags and cscope database, the code that depend on macro definition will not be included.
e.g.
#define CONFIG_FEATURE 1
#ifdef CONFIG_FEATURE
1.1.0
- Add review feteature
1.0.0
- This is no big changes compare with 0.9.5, just a message. So we got a 1.0 version.
0.9.5
- add link in hover window to open in right window
- bookmark use relative path
0.9.4
- show path in history item tips
- use function+line for bookmark
0.9.3
- Add F2 key for bookmark
- mark caller support without in function
0.9.2
- Add open in right window menu for history item
- Add open in right window menu for edit window
- Add file path in hover window
0.9.1
- For go to definitions, filter function, struct, macro, and add all to history, except function.
- Fix hover tips show code format issue
- For struct and micro, show in hover tips.
0.9.0
- Add calling stack history feature
- Move symbol to newest if already in history
- Identify multiline function definition
- Support history buffer size setting
- show called/calling numbers in root item of call hierarchy
- Identify struct variable from last 30 lines
- Support Delete whole tree
- export to clipboard both calling and called
- Support drag&drop for history symbol
- Fix delete issue of history symbol
0.8.0
- Add support for function referenced by struct variable in call hierarchy
- If no function called, return referenced by struct variable for a function
- Support hover to show function code in tips.
- Add option for function-struct only in workspace symbol search
- reference by does not return EXPORT_SYMBOL and declaration
- Fix load/save history order issue
- Fix using same tab to show preview file
0.7.0
- Add support for manually set up function pointer to definiton map
- Add support for editing description for symbol history
- Add support call hierarchy and go to definition for manually map
- change symbol history path to relative to workspace
- fix issue of no symbol history file register fail
- fix issue of save history with fixed order
- fix issue of remove one history item
0.6.1
- Add autobuild option
- try cscope when ctags database is not found for go to definision
0.6
- Add symbol search context menu
- Add some buttons
0.5.2
- fix linux call hierarchy issue
0.5.1
- fix build issue
0.5.0
- Add setting for execute path
- Add enable/disable option for features
- Add save/load button for history window
- Add clear button for history window
- Add setting for cscope/ctags/readtags command line.
0.4.0
- Add setting for preview window.
0.3.0
- Add preview window for function definition.
0.2.0
- Add history window for browser history.
0.1.0
- Initial version of SourceSeek.
- Support cscope and ctags/readtags for C/C++ code search and navigation.
- Add outline view function switch for code structure.
Following extension guidelines
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
Enjoy!