adds vscode to dotfiles

This commit is contained in:
2024-04-22 13:31:23 +02:00
parent 6339d9b26a
commit e9c54fa866
26 changed files with 2263 additions and 37 deletions

View File

@@ -0,0 +1,54 @@
#!/bin/sh
script_file=$0
while [ -h "$script_file" ]; do
script_file=$(readlink $script_file)
done
basedir=$(dirname "$(echo "$script_file" | sed -e 's,\\,/,g')")
# This file is placed in a stable (version-independent) location
# and forwards to the currently installed version
# WSL detection borrowed from VS Code
IN_WSL=false
if [ -n "$WSL_DISTRO_NAME" ]; then
# $WSL_DISTRO_NAME is available since WSL builds 18362, also for WSL2
IN_WSL=true
else
WSL_BUILD=$(uname -r | sed -E 's/^[0-9.]+-([0-9]+)-Microsoft.*|.*/\1/')
if [ -n "$WSL_BUILD" ]; then
IN_WSL=true
fi
fi
VSCODE_PATH=$(cat "$basedir/vscode-path")
DEVCONTAINER_CLI_PATH=$script_file
REMOTE_CONTAINERS_PATH=
if [ -f "$basedir/remote-containers-path" ]; then
REMOTE_CONTAINERS_PATH=$(cat "$basedir/remote-containers-path")
if [ $IN_WSL = true ]; then
REMOTE_CONTAINERS_PATH=$(wslpath -u $REMOTE_CONTAINERS_PATH)
fi
if [ ! -f "$REMOTE_CONTAINERS_PATH/dev-containers-user-cli/cli.js" ]; then
REMOTE_CONTAINERS_PATH=
fi
fi
if [ -z "$REMOTE_CONTAINERS_PATH" ]; then
echo "Failed to determine Dev Containers path"
exit 1
fi
if [ $IN_WSL = true ]; then
export WSLENV="ELECTRON_RUN_AS_NODE/w:DEVCONTAINER_CLI_PATH/p:IN_WSL:WSL_DISTRO_NAME:$WSLENV"
CLI=$(wslpath -m "$REMOTE_CONTAINERS_PATH/dev-containers-user-cli/cli.js")
ELECTRON=$(wslpath -u "$VSCODE_PATH")
# TODO - piping to `cat` is a temporary workaround for the CRLF->LF conversion
# that occurs when calling Windows Electron binary from WSL
IN_WSL=$IN_WSL DEVCONTAINER_CLI_PATH="$DEVCONTAINER_CLI_PATH" ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@" | cat
exit $?
else
ELECTRON="$VSCODE_PATH"
CLI=$REMOTE_CONTAINERS_PATH/dev-containers-user-cli/cli.js
DEVCONTAINER_CLI_PATH="$DEVCONTAINER_CLI_PATH" ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?
fi

View File

@@ -0,0 +1,37 @@
@echo off
@REM This file is placed in a stable (version-independent) location
@REM and forwards to the currently installed version
setlocal
SET DEVCONTAINER_CLI_PATH=%~f0
SET VSCODE_PATH=
:vscode_path
@REM Load the Code.exe path
IF NOT exist "%~dp0vscode-path%" goto fail_vscode_path
set /p VSCODE_PATH=<"%~dp0vscode-path%"
IF exist "%VSCODE_PATH%" goto remote_container_path
:fail_vscode_path
echo Failed to determine VS Code path
exit 1
:remote_container_path
SET REMOTE_CONTAINERS_PATH=
@REM Check the remote-containers-path file
@REM This is a cache (and enables Dev Containers development)
IF NOT exist "%~dp0remote-containers-path%" goto fail_remote_container_path
set /p REMOTE_CONTAINERS_PATH=<"%~dp0remote-containers-path%"
IF exist "%REMOTE_CONTAINERS_PATH%\dev-containers-user-cli\cli.js" goto forwardcall
:fail_remote_container_path
echo Failed to determine Dev Containers path
exit 1
:forwardcall
set ELECTRON_RUN_AS_NODE=1
"%VSCODE_PATH%" "%REMOTE_CONTAINERS_PATH%\dev-containers-user-cli\\cli.js" %*
endlocal

View File

@@ -0,0 +1 @@
/home/menno/.vscode/extensions/ms-vscode-remote.remote-containers-0.361.0

View File

@@ -0,0 +1 @@
/usr/share/code/resources/app

View File

@@ -0,0 +1 @@
8fe771453a595198d5c05cfe5dae733902c1ae7c7983b27c2c59b2b42752897a

View File

@@ -0,0 +1 @@
/usr/share/code/code

File diff suppressed because it is too large Load Diff