robb0wen / synthwave-vscode

Synthwave inspired colour theme for VS Code 🌅🕶
MIT License
5.18k stars 1.19k forks source link

Incorrect template file path on Ubuntu codespace prevents Enable Neon Dreams from running #315

Open chrisbloom7 opened 3 months ago

chrisbloom7 commented 3 months ago

When trying to enable the Neon Dreams feature inside a codespace, I get the dreaded Neon Dreams was unable to modify the core VS code files needed to launch the extension. You may need to run VS code with admin privileges in order to enable Neon Dreams. error. None of the suggestions in https://github.com/robb0wen/synthwave-vscode/issues/138 or similar issues worked so I did some digging to figure out what the actual error was that triggered that error message, hoping it might lead me to the proper folder to chown. What I found instead is that the extension is trying to load a file that doesn't exist.

When enabling the glow feature on my M1 MacBook Pro running Sonoma 14.5, the extension loads a template file located at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/neondreams.js. On my Ubuntu based codespace, the extension tries to load /vscode/bin/linux-alpine/f1e16e1e6214d7c44d078b1f0607b2388f29d729/out/vs/code/electron-sandbox/workbench/neondreams.js which doesn't exist.

That path originates from these lines in https://github.com/robb0wen/synthwave-vscode/blob/master/src/extension.js#L27-L29

const appDir = path.dirname(require.main.filename);
const base = appDir + (isWin ? "\\vs\\code" : "/vs/code");
const electronBase = isVSCodeBelowVersion("1.70.0") ? "electron-browser" : "electron-sandbox";

On OS X require.main.filename evaluates to /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js. Inside the Ubuntu codespace it evaluates to /vscode/bin/linux-alpine/f1e16e1e6214d7c44d078b1f0607b2388f29d729/out/bootstrap-fork.js. While there is a vs/ directory in that base folder it does not contain a code directory:

$ ls -lFh /vscode/bin/linux-alpine/f1e16e1e6214d7c44d078b1f0607b2388f29d729/out/vs 
total 60K
drwxr-xr-x 6 root root 4.0K Jul  9 22:05 .
drwxr-xr-x 3 root root 4.0K Jul  9 22:05 ..
drwxr-xr-x 4 root root 4.0K Jul  9 22:05 base
-rw-rw-r-- 1 root root  33K Jul  9 21:58 loader.js
drwxr-xr-x 4 root root 4.0K Jul  9 22:05 platform
drwxr-xr-x 3 root root 4.0K Jul  9 22:05 server
drwxr-xr-x 4 root root 4.0K Jul  9 22:05 workbench

That workbench folder does not contain any relevant directories or files:

$ ls -lFh /vscode/bin/linux-alpine/f1e16e1e6214d7c44d078b1f0607b2388f29d729/out/vs/workbench
total 16K
drwxr-xr-x 4 root root 4.0K Jul  9 22:05 .
drwxr-xr-x 6 root root 4.0K Jul  9 22:05 ..
drwxr-xr-x 3 root root 4.0K Jul  9 22:05 api
drwxr-xr-x 3 root root 4.0K Jul  9 22:05 contrib

Using find, I don't see any indication of a electron-sandbox or electron-browser directory, nor any neondreams.js files anywhere within the codespace starting from the root /.

# Permission denied errors were reported when searching `/proc/*`, `/var/lib/sudo`, `/etc/sudoers.d`, `/run/sudo`, and `/root`.
# I've removed those errors from the output for clarity, leading to empty results.

$ sudo find / -maxdepth 999 -type d -name "electron-browser" -print

$ sudo find / -maxdepth 999 -type d -name "electron-sandbox" -print

$ sudo find / -maxdepth 999 -type f -name "neondreams.js" -print

Codespace runtime

$ uname -a
Linux codespaces-77d75e 6.5.0-1022-azure #23~22.04.1-Ubuntu SMP Thu May  9 17:59:24 UTC 2024 x86_64 GNU/Linux

VS Code version info

Version: 1.91.1
Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:07:46.768Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0