Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How to prevent collapsing of the Class View tree on update

$
0
0

Hello,

I am implementing a package for Visual Studio which provides a custom project and language support. Currently I'm working on Class View implementation, which involves implementing IVsSimpleLibrary2 and IVsSimpleObjectList2 interfaces and registering the library. The data for the tree list comes from the language analyzer.

Basically everything works fine, as I can view the hierarchy and it updates correctly on user changes in the code. However, I have one small (but annoying) problem.

When I trigger an update by incrementing the counter returned by the UpdateCounter method, the whole tree gets collapsed. It is awkward, because the hierarchy disappears and the user must click a lot to expand it again. I am looking for some way to preserve the tree expanding through updates. The trouble is that I don't know how the tree view is actually implemented and how it works. This is very vaguely documented, so I can base only on experiments.

I figured out for instance, that if I do not increment the main update counter (returned by IVsLibrary object) but some counter deeper in the hierarchy, only a part of the tree gets collapsed. But surprisingly not the particular node which owns the counter, only its children.

I also looked at the IronPython project. It seems it has no such problem, but the tree in Class View are always 2 levels deep, so that they can just get away with incrementing the counter on the root node.

My tree has arbitrary depth and I can't precisely figure out which counter (on IVsSimpleObjectList2 level) to increment. This is because I do not get exact information from the language analyzer which part of the code changed. I get only new hierarchy structure and it would involve very tedious comparing these structures to find the changed node precisely. I'd rather opt for some simpler solution.

Is there any simple solution to this problem?

BTW. What is the purpose of IVsNavInfoNode interface? It could actually be used by the IDE to remember expanded nodes (solving my problem) but it does not seem to work. I implemented this interface and IDE queries for it (GetNavInfoNode), but never calls LocateNavInfoNode later on.


Best regards,
Ryszard


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>