Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbar button is initially incorrect #13

Closed
jnm2 opened this issue Mar 5, 2018 · 8 comments
Closed

Toolbar button is initially incorrect #13

jnm2 opened this issue Mar 5, 2018 · 8 comments

Comments

@jnm2
Copy link
Contributor

jnm2 commented Mar 5, 2018

Opened VS, started debugging, opened options without changing anything:

image

After clicking, the icon stays untoggled (because it toggled, like it is supposed to).

I think this is what was behind #12. I don't know why I worked around this so long without reporting it—keyboard shortcut makes life easy, I guess! 😄

@jnm2
Copy link
Contributor Author

jnm2 commented Jul 24, 2018

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?

@jcansdale
Copy link

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.

@jnm2
Copy link
Contributor Author

jnm2 commented Jul 24, 2018

At the end of the day, I like looking at the button to see if it's on.

@jcansdale
Copy link

jcansdale commented Jul 24, 2018

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.

See:
https://docs.microsoft.com/en-gb/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions

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?

@jnm2
Copy link
Contributor Author

jnm2 commented Jul 24, 2018

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?

@jnm2
Copy link
Contributor Author

jnm2 commented Jul 24, 2018

(I'd still want to be able to bind my keyboard shortcut to toggle, too.)

@jcansdale
Copy link

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)]

@jnm2
Copy link
Contributor Author

jnm2 commented Jul 25, 2018

Done: #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants