MBulli / SmartCommandlineArgs

A Visual Studio Extension which aims to provide a better UI to manage your command line arguments
GNU General Public License v2.0
98 stars 35 forks source link

SmartCommandlineArgs should not override commandline if not used #160

Closed lordOznek closed 6 months ago

lordOznek commented 1 year ago

Hi! I have generated solution with default command arguments. It took me some time to figure out that the extension erased the command arguments. As I never add an argument via SmartCommandlineArgs, I would prefer the extension to not override the debug arguments. Would it be something acceptable to "disable" the extension if no arguments was edited via SmartCommandlineArgs (for instance, disable if no args.json file is found).

Irame commented 1 year ago

Sorry for the inconvenience. I have implemented something where the extension is disabled by default when a solution is first opened. Then you can decide for every solution to enable the extension by clicking "Enable" in the extension window. After enabling, the currently used arguments are gathered from the project configurations. From that point on, the extension controls the arguments (except you disable it via the settings with "Manage Command Line Arguments"). There is also an option to restore the old behavior by setting "Enabled by default" in the options to true.

Would this solve you problem and are you willing to test this?

I still have two open problems:

  1. What should be the default of "Enabled by default". (I think "False".)
  2. Should I add an option to disable the extension after it was enabled. (I think no, because the settings "Manage Command Line Arguments" and "Manage Environment Variables" exist.)
bencoderer commented 12 months ago

Thanks for working on this issue.

ad 1. The default value for the global "Enabled by default" should be false. The extension should only have an effect on a solution were actively activated. Important: When the solution already has an *.args.json-file, then the extension should be enabled. ad 2. When disabling "Manage Command Line Arguments" allows setting the command line arguments through the project settings again, then, there is no extra option necessary.

You assumtions should work fine.

I'm looking forward to test the fixes.

Irame commented 11 months ago

Hi, thanks for the response. I have replaced the boolean option "Eabled by default" with a tri state option "Enable Behaviour":

You can als disable the extension completely for the current solution without loosing any data in the settings dialog.

I have done some major refactoring in the background to make the code more testable. Since the codebase is quite old and only sporadically maintained this is sill and ongoing challenge. It would be nice if you could test it as thorough as you can and open issues for any unwanted behaviour.

Thanks in advance for testing!

I had to zip it because GitHub does not allow *.vsix files as attachments... SmartCmdArgs17.zip (VS2022)

lordOznek commented 11 months ago

Hi @Irame, Thanks for the feature. It perfectly fits my needs. It was our main impediments from using this awesome extension more broadly. When can we expect this update to be available?

lordOznek commented 11 months ago

Would it be available for VS2019 as well?

Irame commented 11 months ago

Yes, of course!

Here are the test versions for VS 2019 and 2017 SmartCmdArgs16.zip (VS2019) SmartCmdArgs15.zip (VS2017)

bencoderer commented 11 months ago

I did already some tests with the VS2022 extension. One issue found:

  1. Config stored in suo-file
    • Problem: When the SmartArgsConfig is stored in the .suo-file and not in the args.json-file, the extension needs to be enabled for the solution.
    • Solution: Enable the extension automatically when there are already command line args configured in the suo-file
    • Note: The config already stored in the .suo-file was correctly loaded after enabling the extension for the solution

Some notes

  1. accidentally activation
    • Problem: if I accidentally activate the extension for the solution, I can't revert that action easily.
    • Solution A: Add a "Disabled Extension for the solution" Buttion/Link to the Options-Page * Solution A expected advantage: When reenabling the extension for the solution later again, the args-config is initialized again from current store (.csproj.user, launchsettings.json, ...) when there is no smartargsconfig yet (so this is an edge case)
    • Solution B: Add a Button/Checkbox that disables all three checkboxs (Manage CLA, ENV, WorkDir) at once, so just a GUI logic.