vscode.extensions Doesn't Update On Installing / Removing / Disabling Extensions without restarting

Created on 25 Oct 2016  路  52Comments  路  Source: microsoft/vscode

I need to configure my extension code-settings-sync with the feature that when a user installs the extension and doesn't restart the vs code and neither enable the extension, I need to make the sync backup for that extension when installed.


Installation Process : when installed and not restarted.

Expected Behaviour:
vscode.extensions.all should show the newly installed extension with enabled false flag

So I can get that extension and make a sync.

Current Behaviour
It doesn't appear in vscode.extensions.all until I restart the code by clicking the enable button or other way.


Uninstall Process: when uninstalled and not restarted.

Expected Behaviour:
vscode.extensions.all should not show that extension or some flag like removed true

So I can get that extension remove from user's list and make a sync excluding that extension.

Current Behaviour
It doesn't remove from vscode.extensions.all until i restart the code


This is the scenario for installing/ uninstalling.
Same goes for disabling and enabling the extension I need to know which extensions are disabled or enabled.

For the details @alexandrudima has explained very well on the comment below: https://github.com/Microsoft/vscode/issues/14444#issuecomment-256644225

*out-of-scope api extension-host feature-request

Most helpful comment

@shanalikhan Looks like the most wanting feature. Will bring it up during our next milestone plan. Thanks.

All 52 comments

@shanalikhan I would like to what is the need to have an extension that is disabled... I am trying to understand the functionality/feature that requires this.

Thanks

@sandy081

When you see my extension the main idea behind is to sync all the user installed extensions and settings file sync across multiple platforms.

When user install one extension and save the settings when it opens the code in office it does download the latest extensions and settings.

Initially user were able to sync these things manually to server and download then manually, now my aim is to make this process automatic so when user change any settings it upload all the settings file and the extensions to the server and download the settings and extensions when code is opened in other computer or office.

For now, the automatic process is working fine with the settings as when the settings change it automatic upload the settings and other data files in the server but for extension i am facing issue when the extension is download it doenst initialte the upload process as that object doenst contains all the extension that were downloaded untul the code is restarted so it would be better to add the downloaded extension in the list of extensions in the code but with a flag that shows its not enabled yet waiting for restart so i can save the settings.

Hope you know all the process now :)

Why do you need to sync the settings for a newly installed extension given that extension is not enabled or running. Settings of such extensions are not available they are active. It means user cannot modify settings of them.

So, I am thinking what is the use case of Syncing such settings which are not active and not modified?

i think Installing the extension should be seperate from the scenario of enabled or not.
Also when user install the extension i havent seen any property to disable the extension.

Also when user installs the extension on next restart the it will be enabled already so why not updating the object even on installing with a flag its disabled or enable ,as its already updating on restarting.

This is for my scenario for now, if it adds in the object many other doors to code for other extension would open

@shanalikhan Sorry, I still do not understand that what is the issue / what functionality is missing when you get the settings after restart?

Is it that you are trying to sync / export installed extensions information ?

I think it is not a good idea just to open the doors for everybody without a proper use case.

Anything can be applied by some extension A that has funtionality when user downloads any extension B , A should performed some task.

Is it that you are trying to sync / export installed extensions information ?

Yes, instantly on when the extension is downloaded.

Anything can be applied by some extension A that has funtionality when user downloads any extension B , A should performed some task.
A proper use case should define the task.. not some task :)

So your issue is that if user installs an extension and does some export / sync using your extension (without restart), you do not have information about the installed extension and same with uninstalled extension ?

@alexandrudima Here is a scenario where extension writers need more extension info (enabled / disabled) to export user preferences like installed extensions and others

I think the underlying desire here (and @shanalikhan correct me if I'm wrong) is to synchronize Visual Studio Code's state across machines. If that is the case, then there are a lot more (some even more basic) things to consider:

  • theme
  • installed extensions (also the disabled ones)
  • selected extension enable/disable options
  • view state (what files are in the working set, where is the cursor position inside them)
  • all other things we store in mementos (there are a lot more, such as last string searched, etc etc)

Regarding the disabled extensions, I think the problem is that @shanalikhan 's code might think that the extension got uninstalled meanwhile it is only temporarily disabled. We can think about listing disabled extensions in vscode.extensions.all, but then we'd need to prohibit calling activate() on such disabled extensions.

@shanalikhan Am I close to understanding your scenario?

Yes, Thanks
Look forward for it.

There is already another issue opened for API support for Themes and file icons:
https://github.com/Microsoft/vscode/issues/12178

and Disabling Extensions with API :
https://github.com/Microsoft/vscode/issues/15466

May be one single feature can cover then all in upcoming build so Code Settings Sync extension will start working with its full features

There are above 150 votes for this feature.
Any update when it will be done

@shanalikhan Looks like the most wanting feature. Will bring it up during our next milestone plan. Thanks.

Now that it has been decided this is going to be added to the milestone plan....can the prompt in VS Code when we update this extension be removed?

+1

+1

+1

+1

+1

+1

Issue Included on May Iteration Plan !
Thanks Team!

Code Settings Sync is Going to Become Much Better !
馃槃

@shanalikhan May I know how are you uploading and downloading the extensions? Are you just using the extension name to sync across machines?

Im using just extension names data for extension like for upload

 {
    "metadata": {
      "id": "d0bfc4ab-1d3a-4487-8782-7cf6027b4fff",
      "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
      "publisherDisplayName": "Microsoft"
    },
    "name": "csharp",
    "publisher": "ms-vscode",
    "version": "1.9.0"
}

and then downloading zip from marketplace using this detail and extracting in the extension folder.

@shanalikhan Is not that just identifier ms-vscode.csharp would be sufficient? Also did you try installing it with cli code --install-extension ms-vscode.csharp instead of downloading it yourself?

@sandy081 installing and uninstalling is not an issue. and sync extension is doing it successfully but required code restart.
My scenario is the top behavior as i want to know which extension is removed or install or disabled before restarting code from the way i have describe in the first comment

@shanalikhan Agreed. Idea is if we want to expose disabled extension or an extension is installed/uninstalled/enabled/disabled we would be exposing only the identifier. Hence, I suggested to use the cli to install which just need the identifier.

Yes, i will add CLI in upcoming releases.

Can CLI get any other version that is not latest from the marketplace ?

As currently the way im doing user can even install the older version of extension.

expose disabled extension or an extension is installed/uninstalled/enabled/disabled we would be exposing only the identifier

As far i understand, The way you are suggesting that API will have a function will return the array of the identifiers of extension that are installed/uninstalled/enabled/disabled ?

Dont you think the better way would be to have those flags in the vscode.extensions.all in each extension object ? like this

 {
    "metadata": {
      "id": "d0bfc4ab-1d3a-4487-8782-7cf6027b4fff",
      "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
      "publisherDisplayName": "Microsoft",
      "workspaceEnabled" : true,
      "enabled" : true,
      "removed": true, // or any other key
      "activated" : true
    },
    "name": "csharp",
    "publisher": "ms-vscode",
    "version": "1.9.0"
}

One more thing, would i be able to disable the extension from the API when i sync any extension identifier and its state like its enabled or disabled ( even for some workspace) - when user install the disabled extension using my extension, Sync extension must should be able to disable that installed extension

@shanalikhan

Current contract of vscode.extensions.all api is to return all those extensions running in the system. Changing this to also include extensions which are not running will break the semantics of the API. So other extensions should be provided through different api say vscode.extensions.disabled.

We can either include the complete extension description of each disabled extension or just the identifier. I would prefer to have minimal and only necessary information to be passed.

First of all, I do not think it is a good idea that an extension downloads another extension in user extensions folder to install an extension. This looks to me a backdoor which could be problematic. Since there are APIs (CLI) to install an extension, I would prefer using that. Hence I also did not suggest, to read the extensions folder directly and know about disabled/installed/uninstalled extensions.

I would say to use the API/CLI to either install/uninstall/enable/disable extensions. If there are any gaps, we can work out to fill them.

Thanks

vscode.extensions.disabled giving the disabled extension would be fine.
If you go with this approach i think the running extenion should be then on vscode.extensions.enabled

As having all showing the enabled and disabled showing the disabled extension doesn't look very convenient. I would suggest then all include all the extensions and enabled should show the running extensions like disabled.

With the mimimum information when get from the enabled or disabled the complete details for that extension can be retrieved from the all for that extension.

Anyway vs team knows better to decide.

The time i written the code Code doesnt allow to install extension by CLI and i am getting old version of extension by making request to marketplace as some people sync old version of extensions also.

I will convert completely to CLI when it provide a way to install/uninstall/enable/disable with the options like :

  1. Install Extension by any Version Name of extension
  2. Uninstall is 馃挴 fine.
  3. Disable any extension by identifier.
  4. Enable any extension by identifier.

Disable/ Enable any extension currently not available from API also.

While working on this issue, it would be great if you guys provide the CLI for the 3 / 4 things defined.
So i know i can disable the extension immediately from CLI or API when installing, enable any extension when installed.

As having all showing the enabled and disabled showing the disabled extension doesn't look very convenient.

Agreed. It does not look correct. But this is an existing API and changing this will break extensions. Hence not suggested.

Instead, I would propose to have access to currently installed, and disabled extensions from which you can read the id and version.

Yes that would be fine along with a function to enable/disable them globally or in work space via API.

@shanalikhan Here is the suggested API (same as your suggestion) I would like to go with

  • vscode.extensions.all provides the current extensions for the given current instance of vscode. This gets updated when an extension is installed/uninstalled.
  • vscode.Extension object contains a property to provide the enablement state.
  • vscode.extensions.onDidExtensionChange event to listen to if any extension changes.

But, following is the pre-requisite needed for this API

  • Live update of extensions. When an extension is installed/uninstalled vscode editor should be updated without refresh needed.

Instead of coming up with some intermediate solution, I would prefer to do the right solution. Which means we need to defer this until the pre-requisite is implemented.

Also, giving access to extensions to enable/disable other extensions through API is not a good idea. This should need user involvement. So, I am afraid that this feature will not be exposed.

All the three things you have provided is perfect.

Which means we need to defer this until the pre-requisite is implemented.

Yes those things will be done when Live Update of extensions are completed. No problem, take your time to do this so i can have the updated all

This should need user involvement.

For this purpose, what can be done to have a API function that will ask user on which i can pass the extension identifier and it should ask user that extension is asking to disable / enable the following extensions and the list i have passed.
If user hits OK, that should return predicate and i will show user the required extension list has been disabled / enabled
But this is the required thing for my extension for sync as user will be asking to disable the extension which is already disabled on other computers.

@shanalikhan Sure will consider your proposal for enablement/disablement when I get back to this.

Thanks.

I see this issue as deferred in the iteration plan ?
What are the plans to start work on it or the Live Update of extension ?

@shanalikhan That's a big fish. No plans as of now. Will update you when we do. Thanks.

@sandy081 would restarting the extensions as soon as they're updated fix this? Multi-root (https://github.com/Microsoft/vscode/issues/396) might eventually allow loading of folders without a full reload which may involve restarting the extension host as well. If so, this seems preferable to adding API imo.

@Tyriar I think restarting the extension host might not be expected in this case. This will reset all extensions when an extension is installed/uninstalled, which is not correct. We need soft update of extension host.

@alexandrudima @sandy081

I have recently converted Settings Sync extension installation to CLI Based.
It would be nice if you guys can let me know what are the plans for API.

That's a big fish. No plans as of now. Will update you when we do. Thanks.

This issue has been opened since 2 years
If there is no plan for 2 more years i will convert the Settings Sync from all the extension related things to CLI based methods.
Like currently i am reading from extensions.all object - will convert to CLI --list-extensions it will take alot of time to migrate all the things to CLI in Settings Sync but i want to be sure about the plans.

@shanalikhan Sorry about it and it is still the same status about it. Since it's been some time and things would have changed and it seems this issue got distracted with multiple other requests, can you please consolidate your requests?

can you please consolidate your requests

Yes, can you please explain what do you mean.

My issue is the first post, and this comment is what i need https://github.com/Microsoft/vscode/issues/14444#issuecomment-256644225

What I meant is to validate your features list and consolidate them in the description. It will be easy to get lost if not in description.

alright, it would be great if you can raise this issue in your next meetings with the teams and let us know about the updates when would be possible to implement this.

image

Are there any news on this?

More than two years after opening this issue, a minimum of at least 1000 user want this feature and all we do is waiting? Is there anything we can do to speed things up? It's a bit annoying how useful extensions trying to help automate things are blocked by such a minimal extension API..

https://code.visualstudio.com/updates/v1_31#_no-reload-on-install

There's definitely work happening on this.

@shanalikhan With 1.31 release we expose extensions.onDidChange when extensions change, like when an extension is installed/uninstalled/enabled/disabled/

But an extension is added or removed only if it supports no reload.

Let me know if this is good enough, if not, please update the additional requirements on top of it?

Hi @sandy081,

What I understand is needed is an API that exposes all the installed extensions and enablement state per workspace, that also differentiates between built-in and external ones.

This is specially true when one works with different projects involving different technology stacks -- _what makes enabling and disabling extensions per workspace a bless_.
This, I think, is a behavior a lot of us are looking for VSC to have.

Right now, every time I set up a new project, I have to spend again a good amount of time to manually replicate the configuration on the other (two) machines.

Thanks!

My experience with VS Code so far is not pleasant at all. First, I have tried to install the 'Live Server' extension from the list of extensions, but there seems to be no extensions at all in my VS Code editor. Is there something I am missing please
Screenshot_2020-07-29_19-12-21

Secondly, I have tried to type in the basic command of '$ whoami' in the command line but the editor is not returning any results at all
5

We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

We support Settings Sync feature inside VS Code as a core feature now - https://github.com/microsoft/vscode/issues/2743

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sijad picture sijad  路  3Comments

curtw picture curtw  路  3Comments

borekb picture borekb  路  3Comments

chrisdias picture chrisdias  路  3Comments

mrkiley picture mrkiley  路  3Comments