Search code examples
visual-studio-code

VS Code - how to rollback extension/install specific extension version


Just got an update for the Golang extension and it appears to be broken, reporting an error on a package main that's literally just a list of my imports with no useful information (see screenshot below). It's refusing to lint or do anything useful which is annoying.

screenshot of error in VS Code

So I want to quickly jump back to the previous version, how can I do this in VS Code? I can't seem to find it in the docs at all.

NB: I'm using VS Code version 1.10.1 with only the golang package. The code is valid golang.


Solution

  • Update for vscode v1.91, see Release Notes: extension install options:

    We added more options to give you more flexibility when installing extensions:

    Install an extension without syncing it.
    
    Install a specific version of an extension. Previously, you first had to install the latest version of the extension before you could
    

    select a specific version.

    These actions are available in the context menu of the extension in the Extensions view:

    Release Notes for v1.91 extension install options

    So you can directly install a prior version of an uninstalled extension without first having to install the latest version. The option to install another version is also available in the Extensions list (via the context menu or Gear icon) for already installed extensions.


    From v1.30 release notes: install previous versions of extensions.

    You can now go back to a previous version of an extension if there are issues with the current version. VS Code provides an Install Another Version action on an installed extension which shows a dropdown of available versions.

    The option to install another version is in the context menu. Or the gear icon for each extension. Or the Extension Page in vscode: Uninstall dropdown: Install another version....

    For me when I do this - without "Disable Auto Updating Extensions" (I assume that the Debugger for Chrome is such an extension) it does not auto-update on reload or close/open but shows a button for that extension to install the latest version instead.

    So it appears you don't have to disable all auto-updating extensions just to revert one extension to an older version and keep it at that older version. [leave a comment if you find that isn't true, thanks]

    Update for vscode v1.75:

    See pinning extensions (to a specific version):

    Make sure you have extension autoupdates enabled and try pinning extensions to a specific version using following UI. Make sure extensions are not getting auto updated after pinning.

    From CLI : Install a specific version using following format - code-insiders --install-extension [email protected]

    From Extensions UI - Use *Install Another Version... action in the context menu of the installed extension.

    Make sure the pinned version is synced across VS Code instances - Use Settings Sync feature to test this. To have different instances of VS Code on same machine, open VS Code from CLI using different user-data-dir and extensions-dir. Eg: code-insiders --user-data-dir <path> --extensions-dir <path>

    Export and Import the profile with the pinned extension and make sure in the imported profile, extension is still pinned. Export and Import profile actions are available in the global activity context menu (gear).

    Si it appears that regardless of the Disable Auto Updating Extensions setting, pinning/reverting to a previous version of an extension should result in that extension not updating.

    revert extension 1

    revert extension 2