This extension add cscope support to Visual Studio Code. It supports C/C++ only (all other languages are not tested). For any issue you have, pleases log it here. Your help can improve this extension.
Visual Studio Code C/C++ extension has the support for symbol parsing and searching, which is based on Clang tag system. However, when working with a very large projects (over 10K files), it could be very slow and annoying (based on my experience):
scope4code uses cscope, which works very well with large project. Database build time normally withing 1 minutes and search is extremely fast (at least with Linux filesystem).
Dependency:
"scope4code.executablePath": "<cscope_path>"
For windows user: pls download cscope from here. Extract the exe after download and add path to user or system evironment.
For Linux user: Do not use ~/ in
Build database:
Find all references
Find definition
Other commands via F1:
Configuration:
Command customization
scope4code.engineCommands : {
"config_index" : {
"cscope" : {
"win32" : 1,
"linux" : 0
}
},
"config": [
{
"find_cmd": "find ${src_path} -type f -name *.c -o -type f -name *.cpp",
"find_all_ref" : "cscope -L0 ${text}",
},
{
"database_cmd": "cscope -b -k"
}
]
}
field | description |
---|---|
find_cmd | Command to list all source files |
database_cmd | build database |
find_all_ref | find all reference of a symbol |
find_define | find definition of a symbol |
find_callee | find functions called by this function (symbol) |
find_caller | find functions calling this function (symbol) |
find_text | find this text string |
Built-in variables: There are variables defined could be used (some has to, such as ${text}) to build command. Here is a list of supported variables:
name | description |
---|---|
${src_path} | source folders configured in engine_configurations.cscope.paths, by default (if not configured) this would be workspace path |
${database_path} | path where database file would be generated. It's configured via engine_configurations.cscope.database_path. It's .vscode/cscope by default (if not configured) |
${text} | text (symbol) to be searched |
${workspaceRoot} | workspace root of current vscode window |