Getting connect ETIMEDOUT when trying to install a VSCODE extension - visual-studio-code

When trying to install a VSCODE extension from the marketplace, I'm getting connect ETIMEDOUT xxx.xxx.xxx.xxx:443 possibly due to company firewall restrictions.
Is there a way to download and install extensions from a local drive? I couldn't find a "download" option on the VSCODE marketplace.

You need to add your corporate proxy to VSCode settings.
Step 1.
Open File > Preferences > User Settings
Step 2.
Copy and Paste below into the settings.json (file that opens) make sure is inside the curly brackets {}
//-------- HTTP configuration --------
// The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables
"http.proxy": "http://127.0.0.1:8080", //your corporate proxy
// Whether the proxy server certificate should be verified against the list of supplied CAs.
"http.proxyStrictSSL": false
Step 3.
Press F1 and type Reload Window and press enter to refresh.
Tip: if you don't know your corporate proxy settings, follow this
advice:
https://superuser.com/questions/346372/how-do-i-know-what-proxy-server-im-using

Here is what you can do.
Most extensions are in public repos. Click Getting Started on the side panel.
Download the code from the public repo.
Follow the instructions in the docs to side load the application.
If you want to share your extension or customization with others
privately, you can simply send them a copy of the output from the
generator and ask them to add it under their .vscode/extensions
folder. Alternatively, package your extension using the vsce
publishing tool and send them the .vsix file.

Add proxy configuration to VS Code
Open VS Code as Administrator
Open File > Preferences > User Settings
Add following configuration to the open file.
{
"http.proxy": "http://userName:password#companyProxyURL:portNumber",
"http.proxyStrictSSL": false
}

Same issue. VS Code clearly not talking to extension server.
code --install-extension <extension>
gave a time-out message.
Turned out that I had bogus settings of HTTP_PROXY and HTTPS_PROXY. Unset the environment variables and VS Code worked beautifully.

Related

What's the vscode:// syntaxis to create an automatic redirect to a SSH connection into VSCode?

I've used GitHub Codespaces and I wanted to develop something similar using the Remote-SSH extension and I'd like to have a web interface where a button automatically redirects to Visual Studio Code opening the connection and setting up the environment instead of having to manually write the IP address and password for SSH connection, I read the Codespaces code to figure out how they were doing it and found this code.
vscode://github.codespaces/connect?name=<CONTAINER-NAME>&windowId=_blank
Note: I changed my container's name for <CONTAINER-NAME>
They're using the URL Scheme (vscode://) to call the extension github.codespaces and pass a container-name to the variable name in the command connect.
I'd like to use the same but with the Remote-SSH extension and the addNewSshHost to add a new host to my ssh list.
and openEmptyWindow to bind the connection with the added host.
I think that these commands have certain parameters but I don't know where to find them, I've already searched for documentation and there's none.
Hope anybody can help me with the vscode:// syntax for general extensions, thanks
I've tried writing vscode://ms-vscode-remote.remote-ssh/connect?host=<USER>#<IP>&windowId=_blank but It doesn't work, just opens a new VS Code's Window but doesn't add a host or anything, I'd like to have a command to add to a button such as Codespaces does to open the IDE automatically.

github login and sync failure in updated vscode linux version

recently I installed a fresh version of the KDE neon user edition and I updated it and works fine.
I also installed the vscode Debian version and nothing is wrong.
but when I want to login with my GitHub account in vscode for configs sync it opens a firefox tab that I log in to my GitHub and authorizes the vscode and it succeeds and gets back to vscode and instead of signing in and syncing the configs it opens an empty unsaved file named something like this:
did-authenticate\?windowid\=1\&code\=6beea2fcb8a47e0ea49e\&state\=2efc5efd-9c68-4735-a4a0-fd690dd7aec0
in this path : "~/vscode:/vscode.GitHub-authentication"
and after a few seconds canceled notification appears.
I've installed vscode for Debian version 1.63.2 which people in this Github issue had the same problem in version 1.62.2 and they are saying that this problem is fixed for them in version 1.62.3.
I don't have this problem with the Microsoft account sign-in.
what am I missing?
Update:
for testing, I tried to install an extension for vscode and I pasted the URL with vscode protocol in a web browser like this (vscode:extension/GitHub.vscode-pull-request-github), and instead of opening the vscode extensions tab, it goes back to vscode and opens an empty file in the same directory ("~/vscode:/vscode.GitHub-authentication").
so this is vscodes fault that cant handle the vscode: URLs.
I found out what the problem is but I don't know how to fix it
for the record I've updated the vscode today to the 1.64.1 version and still have the problem.
enter image description here
First, you need to get the GitHub Pull Requests and Issues and GitHub extensions together. Then go to the section specified in the photo and give the details of the account and repository you are using. And then it will be fixed.
I ran into this issue myself and discovered that it's because the VS Code command-line application isn't designed to handle URLs, but local file paths. VS Code registers the vscode:// URL scheme with XDG using an appropriate *.desktop file and these URLs should be opened using the command-line program xdg-open. In Firefox, if you have not yet set a default application for vscode:// URLs, then it will ask you for a program to open it with, select /usr/bin/xdg-open. If you have already set it to a different default, you can change it as follows: go to the Menu -> Settings -> General -> Applications -> vscode -> Use other... -> Select /usr/bin/xdg-open as the program for vscode.
With the default for vscode:// URLs set to use xdg-open, then any future integration with VS Code should work naturally to open it as expected.

How to create settings.json and extensions.json outside of image and named config level for an ATTACHED VSCode Container

I'm using WSL 2 for Windows, and I'm currently working on a ddev repo where I am creating a development environment using ddev and VSCode. On initiation of the ddev environment, I am starting up all my containers. With my custom "ddev code" command, I am attaching VSCode to the web container via the hex representation of the web container using
'code --folder-uri="vscode-remote://attached-container+646465762d646465762d7673636f64652d646576636f6e7461696e65722d64727570616c392d74656d706c6174652d776562%/var/www/html"'
Now, I would like to automatically enable a bunch of extensions and settings. Currently, I am using workspace settings in my projects folder structure in the form of .vscode/settings.json and extension settings in the form of .vscode/extensions.json. But this is just a workaround, since VSCode will use these settings as "workspace settings" and not "devcontainer settings". I would like to define the settings and install the extensions directly on my attached VSCode container rather than in my workspace settings, since I can only use "recommendations" in the extensions.json, because it is seen as a workspace.
I know I can set the settings and extensions under "AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\imageConfigs" or "nameConfigs" but I would like to have them in Ubuntu or rather in my project's folder directory. I also know that there is the devcontainer.json for standalone VSCode Containers where you can set the Docker files and settings/extensions, but how can I use such a file for my attached container?
Another way would be to install the extensions via command after attaching VSCode using
code --install-extension <extension-id>
But this will only install them locally. And executing this command in the web Container via ssh will throw an error.
Maybe someone knows a solution? If further information is needed I can of course provide it :)
Here is the repository I am working on:
https://github.com/webksde/ddev-vscode-devcontainer-drupal9-template
EDIT: Maybe this issue from our repo can also give more insight:
https://github.com/webksde/ddev-vscode-devcontainer-drupal9-template/issues/28

Failed to open browser while using line server in VScode

I am getting "Server is started at 5500 but failed to open browser. Try to change the CustomBrowser settings." in VScode while using line server. I have tried to change default settings but i still can't solve it.
In VScode go to extension (ctrl+shift+x) and search for live server, on live server go to manage > extension setting, then look for Live Server > Settings:Use Browser Preview section in the settings.
If the checkbox is checked, uncheck it.

Download Visual Studio Code extensions behind proxy

Despite setting the http.proxy setting, I am unable to download extensions (or browse extensions).
I found that if I start the program with --proxy-server=http://myproxy.example.com:3128 then it works.
The code-server used for remote development doesn't support the --proxy-server flag.
The workaround I have found is to manually download the .vsix extension archive for the extension I want to install. e.g. from here: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools there's a "Download Extension" drop down on the right under "Resources" where I can download the extension for the server's platform.
Then, move this archive to the target server. Since I'm using an ssh remote, I just scp it over.
Then, install the extension from the archive:
~/.vscode-server/bin/<id>/bin/code-server --install-extension /path/to/archive.vsix
And this should install the extension. I had to restart the editor a few times before the extension showed as installed in the editor as well.