robb0wen / synthwave-vscode

Synthwave inspired colour theme for VS Code 馃寘馃暥
MIT License
5.19k stars 1.19k forks source link

Can't enable it in the latest VSCode 1.95.0 #333

Closed floyd-li closed 2 weeks ago

floyd-li commented 2 weeks ago

Seems the latest vscode breaks something....

You may need to run VS code with admin privileges in order to enable Neon Dreams. CleanShot 2024-10-30 at 09 30 53@2x

NathyVZM commented 2 weeks ago

Same issue here, I tried doing exactly that (run VSCode with admin privileges) and nothing, still happening 馃珷 waiting for a knight in shining armor to find a solution for this

keyork commented 2 weeks ago

I'm having the same issue and the problem is coming again...

kevinRT19 commented 2 weeks ago

estamos iguales caballeros apenas llego la actualizaci贸n de vs code dejo de funcionar y intente parchar el c贸digo y ni as铆 debe ser ya un error de estructura de c贸digo o no se..

VanXodus305 commented 2 weeks ago

Same issue here, I tried doing exactly that (run VSCode with admin privileges) and nothing, still happening 馃珷 waiting for a knight in shining armor to find a solution for this

I have faced the same problem even after it had been apparently fixed by #327 I did the following and the issue was fixed for me:

1) Open VS Code (Non-Administrator Mode). 2) Open the extension.js file in the editor from %USERPROFILE%\.vscode\extensions\robbowen.synthwave-vscode-0.1.16\src folder (for Windows). 3) Replace the contents of extension.js with the code provided below: Courtesy of vinayakkulkarni@bd8444b05d68aca4882b5827fdff5376884faa22 (#318) 4) Save the file and restart VS Code in Administrator Mode. 5) Press Ctrl+Shift+P and use the Synthwave '84: Enable Neon Dreams command. 6) Restart VS Code once again if prompted.

This should hopefully fix the issue in VS Code 1.95.0 (in Windows).

extension.js (Click to expand)

```javascript const path = require("path"); const fs = require("fs"); const vscode = require("vscode"); /** * @param {vscode.ExtensionContext} context */ function activate(context) { this.extensionName = "RobbOwen.synthwave-vscode"; this.cntx = context; const config = vscode.workspace.getConfiguration("synthwave84"); let disableGlow = config && config.disableGlow ? !!config.disableGlow : false; let brightness = parseFloat(config.brightness) > 1 ? 1 : parseFloat(config.brightness); brightness = brightness < 0 ? 0 : brightness; brightness = isNaN(brightness) ? 0.45 : brightness; const parsedBrightness = Math.floor(brightness * 255) .toString(16) .toUpperCase(); let neonBrightness = parsedBrightness; let disposable = vscode.commands.registerCommand( "synthwave84.enableNeon", function () { const isWin = /^win/.test(process.platform); const appDir = `${path.dirname(vscode.env.appRoot)}/app/out`; const base = appDir + (isWin ? "\\vs\\code" : "/vs/code"); const electronBase = isVSCodeBelowVersion("1.70.0") ? "electron-browser" : "electron-sandbox"; const htmlFileName = "workbench.html"; const htmlFile = base + (isWin ? "\\" + electronBase + "\\workbench\\" + htmlFileName : "/" + electronBase + "/workbench/" + htmlFileName); const templateFile = base + (isWin ? "\\" + electronBase + "\\workbench\\neondreams.js" : "/" + electronBase + "/workbench/neondreams.js"); try { // const version = context.globalState.get(`${context.extensionName}.version`); // generate production theme JS const chromeStyles = fs.readFileSync( __dirname + "/css/editor_chrome.css", "utf-8" ); const jsTemplate = fs.readFileSync( __dirname + "/js/theme_template.js", "utf-8" ); const themeWithGlow = jsTemplate.replace( /\[DISABLE_GLOW\]/g, disableGlow ); const themeWithChrome = themeWithGlow.replace( /\[CHROME_STYLES\]/g, chromeStyles ); const finalTheme = themeWithChrome.replace( /\[NEON_BRIGHTNESS\]/g, neonBrightness ); fs.writeFileSync(templateFile, finalTheme, "utf-8"); // modify workbench html const html = fs.readFileSync(htmlFile, "utf-8"); // check if the tag is already there const isEnabled = html.includes("neondreams.js"); if (!isEnabled) { // delete synthwave script tag if there let output = html.replace( /^.*(\n` ); output += ""; fs.writeFileSync(htmlFile, output, "utf-8"); vscode.window .showInformationMessage( "Neon Dreams enabled. VS code must reload for this change to take effect. Code may display a warning that it is corrupted, this is normal. You can dismiss this message by choosing 'Don't show this again' on the notification.", { title: "Restart editor to complete" } ) .then(function () { vscode.commands.executeCommand("workbench.action.reloadWindow"); }); } else { vscode.window .showInformationMessage( "Neon dreams is already enabled. Reload to refresh JS settings.", { title: "Restart editor to refresh settings" } ) .then(function () { vscode.commands.executeCommand("workbench.action.reloadWindow"); }); } } catch (e) { if (/ENOENT|EACCES|EPERM/.test(e.code)) { vscode.window.showInformationMessage( "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." ); return; } else { vscode.window.showErrorMessage( "Something went wrong when starting neon dreams" ); return; } } } ); let disable = vscode.commands.registerCommand( "synthwave84.disableNeon", uninstall ); context.subscriptions.push(disposable); context.subscriptions.push(disable); } exports.activate = activate; // this method is called when your extension is deactivated function deactivate() { // ... } function uninstall() { const isWin = /^win/.test(process.platform); const appDir = `${path.dirname(vscode.env.appRoot)}/app/out`; const base = appDir + (isWin ? "\\vs\\code" : "/vs/code"); const electronBase = isVSCodeBelowVersion("1.70.0") ? "electron-browser" : "electron-sandbox"; const htmlFileName = "workbench.html"; const htmlFile = base + (isWin ? "\\" + electronBase + "\\workbench\\" + htmlFileName : "/" + electronBase + "/workbench/" + htmlFileName); // modify workbench html const html = fs.readFileSync(htmlFile, "utf-8"); // check if the tag is already there const isEnabled = html.includes("neondreams.js"); if (isEnabled) { // delete synthwave script tag if there let output = html.replace( /^.*( Githubissues.

  • Githubissues is a development platform for aggregating issues.