b01 / dl-vscode-server

MIT License
20 stars 4 forks source link

Add Script For Downloading Extension #12

Closed b01 closed 3 days ago

b01 commented 4 months ago

Anyone know how to add in a list of extensions to download as well for offline install?

b01 commented 4 months ago

VS Code CLI has --install-extension <ext> to install an extension. Provide the full extension name publisher.extension as an argument. Use --force argument to avoid prompts.

Maybe code-server also supports this.

JinFish commented 3 months ago

As far as I know, VSCode does not provide a command to download multiple plugins directly. However, you can put the plugins in the same folder, and then traverse the folder plugins to download one by one:

for vsix in $(ls path/to/your-plugins/*.vsix); do
  code --install-extension $vsix
done
b01 commented 3 months ago

As far as I know, VSCode does not provide a command to download multiple plugins directly. However, you can put the plugins in the same folder, and then traverse the folder plugins to download one by one:

for vsix in $(ls path/to/your-plugins/*.vsix); do
  code --install-extension $vsix
done

I'm not sure exactly how most use the the download vscode server script. So I was thinking of just letting people give a list of the extensions. The easiest way it to put them in a text file and pass in the file name as an argument. Then have the script loop like you mentioned. I've yet to test that works though.

remchuk commented 3 months ago

To the gist that was before this project I added 2 extra lines in the end

export PATH="$PATH:/root/.vscode-server/bin/${commit_sha}/bin"

for FILE in /opt/vscode-server/*.vsix; do code-server --install-extension $FILE; done

And I did a bash script that runs the gist and installs any extension I want,

declare -A extensions=(
    ["vscode-pylance-latest"]="ms-python"
    ["vscodeintellicode-latest"]="VisualStudioExptTeam"
    ["intellicode-api-usage-examples-latest"]="VisualStudioExptTeam"
    ["remote-containers-latest"]="ms-vscode-remote"
    ["vsc-python-indent-latest"]="KevinRose"
    ["python-latest"]="ms-python"
    ["autodocstring-latest"]="njpwerner"
    ["python-extension-pack-latest"]="donjayamanne"
    ["vscode-django-latest"]="batisteo"
    ["prettier-vscode-latest"]="esbenp"
    ["jinja-latest"]="wholroyd"
    ["autopep8-latest"]="ms-python"
)

if [ ! -d "./extensions" ]; then
    mkdir ./extensions
fi
cp ./download-vs-code-server.sh ./extensions
cd ./extensions

for key in "${!extensions[@]}"
do
    FILE=./${extensions[$key]}.$key.vsix
    while [ ! -f $FILE ];
    do
        publisher=${extensions[$key]}
        key=$(echo $key | sed 's/-latest/\/latest/g')
        wget -nv -w 10 --random-wait --continue https://marketplace.visualstudio.com/_apis/public/gallery/publishers/$publisher/vsextensions/$key/vspackage
        key=$(echo $key | sed 's/\//-/g')
        mv vspackage ${extensions[$key]}.$key.vsix.gz
        gunzip -v ${extensions[$key]}.$key.vsix.gz
    done
done
b01 commented 3 days ago

This feature has been merged, so closing this issue. Not sure why it didn't auto close. Maybe the git commit did not contain the right text.