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.92k stars 363 forks source link

Feature request: Make codemaid operations more asynchronous, with progress bar #785

Open astrohart opened 3 years ago

astrohart commented 3 years ago

Environment

Description

When CodeMaid processes long files, there is a lot of CPU consumption. This fact is understandable, and it is not why I am raising this issue today.

My point is, these files can sometimes take a while for CodeMaid to process, and it seems like it's a very synchronous process. I am talking about after I press the CTRL+M,SPACE chord. I suggest you use more task-based programming approach to keep the VS GUI more responsive during the operation, so I can work on other files whilst I am waiting for the current one to be cleaned, etc.

Steps to recreate

  1. Open a very large (many lines) .cs file in VS.
  2. Run CodeMaid on it (with Reorganize also enabled).

I am attaching an export of my CodeMaid.config file to this post. Perhaps this file can be utilized in a testing environment to configure CodeMaid the same as mine is, so as to be better able to reproduce the issue.

Current behavior

VS 2019 can freeze or hang -- sporadically -- when cleaning and reorganizing a really long .cs file.

Expected behavior

The process should allow me to interact with VS and be productive even whilst the operation is taking place in a more responsive manner.

Moreover, it would be nice if the VS status bar could display a progress bar -- even a marquee would be okay, but an actual continuous progress bar would be a nice-to-have -- during the operation so that I could know that it's doing something and not freezing.

The following is a ZIP file containing my CodeMaid.config: CodeMaid.zip

codecadwallader commented 3 years ago

Thanks for making the feature request. I definitely agree with you that it would be ideal if CodeMaid could work more in the background. Currently a lot of the VS APIs we leverage require a document to be the active/focused document in the IDE which limits our ability to work on cleaning one file while the user is editing a different file.