Skip to content

Allow the "Dart: Use Recommended Settings" command to run silently #5159

Closed

Description

@pdblasi-google

Is your feature request related to a problem? Please describe.
During workspace creation on IDX, we're looking to use Dart's recommended settings to give users the best experience out of the box. When we execute the command from our extension, it shows a dialog that clutters the creation flow. It would be helpful to be able to call the command silently.

Describe the solution you'd like
Add a "silent" flag to the "Use Recommended Settings" command that defaults to false but can be set to true when called programmatically from a different extension.

Describe alternatives you've considered
Maintaining a separate copy of the recommended settings in IDX that would need to be maintained to be kept in line with Dart's recommended settings.

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Jun 27, 2024
  2. DanTup commented on Jun 28, 2024

    @DanTup
    Member

    @pdblasi-google if you call dart.writeRecommendedSettings without passing {showNotification:true} the notification will no longer be shown.

    But, are you already doing something to suppress the original prompt to set recommended settings? Otherwise I think our prompt might still be shown (the prompt I've allowed to be silenced here is just the confirmation that the settings were written, which is what I think you asked for).

    You can suppress the initial prompt about using recommended settings by having any dart setting already existing, or by having the use_recommended_settings context value set (which is what we write to avoid prompting more than once).

  3. added this to the v3.92.0 milestone on Jun 28, 2024
  4. pdblasi-google commented on Jun 28, 2024

    @pdblasi-google
    Author

    @DanTup Wow! Thanks for such a quick turnaround!

    Yes, I was asking about silencing the confirmation, we were already hiding the initial prompt by putting an empty "[dart]" entry in the machine settings, and with this change we can use dart.writeRecommendedSettings to fill that out with the latest Dart recommendations.

    One thing I noticed looking at the PR, it looks like that change will prevent the confirmation dialog when the user calls the command from the Command Palette as well? From the IDX perspective, we don't need to silence it from the Command Palette, but if that's the preferred user experience on your end that's all good, just thought I'd mention it.

  5. pdblasi-google commented on Jul 1, 2024

    @pdblasi-google
    Author

    Also, just for my planning on the IDX side, what's the usual release schedule for the extension?

  6. DanTup commented on Jul 1, 2024

    @DanTup
    Member

    I plan to do a release tomorrow (it should've been today but I got caught up with another bugfix for the analysis server). However...

    it looks like that change will prevent the confirmation dialog when the user calls the command from the Command Palette as well?

    That's a good point. I forgot that it can be called from there. I did originally consider making the prompt the default and requiring an opt-out flag to be passed - would that work for you? (you'd need to update your extension to pass the new flag). Otherwise, we'd need to have two commands (one you can call and one shown in the palette) which is essentially the same, but might not be quite as nice.

  7. reopened this on Jul 1, 2024
  8. pdblasi-google commented on Jul 1, 2024

    @pdblasi-google
    Author

    I'd intended on passing a parameter of some sort seeing as the functionality is pretty IDX specific. So we're all set for that on our end whether there's a parameter or not.

  9. DanTup commented on Jul 1, 2024

    @DanTup
    Member

    Great, in that case can I just reverse the default, and you can call:

    vs.commands.executeCommand("dart.writeRecommendedSettings", { showNotification: false });

    And we'll just show the notification if we don't get an explicit false? (eg. options?.showNotification !== false). I can include that in tomorrow's release if you're happy with that.

  10. pdblasi-google commented on Jul 1, 2024

    @pdblasi-google
    Author

    That sounds great! Thanks!

  11. DanTup commented on Jul 2, 2024

    @DanTup
    Member

    The notification now has an opt-out flag. Not passing the flag will show the prompt as previous.

    vs.commands.executeCommand("dart.writeRecommendedSettings"); // shows prompt
    vs.commands.executeCommand("dart.writeRecommendedSettings", { showNotification: false }); // does not show prompt

    The release including this will go out today, though it's also safe for you to pass the argument to older versions so you can start passing the flag at any time and it'll just work when the active extension is >= 3.92.0.

  12. added
    in commandsRelates to commands (usually invoked from the command Palette)
    on Jul 2, 2024
  13. pdblasi-google commented on Jul 2, 2024

    @pdblasi-google
    Author

    This worked perfectly! Thanks again for the quick turnaround!

  14. DanTup commented on Jul 3, 2024

    @DanTup
    Member

    No problem - thanks for confirming it's working as expected :-)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    in commandsRelates to commands (usually invoked from the command Palette)is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions