// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.205.2/containers/r
{
	"name": "rstudio-ampvis2",
	"image": "ghcr.io/kasperskytte/ampvis2:main",

	// Set *default* container specific settings.json values on container create.
	"settings": {
		"r.rterm.linux": "/usr/local/bin/R",
		"r.bracketedPaste": true,
		"r.plot.useHttpgd": true,
		"[r]": {
			"editor.wordSeparators": "`~!@#%$^&*()-=+[{]}\\|;:'\",<>/?"
		},
		"r.rterm.option": [
			"--no-save",
			"--no-restore",
			"--r-binary=/usr/local/bin/R"
		]
	},

	// create a user namespace where the current rootless userâ€™s UID:GID maps to the same values in the container
	"runArgs": ["--userns=keep-id"],
	"containerEnv": { "HOME": "/home/rstudio" },

	// Add the IDs of extensions you want installed when the container is created.
	"extensions": [
		"ikuyadeu.r",
		"rdebugger.r-debugger",
		"janisdd.vscode-edit-csv",
		"GrapeCity.gc-excelviewer"
	],

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Use 'postCreateCommand' to run commands after the container is created.
	"postCreateCommand": "R -e 'dir.create(Sys.getenv(\"R_LIBS_USER\"), recursive = TRUE); install.packages(\"languageserver\", Ncpus = 8, lib = Sys.getenv(\"R_LIBS_USER\"))'",

	// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "rstudio"
}
