Git Product home page Git Product logo

Comments (26)

codecadwallader avatar codecadwallader commented on July 30, 2024

If you run the collapse command again (or turn off the setting to run at startup and do it once after the solution is loaded) - does it work as expected?  Seems like something may be triggering after CodeMaid's collapsing that causes it to reopen.  Do you have track active item in solution explore selected?  Does this happen with any solution or just specific ones?

On Fri, Aug 1, 2014 at 5:23 AM, Otiel [email protected] wrote:

It seems that the option to collapse solutions when they are opened do not work anymore.
When I open a solution, it is collapsed at first, but when the Solution Explorer finishes to load the solution, it takes back its expanded state as it was when I did exit VS.

I'm using VS 2013 and the option "☑Collapse solutions when they are opened" is correctly checked.

Reply to this email directly or view it on GitHub:
#6

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

It works as expected when I run the Collapse command.

"☐Track Active Item in Solution Explorer" is unchecked.

It happens with four different solutions I tested.

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

Thanks for checking that out. Do you have a minimal solution that you could attach? I haven't been able to reproduce it yet.

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

I've created a solution quickly, doesn't work with it either: http://www.speedyshare.com/q5utJ/download/WindowsFormsApplication1.zip

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

Thanks for the sample solution, but I've unfortunately still been unable to reproduce the issue. I tried with different combinations of projects open, different combinations of sub-items (like References) open, different files open/active (including a Windows form), and launching Visual Studio first then opening the solution vs. opening the solution to launch Visual Studio.

Some other ideas:

Are you doing anything within the solution explorer while it is still loading projects?

Did you have the problem with the previous version (https://bitbucket.org/s_cadwallader/codemaid/downloads/CodeMaid_v0.7.2.vsix)?

Do you have any solution folders in the projects where you're normally seeing the issues? They have a slightly different API then everything else (since they're a virtual item). That's a long shot though as the solution you sent me doesn't include any solution folders.

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

I'm not doing anything while the Solution explorer loads, just waiting for it to finish before touching anything.

I don't think I had the issue with v0.7.2, but I can't really be sure.

And no, I do not have any solution folder in my projects.

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

Other fact: it happens that the issue occurs when I open solutions from the sln file from Windows Explorer. When I open a solution via the regular menu ("File"→"Recent Projects and Solutions" for instance), CodeMaid successfully collapses the solution items.

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

I did try launching the solution directly to launch Visual Studio, both via double-click of the solution as well as the recent solutions when you right click on Visual Studio in the taskbar. I'm still seeing the collapse working as expected.

It definitely sounds like a race condition where something else is coming in and resetting the state after CodeMaid has ran its collapse. The collapse is triggered by the Solution.Open event raised after all of the projects have been loaded. Are there any other extensions that might also be running actions at that time?

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

Oh ok.

I've already tried to disable all other extensions I use (except Nuget Packet Manager that I can't disable), still the same result.

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

Hmm. I'm running low on ideas, but if you're up for running the code (see http://www.codemaid.net/contribute/) and debugging what's occurring within CollapseAllSolutionExplorerCommand's OnSolutionOpened method would be the best place to try and diagnose what's occurring in an environment that can reproduce the bug.

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

Got a bit of an issue when debugging:

Since the problem only occurs when I open solutions from their sln file from Windows Explorer, I can't reproduce it in Experimental instance of VS by going in "File"→"Open". Do you have an idea how can I open a sln file in the Experimental instance of VS (that I am currently debugging)?

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

Yeah you just need to pass the same command line arguments that the debugger does - take a look in project properties.

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

Ok thanks, got it.

So from what I can see, OnSolutionOpened is called twice:

  • Once when VS is started (no tool window is displayed yet on VS Exp),
  • And a second time when the solution is almost loaded (all projects appear loaded and collapsed but the Solution Explorer still indicates "loading...").

On both of these times, UIHierarchyHelper.HasExpandedChildren(topItem) returns false in the OnExecute() method, so UIHierarchyHelper.CollapseRecursively(TopUIHierarchyItem) is never called.

But that's after this second time that the solution is expanded in VS, like if the Opened event handler would be fired only after the solution was fully loaded. Weird...

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

That is odd, and I'm still not sure why I can't reproduce it.

There is a little bit of logic in the OnSolutionOpened method that will set a flag if there are no items present so the next status check will trigger the execution. Have you looked at that logic to see what's happening i.e. do some of the topItem.UIHiearchyItems exist but not all of them?

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

All topItem.UIHiearchyItems exist and topItem.UIHierarchyItems.Countis correct both times that OnSolutionOpened() is called.

I believe that the issue comes from the fact that my solution is expanded to its previous state after CodeMaid performs its logic. I have removed the check UIHierarchyHelper.HasExpandedChildren(topItem) in OnExecute() for CodeMaid to always collapse the solution, and that doesn't change anything, because the items are expanded after CodeMaid performs the CollapseRecursively.

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

Interesting. I wonder if Visual Studio is trying to reapply the saved state after it finishes loading all projects? When projects are being loaded it wouldn't be able to depict the expanded/collapsed states so maybe it comes in and sets them after the fact?

As a test, if the OnSolutionOpened call kicked off a timer that waited five to ten seconds after the solution was opened, and then collapsed the solution - I wonder if that would work as expected.

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

I don't have any experience developing VS extensions, so I wouldn't know what to answer you. 😄
But what I don't understand at all, is why I am apparently the only one getting this behavior.

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

My best guess is a configuration difference, or another extension that is causing different behavior. I'd like to help more, but it's very difficult to debug when I can't reproduce.

Did you try the timer test?

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

Configuration difference > maybe, but which config then? I don't see which one could cause this (I already have "track active item in solution explorer" unchecked).
Another extension > I've disabled all other extensions I have and the issue is still happening. Unless some extension saves some configuration that stays active even when the extension is disabled, hard to think it comes from here.

I did not try the timer test yet (I will be unable to test it until end of September, but don't give up on me, I'll try it as soon as I can 😄 ).

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

Fair enough, good luck when you get back to it. :) Will leave open in case anybody else sees it or has other thoughts on how to reproduce.

from codemaid.

DamonOverboe avatar DamonOverboe commented on July 30, 2024

Did you try having Otiel export the Visual Studio settings and then try importing them? There's a bit of a security warning if you export and import everything but that might help identify the conflicting problem. Nothing like an idea that's 2 months late!

from codemaid.

codecadwallader avatar codecadwallader commented on July 30, 2024

Closing due to inactivity at this time. Simply comment to reopen when/if desired.

from codemaid.

cooldrl avatar cooldrl commented on July 30, 2024

Where is the "Collapse solutions when they are opened" option? I have searched high and low for this as my solutions are collapsing on opened and I want it unchecked.

from codemaid.

Otiel avatar Otiel commented on July 30, 2024

@cooldrl : CodeMaid → Configuration → Collapsing:

screenshot

from codemaid.

cooldrl avatar cooldrl commented on July 30, 2024

Ah that explains it, I don't have CodeMaid installed. Funny though on some projects on load solution explorer expands to as I last left it, which is what I want, whilst on my latest project on load everything is collapsed in solution explorer. Do you think CodeMaid would fix this with the appropriate option unchecked? Thanks very much for your help and so prompt reply

from codemaid.

cooldrl avatar cooldrl commented on July 30, 2024

Sorted it. When using solution folders but not "Track Active Item In Solution Explorer" then said folders do not expand but on manually expanding stuff underneath is as last left. I am gonna try CodeMaid anyway. Thanks again for help.

from codemaid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.