VS Code - how to rollback extension/install specific extension version - visual-studio-code

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.
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.

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 eamodio.gitlens#13.1.1
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.

[EDIT] now it is supported -> see accepted answer
Currently downgrading is not (yet) supported.
However, you can uninstall the extension and then manually download and install a specific version by hand: https://code.visualstudio.com/docs/extensions/install-extension
And also this excellent answer: How to install VSCode extensions offline?

Related

Please upgrade your Copilot extension to continue using this service

Today I tried to use the copilot, but suddenly this error start appearing:
[INFO] [fetch] [2022-05-19T21:00:55.452Z] Please upgrade your Copilot extension to continue using this service.
I tried to uninstall and install again and reload, but nothing happens, anyone have any idea how to solve this problem?
There's an error description in the image below:
This can be resolved by upgrading VSCode itself: Help → Check for Updates / Install Available Updates.
You may or may not need to re-install the extension and re-authenticate with git.
Reference: https://github.com/github/feedback/discussions/15684
In my case (on a mac) I had to do the following:
Move Visual Studio Code from Downloads to Applications
Restart
Update Visual Studio Code
Sign into Github
Open extensions and locate Github CoPilot
Click "Reload Required"
As #emragins suggested, go to Help and check for updates/restart to update
Once you are back on VS Code check if the Co-pilot is activated.
If it is not activated/still gives the same error.
Search for co-pilot in VS Code extensions search
Click on co-pilot extension in the search results, you should see restart/reload required.
Reload and it should be working now. If not try closing VS Code and opening it now.
You should uninstall the extension and download the latest version from this page in the form of VSIX file. After that you can install the extension from that VSIX file.
I think it is because there is some API changes and the latest version of the extension. However, it is still marked as preview. When we click on install from the built-in extension browser, it just install the latest stable version.
https://marketplace.visualstudio.com/items?itemName=GitHub.copilot
if you are on a linux device, update your vscode first then update your co pilot extension it will work.

VSCode: How to fix Python extension version for Python 2 compatibility and prevent automatic upgrade?

I have a legacy code using Python 2. The last version of VSCode Python extension that supports Python 2 is v2022.2.1924087327
It is very easy to change the extension to an older version.
My problem is that VSCode always automatically updates the extension. Since I'm using it in a remote machine, when I loose connection, it automatically updates the extension, and I must manually downgrade it, reload the window and start it again.
Is it possible to fiz the version of my Python extension in VSCode?
I've just found how to prevent extensions to automatically upgrade.
And I just set:
{
"extensions.autoUpdate": false
}
It will now ask me for each extension upgrade, it is an annoyance, but at least I can control it.
If someone finds how to disable auto update just for the Python extension, I'll mark it as the correct answer.

Install VS Code extension during development?

I am developing an extension for VS Code. This extension is already good enough for me to use during daily work, but not good enough to be published (yet). Is there a canonical way to make an unpublished extension under development available to VS Code? Optimally, I would like to always have the current state of the code running.
I did find a way that seems to work, but I'm not sure whether this is a terrible hack or okay: Create a symbolic link in VS Code's extensions directory (~/.vscode/extensions on Linux) to the development directory. Is there a better/official way?
You can package your extension (even if it's in development) using vsce with the command vsce package. This will create a .vsix file which you can install in your regular instance of VSCode in the marketplace menu (click on the ... icon at the top and select "Install from .vsix file).
If you need to view the logs of the extension, go to Help>Toggle Developer tools and use the console to view your extension's output (if there is any).

Forcing VS Code to install an extension without compatibility checking

I am using a custom build version of the Visual Studio Code. It seems some extensions are checking the exact build name and version of the vscode before installation and if it doesn't match, vscode throws an error:
Unable to install because, the extension '....' compatible with
current version '...' of VS Code is not found.
For example, the Remote - SSH extension on my current custom build throws:
Unable to install because, the extension 'ms-vscode-remote.remote-ssh'
compatible with current version '1.32.0' of VS Code is not found.
Is there a way to bypass the version checking and force vs-code to allow the installation?
Issues
There are two issues to concern:
The first one is a legal one. The Remote - SSH extension's license is very restrictive. From its license:
You may use a copy of the software with each validly licensed copy of Microsoft Visual Studio Code. You may not use the software if you do not have a license for Microsoft Visual Studio Code.
The second one is the extension's incompatibility. It seems that your custom build is based on VS Code version 1.32.0. However, the initial release of the SSH extension requires at least VS Code 1.35.0 or above. From the release notes of VS Code 1.35.0:
The Remote Development extensions are now available for VS Code Stable [...]
Conclusion
So even if you do not care about the legal issues and are able to force install the extension for your custom build it will probably not work since the extension requires a more recent release of VS Code.
More information on this topic can be found in the VSCodium documentation (A "free version" of VSCode). If you rely on the SSH extension and consider switching your custom build, there you will find a possible workaround to get the remote extensions working with VSCodium (I haven't tested it on my own).

Rust autocompletion not shown for items from the standard library

I can't get working autocompletion on VS Code on Ubuntu 16.04.
I've installed rustup from https://www.rustup.rs/ and installed the "rust-lang.rust" package. This extension installed rustfmt and tried to use both stable and nightly toolchains.
If I type std:: no suggestions are shown. Suggestions show on local mod import but not with the standard library. I tried to reinstall by removing via uninstall.sh and manually removing ~/.multirust and ~/.cargo and then installed again, but nothing changed.
What did I do wrong?
I didn't have the RUST_SRC_PATH variable set. In my VS Code settings, I added
"rust.rustLangSrcPath": "/home/ilya/.rustup/toolchains/**your_toolchain**/lib/rustlib/src/rust/src/"
and it did the job. This option comes from the kalitaalexey.vscode-rust package.