Reputation: 61
I'm working on a C-Code based application, my IDE is Visual Studio Code (1.77.3) and I'm using frequently the outline view from Visual Studio Code, which currently looks like this:
As you might see, there are a bunch of functions and declarations as part of the file network.c
but when navigating through my code I'm not interested in the declarations. I just want to list all my function definitions and switch between them. Besides, some declarations just doesn't make any sense, e.g. "tNetworkParameters declaration" as seen in outline view above. Clicking to this leads me to the following section of code:
struct tNetworkParameters* create_netparams (int n_cluster)
{
struct tNetworkParameters *net_params = malloc(sizeof(struct tNetworkParameters));
net_params->n_cluster = n_cluster;
net_params->domains = calloc(n_cluster, (sizeof(char*) + PARAM_DOMAINSIZE*sizeof(char)));
net_params->ports = calloc(n_cluster, (sizeof(char*) + PARAM_PORTSIZE*sizeof(char)));
return net_params;
}
It seems like VS Code is interpreting the return value of create_netparams(...)
as a declaration. The definition of struct tNetworkParameters
is placed in another header file called network-definition.h
which is #include
'd in the current file scope of network.c
.
Does anyone know how to hide declarations in general via a workspace setting file? Though I think that interpreting the return value as declarations seems like a bug to me.
I know there are outline
settings like "outline.showConstants": false,
but I haven't found any outline setting corresponding to declarations. Let's say there would be a so called outline.declarations
, then I would set them for all .c files used in my project, e.g.:
"[c]": {
outline.declarations = False
}
Unfortunately I couldn't find something like this...
Upvotes: 6
Views: 743