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

Allow users to turn off automatic checking of extension updates #55087

Merged
merged 3 commits into from
Jul 27, 2018

Conversation

ramya-rao-a
Copy link
Contributor

@ramya-rao-a ramya-rao-a commented Jul 25, 2018

Based on #54354 (comment) we abandoned the idea of a complete offline mode controlled by a single switch.

Instead, we are opting for all background features that do make a network request to be controlled via corresponding settings.

The extension update service is one such feature. This PR adds a new setting to control the extension update checks

@ramya-rao-a ramya-rao-a requested a review from sandy081 July 25, 2018 19:35
@ramya-rao-a ramya-rao-a self-assigned this Jul 25, 2018
type: 'boolean',
description: localize('extensionsAutoUpdate', "Automatically update extensions"),
default: true,
type: 'string',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramya-rao-a This will break existing users settings file right? This will show a warning if the value is true or false.

May be we should support both types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supporting both types would make documenting this feature very confusing as false doesnt really mean turn off checking for updates, it only means continue to check for updates but dont install them automatically

this.enabled = configValue !== 'checkAndInstall';
} else {
this.enabled = configValue === 'checkAndInstall';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be you should start writing the enum value instead of boolean ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I also removed the updateEnablement check to keep this simple. There is already a check in place to add the right action to the secondary menu in the extensions view which is good enough.

}

private eventuallySyncWithGallery(immediate = false): void {
if (this.configurationService.getValue(AutoUpdateConfigurationKey) === 'off') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of this method is confusing with the new setting. This should be called checkForUpdatesAutomatically

@@ -414,6 +415,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
if (this.isAutoUpdateEnabled()) {
this.checkForUpdates();
}
if (!this.continuousSyncSetup && this.configurationService.getValue(AutoUpdateConfigurationKey) !== 'off') {
this.continuousSyncSetup = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this variable needed ? If the value has changed you should either stop or start automatic checking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the config setting changed to off, then the loop for syncing is stopped. I added this to start the loop again. But on second thoughts, I can achieve the same without adding a new variable. I'll do that

@@ -452,7 +453,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
new Separator(),
...(this.extensionManagementServerService.extensionManagementServers.length > 1 ? [this.groupByServerAction, new Separator()] : []),
this.instantiationService.createInstance(CheckForUpdatesAction, CheckForUpdatesAction.ID, CheckForUpdatesAction.LABEL),
...(this.configurationService.getValue(AutoUpdateConfigurationKey) ? [this.instantiationService.createInstance(DisableAutoUpdateAction, DisableAutoUpdateAction.ID, DisableAutoUpdateAction.LABEL)] : [this.instantiationService.createInstance(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL), this.instantiationService.createInstance(EnableAutoUpdateAction, EnableAutoUpdateAction.ID, EnableAutoUpdateAction.LABEL)]),
...((autoUpdateConfigValue === true || autoUpdateConfigValue === 'checkAndInstall') ? [this.instantiationService.createInstance(DisableAutoUpdateAction, DisableAutoUpdateAction.ID, DisableAutoUpdateAction.LABEL)] : [this.instantiationService.createInstance(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL), this.instantiationService.createInstance(EnableAutoUpdateAction, EnableAutoUpdateAction.ID, EnableAutoUpdateAction.LABEL)]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the issue with changing the type and we have to carry forward this knowledge for ever. May be we can expose this value from IExtensionWorkbenchService and have only single place to know about this?

enumDescriptions: [
localize('extensionsAutoUpdateCheckAndInstall', "Install extension updates automatically in the background."),
localize('extensionsAutoUpdateCheck', "Check for extension updates and mark extensions with available updates as outdated in the extensions view."),
localize('extensionsAutoUpdateOff', "No checks are made automatically for extension updates. You can still manually check for updates using the `Extensions: Check for Updates` command.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is "extensions.autoUpdate": "off" implies that extension update checks will not be made? How about having a new setting extension.autoCheckUpdates?

@ramya-rao-a ramya-rao-a changed the title Overload autoupdate setting to allow complete switch off Add setting to turn off automatic checking of extension updates Jul 26, 2018
@ramya-rao-a
Copy link
Contributor Author

ramya-rao-a commented Jul 26, 2018

@sandy081 I've added a new setting to simplify things.

@Tyriar
Copy link
Member

Tyriar commented Jul 26, 2018

How is "extensions.autoUpdate": "off" implies that extension update checks will not be made? How about having a new setting extension.autoCheckUpdates?

"extensions.autoUpdate": "off" implies that a check will not be made because it's the only value without "check" in it (and there are descriptions which explain). I'm 👎 for adding an extra setting because there are only 3 valid states, doing this doesn't make any sense and its behavior is hard to define:

"extensions.autoCheckUpdates": false
"extensions.autoUpdate": true

This discussion reminds me of the discussion around files.hotExit and we landed on this for that exact reason:

  //  - off: Disable hot exit.
  //  - onExit: Hot exit will be triggered when the last window is closed on Windows/Linux or when the `workbench.action.quit command` is triggered (command palette, keybinding, menu). All windows with backups will be restored upon next launch.
  //  - onExitAndWindowClose: Hot exit will be triggered when the last window is closed on Windows/Linux or when the `workbench.action.quit command` is triggered (command palette, keybinding, menu), and also for any window with a folder opened regardless of whether it's the last window. All windows without folders opened will be restored upon next launch. To restore folder windows as they were before shutdown set `window.restoreWindows` to `all`.
  "files.hotExit": "onExit",

@ramya-rao-a
Copy link
Contributor Author

ramya-rao-a commented Jul 27, 2018

@Tyriar 2 reasons why overloading the existing setting is not a good idea from the user's prespective are

  • The Enable/Disable Auto Update actions convey the idea that this a feature with only 2 stages. On and off.
  • The most common case where users want to disable the auto-update extension is when they have installed an older version of the extension due to some issues with the latest version. When such users try to edit this setting in the settings editor, it could happen that they read the extension name "autoUpdate" and then choose "off" assuming its the auto-updates that is getting switched off. This will make them end up in a state where they get no further updates. Of course, the descriptions makes everything clear, but not everyone reads description if they feel the setting name is self explainatory.

I'm 👎 for adding an extra setting because there are only 3 valid states

That is true. When autoUpdate is true but autoCheckUpdates is false, I think its a fair compromise that the former wins.

@ramya-rao-a ramya-rao-a changed the title Add setting to turn off automatic checking of extension updates Allow users to turn off automatic checking of extension updates Jul 27, 2018
@Tyriar
Copy link
Member

Tyriar commented Jul 27, 2018

it could happen that they read the extension name "autoUpdate" and then choose "off" assuming its the auto-updates that is getting switched off. This will make them end up in a state where they get no further updates.

@ramya-rao-a 👍 I'm convinced after reading this, as we want to discourage setting it to the "off" state.

@ramya-rao-a
Copy link
Contributor Author

ramya-rao-a commented Jul 27, 2018

alright, then everyone here is on the same page :)

Updated PR to reflect the changes to get the new setting. Over to you @sandy081

@ramya-rao-a
Copy link
Contributor Author

@sandy081 The PR now reflects your suggestion of a new setting. I'll merge it now, as we would like to have it in the Monday's Insiders. Do take a look regardless and let me know if you have any other concerns.

@ramya-rao-a ramya-rao-a merged commit 5039c23 into master Jul 27, 2018
@sandy081
Copy link
Member

Thanks @ramya-rao-a for the changes

@Tyriar Tyriar deleted the ramyar/auto-update branch August 13, 2018 14:50
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants