WSL Distros not visible to VSCode or IntelliJ IDEs - visual-studio-code

For a few weeks now I have had this very strange issue and have been unable to resolve it:
I usually code on WSL2, and it used to work fine on this machine and user. But now, whenever I try to open the Remote Explorer in Visual Studio Code or try to open a "New Project from Existing Files" in an IntelliJ IDE, no WSL Distros show up.
They are still there - wsl -l -v lists them and I can open them in the terminal. Everything inside of them works (aside from opening VSCode).
In Windows Explorer, their filesystems do show up. But in Visual Studio Code the list of Distros is empty and I get an error message stating "Cannot read properties of undefined (reading 'name')" when I open the Remote Explorer. In IntelliJ IDEs, only my local drives appear where there used to be additional entries for WSL.
When I navigate to a directory in WSL in the terminal and then execute code ., it opens a VSCode window, but then I get the notification "No WSL distros found".
Interestingly, previously opened projects in IntelliJ IDEs can still be opened (but I am getting Line-Ending issues).
I have tried reinstalling the WSL extension in VSCode, restarting the LXSSManager-Service, doing a network reset with netsh winsock reset, netsh int ip reset, ipconfig /release, ipconfig /renew, ipconfig /flushdns - and I have tried reinstalling VSCode entirely... to no avail. I have also looked at the registry entries for the WSL Distros under Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\, and they look fine to me.
I have also uninstalled my non-primary distros and reinstalled them - same issue across all installed distros, old or freshly installed.
I am sadly unable to specify how to reproduce the issue as everything used to work in this setup and nothing was deliberately changed.
My Windows version is Windows 11 Version 22H2 (OS Build 22621.963).

Related

vscode inside WSL vs Windows

In tutorial requirement is install vscode in windows and install Remote Development extension pack. Why not just install in wsl?
I've install vscode to wsl. When I run code in wsl I get message:
To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the `code` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N]
To no longer see this prompt, start Visual Studio Code with the environment variable DONT_PROMPT_WSL_INSTALL defined.
Which cons of run vscode in wsl as opposed to run it in Windows?
The WSL extension splits VS Code into a “client-server” architecture, with the client (the user interface) running on your Windows machine and the server (your code, Git, plugins, etc) running "remotely" in your WSL distribution.
When VS Code is started in WSL, no shell startup scripts are run.
The extension runs commands and other extensions directly in WSL so you can edit files located in WSL or the mounted Windows filesystem (for example /mnt/c) without worrying about pathing issues, binary compatibility, or other cross-OS challenges.
(source: MSFT DOCUMENTATION)
This is the architectural choice of Windows and - personally speaking - I feel like it's a choice to avoid conflicts and redundancies.
When running the WSL extension, selecting the 'Extensions' tab will display a list of extensions split between your local machine and your WSL distribution.
Installing a local extension, like a theme, only needs to be installed once.
Some extensions, like the Python extension or anything that handles things like linting or debugging, must be installed separately on each WSL distribution. VS Code will display a warning icon ⚠, along with a green "Install in WSL" button, if you have an extension locally installed that is not installed on your WSL distribution.

Extensions on the remote machine are not recognized by Remote-SSH extension

I have a Linux machine with VSCode on it, with extensions installed at /home/myuser/.vscode/extensions/. Everything runs great. However, now I would like to connect to that machine remotely with "Remote - SSH" from a VSCode instance that runs on another computer. The connection was successful, but the extensions are all grayed-out and have "Install in SSH:..." buttons.
How can I get VSCode to find the extensions already installed on the remote (Linux) machine?
The extensions were installed using VSCode on the remote machine.
I looked through the settings for something that might have to do with it, but couldn't find. I didn't install anything remotely yet ("Install in SSH:...") because I was afraid that it might clash with the existing installation.

Failed to connect to the remote extension host server (Error: Missing proxy instance MainThreadDebugService)

Hey stackoverflow community i have an issue with vscode connecting to wsl2 with the following error [picture bellow] message i already searched for hours and couldnt find a solution.
reinstalled both with a clean updated version without any success
Edit 1:Tried to unmount and remount folders also tried opening with high privilege's from cmd 'wsl code .' moreover i completely deleted wsl and vscode with all the extensions but still am getting the same error, i was able to reproduce more readable error, when opening a project it prompts with
unable to resolve resource vscode-re...://%ubuntu-22.04/file_path
Edit 2: opening WSL, 'New WSL window using distro' works fine but i cant open any directory, without it producing the error in Edit 1
I got the same issue. I use Windows and I open the folder in vscode in this way:
shift+right-click the folder -> open linux shell -> type in "code ."
when vscode opens, the error does not exist.
For me this was due to the secondary sidebar being visible.
After disabling it via View -> Appearance -> Secondary Side Bar, WSL2 starts up fine again.
I got the same.
If your project is on another drive mount it and
run vscode as administrator.
I had this issue and needed to run..
$ code
Updating VS Code Server to version 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Removing previous installation...
Installing VS Code Server for x64 (97dec172d3256f8ca4bfb2143f3f76b503ca0534)
Downloading: 100%
Unpacking: 100%
Unpacked 2389 files and folders to /home/dmitri/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534.
in WSL2 to update the WSL2 server. Then uninstalling and reinstalling the WSL extension from VSCode did the trick.
I am the same.
I also reinstalled VSCode and Docker, but nothing changed.
In the "Remote - Containers" tutorial, I was able to connect without any problems.
It doesn't work with my code.

Why are VSCode extensions not working in SSH

I am using the Remote-SSH extension. When I SSH to a local VM that has Linux, or far away to my uni's pc lab, all my VSCode local extensions don't work, it doesn't show under the extensions pane -> local installed. So doing the keyboard shortcut for one says "command 'extension.advancedNewFile' not found". Why is this and how do I fix this?
The first diagram in https://code.visualstudio.com/docs/remote/ssh shows it clearly that only theme/UI extensions remain applicable when VSCode is under remote development mode,
If you want features of certain extensions, you have to install them on the remote machine (under EXTENSIONS | SSH: MACHINE_NAME - INSTALLED).

How do I make vscode c++ intellisense work with remote development?

When running vscode locally on windows I can install the C/C++ extension and immediately have some code understanding from the editor (visual studio 2019 is installed too):
However after installing OpenSSH and connecting to the same PC via the vscode Remote Development extension (connecting from linux to Windows) this doesn't work:
Everything I hover over says: Unsupported Markup content received. Kind is:
Also typing msg.<ctrl+space> gives No suggestions.
The only references I can find are:
https://github.com/redhat-developer/vscode-xml/issues/43
https://github.com/TypeFox/monaco-languageclient/pull/103/files#diff-fde961a63820de2855135d552feaef126f4624fa959efbe848c112a5fb04e4a5R180
These don't seem related. I have not set up a c_cpp_properties.json but then I didn't need to for the local test that worked. The error makes me think there is some conflicting extension, but I've uninstalled most others and the issue persists. What have I missed?