codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.88k stars 352 forks source link

Spade takes too long to render document outline. Re-pinning/Re-docking the window seems to solve it. #1044

Open Nirvaxstiel opened 4 months ago

Nirvaxstiel commented 4 months ago

Environment

Description

Spade takes too long to render document outline on save. However, redocking, pinning & unpinning spade window solves the issue. It may be due to monolithic code base but I can't tell for sure.

Steps to recreate

  1. Pin Spade to the side
  2. Make changes to existing C# file.
  3. Save File
  4. Stuck rendering the document
  5. Unpin the spade window (this will hide it and push it to the side)
  6. Open spade from the side as a floating window and observe the document updated.

Current behavior

Takes too long to render the outline. I have not timed it, but the last time I tried going for a coffee break while it does this, it did not finish the job even after I was done brewing.

Expected behavior

Show some explicit messages on what is going on, or default to previous state and also show an error message.

kiemzbui commented 4 months ago

The same behavior is also apparent on my machine when I use the spade to manually reorder members (drag and drop).

I've been closing and reopening the spade with a hotkey to get it to refresh, but the pin and unpin also gets the spade to refresh its view. It seems like the spade reloads the outline very quickly but the spade window isn't notified of the change and the UI gets stuck in the 'refreshing...' state

Nirvaxstiel commented 4 months ago

Updated to VS 17.9.2. Now, it sometimes renders and at other times, it gets stuck again.

Apparently if I open documents by horizontal view, just unfocusing and re-focusing the working document fixes it. (i.e. If the left side is the issue, click the right side, and then back to the left side again.)

jacobh12349 commented 3 months ago

Ya, this has been happening for me lately too, it's probably a bug in the extension code.

cat-turnec9 commented 2 months ago

I've noticed this behaviour consistently in VS 17.9.6. After I make any change to a file, launching CodeMaid Spade will result in the pane getting 'stuck' loading. If I close and re-open the pane, it loads fine. Then any change I make in Spade (like reordering methods, etc) will result in getting stuck loading again, to be fixed by closing and re-opening the pane.

jacobh12349 commented 2 months ago

Ya, this has been happening for me lately too, it's probably a bug in the extension code.

I didn't code this extension, but I'm pretty good at coding, so I did a little debugging in this extension's source code, and I found why this is happening, it happens on this line of code. For some reason, the Document and the codeModel.Document aren't equal here after it finishes building the code model asynchronously, so the UpdateViewModelRawCodeItems method doesn't get called here, so it doesn't load it and just keeps the loading thing there. I made a temporary fix for this on just my computer by changing the if (Document == codeModel.Document) to if (Document.FullName == codeModel.Document.FullName) but that shouldn't need to be done though, so the creator of this extension just needs to figure out why those Documents aren't equal there to fix this bug.

https://github.com/codecadwallader/codemaid/blob/c25e452e635f29ce5a064788cffa2a65b3a62753/CodeMaidShared/UI/ToolWindows/Spade/SpadeToolWindow.cs#L317

jacobh12349 commented 2 months ago

@codecadwallader

Ya, this has been happening for me lately too, it's probably a bug in the extension code.

I didn't code this extension, but I'm pretty good at coding, so I did a little debugging with this extension's source code, and I found why this is happening, it happens on this line of code. For some reason, the Document and the codeModel.Document aren't equal here after it finishes building the code model asynchronously, so the UpdateViewModelRawCodeItems method doesn't get called here, so it doesn't load it, and just keeps the loading thing there. I made a temporary fix for this on just my computer by changing the if (Document == codeModel.Document) to if (Document.FullName == codeModel.Document.FullName) but that shouldn't need to be done though, so the creator of the extension just needs to figure out why those Documents aren't equal there to fix this bug.

https://github.com/codecadwallader/codemaid/blob/c25e452e635f29ce5a064788cffa2a65b3a62753/CodeMaidShared/UI/ToolWindows/Spade/SpadeToolWindow.cs#L317

@codecadwallader

michel-pliant commented 1 month ago

Same problem here with VS 17.9.6