vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

devcontainer.json: add support for multi-platform "localEnv" in "mounts"

Open numbworks opened this issue 6 months ago • 9 comments

First and foremost: thank you guys for your amazing work with VSCode!

Use Case

I have a devcontainer.json that on Windows mounts "/home/nwtimetracking/" to "C:\Users\Desktop<my_username>\nwtimetracking".

The problem arises when I load the project on Linux, where I do get a "A mount config is invalid" error message and I can't proceed until I manually switch USERPROFILE with HOME.

devcontainer.json https://github.com/numbworks/nwtimetracking/blob/master/.devcontainer/devcontainer.json

{
	"build": { 
		"dockerfile": "Dockerfile" 
	},
	"customizations": {
		"vscode": {
			"settings": {},
			"extensions": [
				"ms-python.python",
				"ms-python.vscode-pylance",
				"ms-toolsai.jupyter",
				"ms-toolsai.datawrangler",
				"shd101wyy.markdown-preview-enhanced"
			]
		}
	},
    "mounts": [
        "source=${localEnv:USERPROFILE}/Desktop/nwtimetracking/,target=/home/nwtimetracking/,type=bind,consistency=cached"
    ]	
}

As far as I know and at the moment of writing:

  • {localEnv:USERPROFILE} works only for Windows
  • {localEnv:HOME} works only for Linux/MacOS

Feature Request

If would be nice to have some kind of conditional logic that allows the use of both dynamically, according to the OS on which VSCode is running at the moment. Or a combo label that identifies the DESKTOP on all the supported OSes. Or similar solution.

Or if you are aware of a workaround for this issue, I would be glad to know!

Thank you!

numbworks avatar May 11 '25 17:05 numbworks

We have sometimes used {localEnv:USERPROFILE}{localEnv:HOME} as a workaround (assuming one is always empty and the other one set).

chrmarti avatar May 12 '25 07:05 chrmarti

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@chrmarti Thank you for your kind and quick reply!

I'll give it a try! If it works, it's good enough on my perspective!

numbworks avatar May 12 '25 08:05 numbworks

this could be useful!

AlexanderPD avatar Jun 06 '25 10:06 AlexanderPD

Upvote

dariofornaro avatar Jun 06 '25 11:06 dariofornaro

I also need this

YaPanda98 avatar Jun 06 '25 16:06 YaPanda98

upvote!

nardinan avatar Jun 06 '25 19:06 nardinan

Upvote

abcamitan avatar Jun 07 '25 11:06 abcamitan

Upvote

skriptet avatar Jun 13 '25 11:06 skriptet

Upvote

ol3d avatar Jun 17 '25 03:06 ol3d

Upvote

arikw avatar Jun 21 '25 16:06 arikw

Upvote!

renatocuoricelli avatar Jun 24 '25 06:06 renatocuoricelli

Upvote!

tonles avatar Jun 30 '25 22:06 tonles

:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@chrmarti Any idea when the team will start working on this fix?

I tried your workaround on two different Linux machines and three different versions of VSCode, but it doesn't work at all.

We have sometimes used {localEnv:USERPROFILE}{localEnv:HOME} as a workaround (assuming one is always empty and the other one set).

numbworks avatar Jul 27 '25 20:07 numbworks