|T O P I C R E V I E W
||Posted - Sep 02 2020 : 12:54:24 PM
I dont think that currently there is any way in VA to have an overview of all types used in the current project file.
Its something that I needed a few times already, a kind of overview of the types used in a class, or file. Kind of like the VA View / Outline but grouped by type, showing name of variable, file, line number,
- _fi [File1.cs (25)]
- finfo [File1.cs (49)]
- ds [File1.cs (26)]
Would be a great help in understanding the current file, searching for implementations and uses of type, etc.
|5 L A T E S T R E P L I E S (Newest First)
||Posted - Sep 03 2020 : 09:16:10 AM
So really we are looking for some form of overview of the structure of the code? VA Outline is designed to help on a file level, but this assumes / requires that everything has sensible names.
Another approach is that you want some form of code metrics, but focusing on the types used, rather than function length.
Any tool that has parsed the code has the building block information in hand to set about generating this information, but we need a clear definition of what information we want extracted, and how.
Have you considered running Find References in File on key types? You can clone the Find References Results window, so you can collect snapshots of the usage of different types this way, to get a sense of what is happening.
||Posted - Sep 03 2020 : 07:44:03 AM
Maybe the File was a bad example. But when you have a large amount of cascading or interweaved business classes, its sometimes a real pain to get an overview which of them are used in a certain class or file. Sure, I can get a type and then see where its referenced but thats kinda-other-side-around.
When you try to understand the code in front of you, (almost) any tool is helpful.
||Posted - Sep 03 2020 : 07:28:48 AM
OK, so every line that declares a type...
I am still not sure what you are trying to achieve here. Maybe a sense of what sort of task the file works on, by the main types it uses? But wouldn't this be unreliable, since it could do a lot of file handling, but only declare a file type once or twice?
As an initial work around, have you considered using a regular expression, which you could then sort and count the line groups of?
||Posted - Sep 02 2020 : 3:17:38 PM
The idea is to see what types are used through the whole file that is open (may be for a class, not sure, since a class can span multiple files, or a file can have multiple classes)
So it's not about scope but quantity.
||Posted - Sep 02 2020 : 2:25:59 PM
What sort of scope are you thinking of here?
Types in a class, are you thinking of just class member variables, or all variables used across all member functions?
For the file, what sort of scope? Since you don't really have file scope variables in C#, all variables are going to be class members or "local" variables to functions, either from parameters or declared inside the functions.
What are you trying to achieve here? I am not sure I see how this helps.