Skip to content

Instantly share code, notes, and snippets.

@AfroThundr3007730
Last active November 6, 2024 17:15
Show Gist options
  • Save AfroThundr3007730/efe7ef05b02f9756dbf5d28e2f203af9 to your computer and use it in GitHub Desktop.
Save AfroThundr3007730/efe7ef05b02f9756dbf5d28e2f203af9 to your computer and use it in GitHub Desktop.
vscode profile cleanup tasks
#!/bin/bash
# Purge extensions cache
rm -fr /vscode/vscode-server/extensionsCache/* ~/.vscode-server/extensionsCache/*
# Remove older extension versions
find ~/.vscode*/extensions -maxdepth 1 -type d |
awk '{t=gensub(/(.+)-[0-9\.-]+.+/, "\\1", 1); if (t in m) {print $0} else {m[t]++}}' |
xargs -rtl rm -fr
# Remove old vscode servers in devcontainer
ls -td /vscode/vscode-server/bin/linux-x64/* ~/.vscode-server/bin/* \
~/.vscode-server/data/Machine/.{devport,connection}* |
grep -v $(awk -F/ '{print $6}' <<< $PATH) | # pull current server hash out of $PATH
xargs -rtl rm -fr
# Remove old vscode servers in ssh remote
ls -d ~/.vscode-server/{code-,.cli.,cli/servers/Stable-}* |
grep -v $(jq -r '.[0] | split("-")[1]' ~/.vscode-server/cli/servers/lru.json) |
xargs -rtl rm -fr
#!/bin/bash
# Until microsoft/vscode#53992 is fixed
shopt -s globstar
# In an SSH remote
sed -i 's/return"#".repeat(e.level)+" "+e.text/return e.text/g' \
~/.vscode-server/cli/servers/Stable-*/server/extensions/markdown-language-features/**/*.js
# Or in a devcontainer
sed -i 's/return"#".repeat(e.level)+" "+e.text/return e.text/g' \
~/.vscode-server/bin/*/extensions/markdown-language-features/**/*.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment