vscode-terraform
vscode-terraform copied to clipboard
URI "vscode-remote://wsl%2Bubuntu-20.04/home/`{path to my working directory}`" is not valid
Versions
This bug is reproducible in:
- [ ] the latest version of the extension (below)
- [ ] the latest version of the language server (below)
Extension
2.2.0
Language Server
0.27.0
VS Code
Version: 1.67.0 (user setup)
Commit: 57fd6d0195bb9b9d1b49f6da5db789060795de47
Date: 2022-05-04T12:06:02.889Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.19043
Operating System
Edition Windows 10 Enterprise
Version 21H1
Installed on 21/10/2020
OS build 19043.1645
Experience Windows Feature Experience Pack 120.2212.4170.0
using wsl2 with Ubuntu:
Linux XLW-5CD0118341 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 20.04.3 LTS
Terraform Version
1.1.6
Steps To Reproduce
simply open vscode, or open any .tf file inside vscode
my terraform project directory is a subdirectory of my vscode workspace, however it is merely a directory with many .tf files and has no structure worth note
Expected Behavior
The extension should work
Actual Behavior
The extension throws an error
Additional context
output logs:
2022/05/11 18:17:10 opts.go:218: Received request batch of size 1 (qlen=0)
2022/05/11 18:17:10 opts.go:218: Dequeued request batch of length 1 (qlen=0)
2022/05/11 18:17:10 rpc_logger.go:29: Incoming request for "workspace/executeCommand" (ID 41): {"command":"4.terraform-ls.module.callers","arguments":["uri=vscode-remote://wsl%2Bubuntu-20.04/home/{path to directory containing .tf files}"]}
2022/05/11 18:17:10 rpc_logger.go:45: Error for "workspace/executeCommand" (ID 41): [-32098] URI "vscode-remote://wsl%2Bubuntu-20.04/home/{path to directory containing .tf files}" is not valid
2022/05/11 18:17:10 opts.go:218: Completed 1 requests [0s elapsed]
How are you opening the folder? The reason I ask is it matters how VS Code was opened: https://code.visualstudio.com/docs/remote/wsl-tutorial. If you do not open it from the commandline (code folderName) or through the Command Palate/Remote StatusBar then VS Code will open your WSL directory from Windows, not inside WSL and the paths will appear like you describe.
im definitely running it from inside WSL, and re-checked by explicitly running code . from inside wsl - same issue
Thanks for confirming, this is really helpful. We've been trying to figure out how users are getting vscode-remote:wsl// type URLs for awhile now. All of our local testing gives us file://somePath URLs.
Can you please post the extensions you have installed, the version of the WSL extension, an example workflow, folder tree, and a full Output log? I know this is alot, but this will help us immensely.
For example, using the following I am able to use WSL with Terraform and do not get that URL:
VSCode 1.67.1 WSL2 HashiCorp Terraform ext v0.22.0 Remote-WSL ext v0.66.2
I created a new folder with one main.tf file in it:

I opened VS Code using code .. Note in the lower left hand corner and in the title it shows 'WSL: Ubuntu-20.04' and that the Terraform Extension is in the WSL section of the Extension Pane. It's normal for the Terraform Extension to show grayed out in the 'Local - Installed' section of the Extensions Pane when using WSL.

Hi - as it turns out, i had the extension installed in "Local" but not in "Ubuntu-20.04". installing the extension there fixed the problem, and i no longer get the errors. the extension still doesn't seem to give me any intellisense or code completion, but at least it no longer throws errors every time i open a file! thanks for your help
update: uninstalled the "HCL" extension and the terraform extension now appears to be working properly. thank you :)
I'm sorry for the initial experience here, but this does help us prevent it in the future.
We did attempt to get VS Code to install the extension in the Remote instance in #989, which according to documentation should have prevented your experience. Obviously I'll take a second look at this to try to prevent this from occurring again. At the very least a README update is in order.
Regarding the HCL Extension you uninstalled, I'm happy to report that today (as of a few minutes ago) we officially published an update to that extension and there will no longer be a conflict activating the Terraform Extension while the HCL Extension is installed. We're going to publishing more information about that separately, but wanted to let you know here first.