添加对vscode insiders的支持

This commit is contained in:
leoleoleo 2023-09-08 09:59:36 +08:00
parent 63a1aa5134
commit 17d3498f2a
3 changed files with 36 additions and 16 deletions

View File

@ -3,9 +3,15 @@
set -e
EXTENSIONS_DIR="$HOME/.vscode-server/extensions"
INSIDERS_EXTENSIONS_DIR="$HOME/.vscode-server-insiders/extensions"
if [ ! -d "$EXTENSIONS_DIR" ]; then
echo "ERROR: VSCode extensions directory not found!"
if [ ! -d "$INSIDERS_EXTENSIONS_DIR" ]; then
echo "ERROR: Both VSCode and VSCode Insiders extensions directories not found!"
exit 1
else
EXTENSIONS_DIR="$INSIDERS_EXTENSIONS_DIR"
fi
fi
COPILOT_DIR=$(ls -lt "$EXTENSIONS_DIR" | grep '^d' | awk '{print $9}' | grep -E '^github\.copilot-[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)

View File

@ -2,10 +2,16 @@
setlocal
set extensions_dir=%userprofile%\.vscode\extensions
set insiders_extensions_dir=%userprofile%\.vscode-insiders\extensions
if not exist "%extensions_dir%" (
echo ERROR: VSCode extensions directory not found!
if not exist "%insiders_extensions_dir%" (
echo ERROR: Both VSCode and VSCode Insiders extensions directories not found!
pause
exit /b 1
) else (
set extensions_dir=%insiders_extensions_dir%
)
)
for /f "tokens=*" %%a in ('dir /b /ad "%extensions_dir%" ^| findstr /r /c:"^github\.copilot-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$"') do (
@ -26,6 +32,7 @@ if not exist "%extension_file%" (
exit /b 1
)
echo please be patient...
set tmp_file=%copilot_dir%\dist\extension.js.tmp

View File

@ -3,9 +3,15 @@
set -e
EXTENSIONS_DIR="$HOME/.vscode/extensions"
INSIDERS_EXTENSIONS_DIR="$HOME/.vscode-insiders/extensions"
if [ ! -d "$EXTENSIONS_DIR" ]; then
echo "ERROR: VSCode extensions directory not found!"
if [ ! -d "$INSIDERS_EXTENSIONS_DIR" ]; then
echo "ERROR: Both VSCode and VSCode Insiders extensions directories not found!"
exit 1
else
EXTENSIONS_DIR="$INSIDERS_EXTENSIONS_DIR"
fi
fi
COPILOT_DIR=$(ls -lt "$EXTENSIONS_DIR" | grep '^d' | awk '{print $9}' | grep -E '^github\.copilot-[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
@ -21,6 +27,7 @@ if [ ! -f "$EXTENSION_FILE" ]; then
exit 1
fi
TMP_FILE="$COPILOT_DIR/dist/extension.js.tmp"
echo 'process.env.CODESPACES="true";process.env.GITHUB_TOKEN="ghu_ThisIsARealFreeCopilotKeyByCoCopilot";process.env.GITHUB_SERVER_URL="https://github.com";process.env.GITHUB_API_URL="https://api.cocopilot.org";' > "$TMP_FILE"
cat "$EXTENSION_FILE" >> "$TMP_FILE"