Closed jnm2 closed 6 years ago
I debugged the extension and it's immediately obvious that this is due to the package not initializing until the command is activated. @sharwell This still catches me and I've seen it catch a coworker recently. I'd love to make it autoload. What do you think?
Auto loading packages are evil. It's just too tempting to create them. 😉
This is actually why I thought a Start Debugging Just My Code
command might be a good idea. This wouldn't have a dependency on the initial state of the Just My Code
option.
At the end of the day, I like looking at the button to see if it's on.
Alternatively, we could have two JustMyCodeToggle
related commands, EnableJustMyCode
and DisableJustMyCode
. Their initial visibility would be determined by a UserSettingsStoreQuery
that looks at the users settings to to see if JustMyCode
is enabled or not.
EnableJustMyCode
would only be enabled when JustMyCode
is disabled. DisableJustMyCode
would only be enabled when JustMyCode
is enabled. You could give them appropriate icons and tooltips so you can see the state of JustMyCode
without auto-loading a package.
Does that make sense?
Sure, that's a nice workaround. I'm happy so long as I can see the state before I start debugging.
To play devil's advocate, what if we minimize the startup time of the package so that autoload to set the toggled state is fine? The settings query can't take more than what, a few milliseconds?
(I'd still want to be able to bind my keyboard shortcut to toggle, too.)
I dare say if you convert it to be an AsyncPackage
and used the following, it wouldn't hurt too much. 😉
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string, PackageAutoLoadFlags.BackgroundLoad)]
Opened VS, started debugging, opened options without changing anything:
After clicking, the icon stays untoggled (because it toggled, like it is supposed to).
I think this is what was behind https://github.com/tunnelvisionlabs/JustMyCodeToggle/issues/12. I don't know why I worked around this so long without reporting it—keyboard shortcut makes life easy, I guess! 😄