devsetup1-8 Exercise 3: Extensions You Can Rebuild =================================================== STEP 1: INSTALL THREE EXTENSIONS -------------------------------- code --install-extension ms-python.python code --install-extension esbenp.prettier-vscode code --install-extension ms-vscode-remote.remote-ssh If a command says the extension was not found, search for it in VS Code's Extensions panel and copy the identifier shown there; publishers do rename things. STEP 2: SAVE THE LIST --------------------- code --list-extensions > ~/vscode-extensions.txt cat ~/vscode-extensions.txt The file holds one identifier per line. Any extensions you installed earlier will be listed too. STEP 3: REMOVE ONE AND RESTORE IT --------------------------------- code --uninstall-extension esbenp.prettier-vscode code --list-extensions # Prettier is gone xargs -L1 code --install-extension < ~/vscode-extensions.txt code --list-extensions # Prettier is back Extensions that are already installed are left alone (the command reports that they are installed), so the restore command is safe to run repeatedly. STEP 4: REMOTE - SSH TO debserver --------------------------------- 1. Make sure you can already log in with: ssh debserver (key login, Chapter 2). Remote - SSH uses your normal SSH configuration, so a host alias in ~/.ssh/config works in VS Code too. 2. In VS Code open the Command Palette (Ctrl+Shift+P), choose "Remote-SSH: Connect to Host...", and pick debserver. 3. Open the folder you want to edit on the server. A RISK ------ Files are edited live on the web server. A slip (saving a broken config or PHP file) affects the running site at once, with no local copy to fall back on. The extension also installs a small helper program on the server the first time you connect, which is one more thing running there. Mitigations: edit a copy or a Git working tree rather than the live files, commit before changing anything, and keep server-side work to changes you would be willing to make in a terminal. WHY THIS WORKS AS AN ANSWER --------------------------- The saved list turns a manual setup into a repeatable one, and the remove and restore step proves it works before you need it. The Remote - SSH steps reuse the SSH setup from Chapter 2, and naming the risk means you decide with the downside in view.