Author |
Topic |
|
chrisaverage
Junior Member
Poland
20 Posts |
Posted - Aug 02 2015 : 11:32:07 AM
|
I'm working now on a large refactoring project using Qt and Find Reference is my #1 super useful tool (thank you for it!).
A large amount of files (roughly 1/3) in the project is generated by Qt tools and they are part of the solution. For every class I have I get about 6 of these, one for each project configuration.
When using Find References I'm never interested in contents of these files as they are recreated if related classes change. As i often face large number of results (hundreds are not uncommon) and most of them are the generated files, it would be very useful to be able to somehow filter them out.
In my case they are placed in a single directory (.../GeneratedFiles/...) so the obvious idea is to be able to specify somewhere that this directory should be excluded from search. Such directories list should be persistent as I don't want to re-specify it on every search.
Another idea would be to present the results in a full directory tree so I could just close a single branch instead of hunting down scattered results in sub directories.
My problem is related to Qt but I think this could be useful in general, as code generation is not uncommon. |
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Aug 07 2015 : 11:50:49 AM
|
First idea: would it be good to filter out generated code from the symbol database? I mean, would you want VA to understand generated code? Do you want other features like Goto (Alt+G) or Find Symbol dialog (Alt+Shift+S) etc. work on the symbols defined there?
BTW, for me, Find References omit results from generated (and included) files. Are your generated files part of your project? (e.g. is it listed in alt+shift+o dialog and solution explorer?)
Second idea: I have put in a feature request for this:
case=91276 |
|
|
chrisaverage
Junior Member
Poland
20 Posts |
Posted - Aug 07 2015 : 2:15:31 PM
|
If a generated file is only referenced by an include then yes, Find References would omit it, but that's not the case here.
The Qt generated files are added to the project by Qt's VS add-in. I guess from a parser perspective they are indistinguishable from any other project files, so it would need active user intervention to mark these explicitly for VA. I don't think there's any sane heuristic that could be used to find them automatically (apart from interacting with Qt's add-in directly, which I'm not sure is possible or desired), as the location is configurable and they are just regular c++ headers/sources. That's where the idea of filtering out user-defined directories comes from.
As for your first question - that's a tough one. I guess that could depend on a given user workflow. Here's how it would be perfect for me
I really want the generated code to be accessible for code completion, as it will often be interacted with (e.g. it generates code from a visual designer for UI elements like buttons or menus symbols etc. so I want to access them in my own code). That's how it works now and that's great.
On the other hand I almost never (like 99.999% of the time) want to open these files or inspect their contents and absolutely never edit them (manual changes are lost). On that level they are interacted with explicitly via Qt's external visual designer. So now that you mentioned it, removing it from places like Goto(Alt+G), Find Symbol(Alt+Shift+S), Open File in Solution(Alt+Shift+O) and others would make great sense and would clean these views too.
Qt has its own IDE (Qt Creator) and that's how it works there - generated files are for all intents and purposes invisible to the user except for the code completion, where they are actually used. I understand that mimicking this in VA would be very Qt specific so I'm not pushing for it, but any improvement towards this would be great. That's why I proposed filtering by directories in the Find References - it could be used for other non-Qt purposes too. If it were extended to other VA areas that would be even better. |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Aug 07 2015 : 4:29:04 PM
|
*ah* Code completion makes sense. Thank you for the elaboration.
We are already planning a feature to omit directories from parsing, this is why I asked if it would be good. When it comes to completion, Visual Studio should be able to do it for generated types if you didn't turn off Visual Studio's intellisense. What version of VS are you using?
What do you think?
Or you can just try omitting folders from parsing once it's implemented and report back if it's doing what you want or you do need something else. |
|
|
chrisaverage
Junior Member
Poland
20 Posts |
Posted - Aug 09 2015 : 04:50:27 AM
|
I'm currently using VS 2012 and 2013, with plans to move to 2015 with some of the content as soon as there's a Qt add-in ready for that version.
I just tried turning off VA (oh my, the IDE feels so broken without it ;) ) to check how VS intellisense is handling generated content. It seems ok. It's a shame to loose some list enhancements like listing non-inherited members first and bold, but I can live with that for generated content.
I'm looking forward to the folders omitting feature. It sounds like a great addition that should take care of this case too. Thanks and keep up the great work. |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Aug 11 2015 : 06:54:29 AM
|
*ah* You are very proactive I like your results and your conclusions.
We are planning to do this kind of filtering soon, so it should help in your case as well:
case=21519 |
Edited by - accord on Aug 11 2015 06:55:18 AM |
|
|
|
Topic |
|