GithubHelp home page GithubHelp logo

monkey-patch's People

Contributors

cblavier avatar disco0 avatar forivall avatar knopp avatar lehni avatar russelldavis avatar twome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monkey-patch's Issues

Why does MP need to run /bin/sh/ as Super User?

I'm trying to use the CustomizeUI extension to change sidebar fonts. It relies on Monkey-Patch.

When I run 'Enable Monkey Patch', I click 'Proceed' on it's popup Then Ubuntu pops up
"Authentication is needed to run '/bin/sh' as the super user

I'm reluctant to give anything superuser without clear justification, so I just want to know why? And if it can be documented.

Access to electron API and VSCode methods.

Sorry to use your issue tracker for questions, but I'm trying to implement swipe to navigate and I was wondering if monkey patching would give me access to the Electron BrowserWindow and the ability to access IWorkbenchEditorConfiguration and other VSCode code that isn't listed as pub (TypeScript accessors).

I kinda rely heavily on microsoft/vscode#82528 and unfortunately it got yanked - I am not exactly sure why, but I am guessing it stemmed from confusion on what it was supposed to do and the team doesn't want to rely on further Electron API usage.

Question: What should I do to replace just a small portion of the file `workbench.desktop.main.js`?

Well, I think I need some help (even though my previous question was ignored but now I solve it partly).

I wish to change the fonts of the interface of VSC. I am using Windows 11.

Suppose that I wish to replace the Segoe fonts by Comic Sans MS (I do not really like it; I just use it as an example). The following code replaces the fonts in most of the places by Comic Sans MS.

.windows {
    font-family: "Comic Sans MS", sans-serif !important;
}

Nevertheless, the fonts in pages such as Release Notes are not controlled by CSS. I find that modifying workbench.desktop.main.js (which is in the same directory as workbench.desktop.main.css) works. Specifically, first, go to the 912th line. Then, replace '"Segoe WPC", "Segoe UI", sans-serif' by '"Comic Sans MS", sans-serif'.
image
(I have multiple versions of VSC.) At last, save the file and restart VSC. Open Release Notes and the fonts are really changed.

This approach is direct but tiring. I have to modify workbench.desktop.main.js manually whenever VSC is updated. (I use VSC Insiders, too.)

My question is whether there is a way to modify DEFAULT_FONT_FAMILY by monkey-patch.

Thank you in advance.

Latest VSCode v1.50 breaks `Enable monkey patch` command?

Hello, thank you for creating this extension and I have been using this for half a year. I use this extension together with iocave/customize-ui

Had no issues at all until just now where I literally upgraded VSCode to v1.50, Enable monkey patch command (as usual every time I updated VSCode).

VSCode v1.50
Monkey patch v0.1.10
Customize UI v0.1.46

After Enable monkey patch, I restart VSCode. VSCode did not launch at all. Go to command line code --version and I got this

PS C:\Users\jody> code --version
C:\Program Files\Microsoft VS Code\resources\app\out\bootstrap.js:7
if(!o||!n)return void console.warn("setupNLS() is only available in node.js environments");let e={availableLanguages:{}};if(process.env.VSCODE_NLS_CONFIG)try{e=JSON.parse(process.env.VSCODE_NLS_CONFIG)}catch(e){}if(e._resolvedLanguagePackCoreLocation){const r=Object.create(null);e.loadBundle=function(t,i,s){const a=r[t];if(a)return void s(void 0,a);const c=o.join(e._resolvedLanguagePackCoreLocation,`${t.replace(/\//g,"!")}.nls.json`);n.promises.readFile(c,"utf8").then((function(e){const o=JSON.parse(e);r[t]=o,s(void 0,o)})).catch(o=>{try{e._corruptedFile&&n.promises.writeFile(e._corruptedFile,"corrupted","utf8").catch((function(e){console.error(e)}))}finally{s(o,void 0)}})}}return e},fileUriFromPath:function(e,o){let n,r=e.replace(/\\/g,"/");return r.length>0&&"/"!==r.charAt(0)&&(r=`/${r}`),(n=o.isWindows&&r.startsWith("//")?encodeURI(`${o.scheme||"file"}:${r}`):encodeURI(`${o.scheme||"file"}://${o.fallbackAuthority||""}${r}`)).replace(/#/g

TypeError: Cannot read property 'isWindows' of undefined
    at Object.fileUriFromPath (C:\Program Files\Microsoft VS Code\resources\app\out\bootstrap.js:7:808)
    at Object.<anonymous> (C:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js:17:49)
    at Module._compile (internal/modules/cjs/loader.js:1014:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1051:10)
    at Module.load (internal/modules/cjs/loader.js:862:32)
    at Module._load (internal/modules/cjs/loader.js:774:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:899:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Program Files\Microsoft VS Code\resources\app\out\cli.js:5:199)
    at Module._compile (internal/modules/cjs/loader.js:1014:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1051:10)
    at Module.load (internal/modules/cjs/loader.js:862:32)
    at Module._load (internal/modules/cjs/loader.js:774:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1103:10)
    at internal/main/run_main_module.js:17:11

Things I have tried. Reinstall VSCode, it can be launched again, then Enable monkey patch again, then same things happen. I tried this for 3 times without any luck. What is the issue here?

Thank you for the help.

Unable to successfully use contribute

Hello, I am trying to develop an extension that injects a js file with the help of monkey-patch however I had no luck making the extension work. since I am running my extension in development mode, I think monkey patch is unable to locate the file I am trying to inject because It keeps asking me to restart vscode indefinitely.
Is there any specific way to test my extension before publishing ?
monkeyPatch.exports.contribute("mondersky.tabscolor", { folderMap: { "tabscolor": modulesPath(context), }, browserModules: [ "tabscolor/test" ], mainProcessModules: [ "tabscolor/test2", ] } );

Unable to enable monkey patch due to a missing file

I can't enable Monkey Patch Extension in Code-1.73.1-1 (the Open Source version of VSCode) on ArchLinux.

The error is

Monkey Patch failed: Error: ENOENT: no such file or directory, open '/usr/lib/code/out/vs/code/electron-browser/workbench/workbench.html'

Indeed the package code doesn't contain the file and the directory workbench. Instead it contains /usr/lib/code/out/vs/code/electron-sandbox/workbench/workbench.html.

I have created a symlink from /usr/lib/code/out/vs/code/electron-sandbox/workbench to /usr/lib/code/out/vs/code/electron-browser/workbench and the command Enable Monkey patch has completed successfully (hopefully).

Blank screen on Mac after Dec Update

Code version: November 2021 (version 1.63)

I get this error with code --verbose

[main 2021-12-13T03:49:36.354Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
[65899:1212/214936.407085:INFO:CONSOLE(22)] "Uncaught (in promise) TypeError: Cannot convert undefined or null to object", source: vscode-file://vscode-app/Users/tasnyder/Library/Application%20Support/Code/User/globalStorage/iocave.monkey-patch/modules/browser-entrypoint.js (22)

Code ends up looking like this:
image

Deleting the files in that directory work but they re-appear and make the issue reappear after another restart.

Snippet from that file (starting at line 20):

		let joined = prevPattern.toString().slice(1, -1) + additionalPattern.toString().slice(1, -1);
		loaderConfig.amdModulesPattern = new RegExp(joined);
		Object.assign(loaderConfig.paths, {
			"customize-ui" : "../../../../../../Users/tasnyder/Library/Application Support/Code/User/globalStorage/iocave.customize-ui/modules",
			"monkey-generated" : "../../../../../../Users/tasnyder/Library/Application Support/Code/User/globalStorage/iocave.monkey-patch/modules"
		});
		require.define("monkey-patch", {

Fails with VS Code 1.69

After enabling the extension, the editor no longer works (blank window). —verbose says that vs/code/electron-browser/workbench/workbench-monkey-patch.html cannot be found.

I am using the latest release (0.1.17).

Everything worked fine until VS Code update itself and the extension this morning.

Catalina Read-only file system

Monkey Patch failed: Error: Command failed: /bin/sh /var/folders/09/zy13f7491k71jl4lg5cwk3fw0000gn/T/1eaf7875-55ff-4d3d-85b8-1b3d73f8ed87/script.sh cp: /private/var/folders/09/zy13f7491k71jl4lg5cwk3fw0000gn/T/AppTranslocation/BD8A7E64-C833-4047-BCCD-E4F1914A6EA4/d/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js.monkey-patch.backup: Read-only file system cp: /private/var/folders/09/zy13f7491k71jl4lg5cwk3fw0000gn/T/AppTranslocation/BD8A7E64-C833-4047-BCCD-E4F1914A6EA4/d/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js: Read-only file system cp: /private/var/folders/09/zy13f7491k71jl4lg5cwk3fw0000gn/T/AppTranslocation/BD8A7E64-C833-4047-BCCD-E4F1914A6EA4/d/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench-monkey-patch.html: Read-only file system

I guess it's a Catalina problem but not sure how to fix it.

Enabling does not have write permissions, how to fix?

OSX latest:

Monkey Patch failed: Error: Command failed: /bin/sh /var/folders/fg/g81x8hq51l14nnxd6wvg81hr0000gn/T/77dbcc76-fa9c-43ce-a978-4930e3da9a70/script.sh cp: /private/var/folders/fg/g81x8hq51l14nnxd6wvg81hr0000gn/T/AppTranslocation/D65D6F49-B343-4E1A-BAF0-733C38813033/d/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js.monkey-patch.backup: Read-only file system

can i run with sudo from CLI?

Question: How can I change fonts in Webviews?

I want to change fonts in Webviews. I opened the Developer Tools, and I tried to inspect the elements.

image

image

I could modify the font family temporarily.

image

image

Therefore, I attempted to change the fonts permanently by customizeUI.stylesheet:

{
    "customizeUI.stylesheet": {
        "body": "font-family: Simsun;",
        "code": "font-family: 'Victor Mono';"
    }
}

However, it did not work after I reloaded VS Code.
image

Maybe Customize UI does not modify Webviews. If so, how can I change fonts in Webviews via Monkey Patch? I know nothing about JavaScript or CSS.

Monkey patch fails with VS 1.70.0-insider

Monkey Patch failed: Error: ENOENT: no such file or directory, open '/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html'

Version: 1.70.0-insider
Commit: 3104db414c8fedcf6e4493f14da7df0b7413853a
Date: 2022-07-08T05:16:29.757Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Darwin x64 21.5.0

Make `promptRestart()` public.

I know it's a hacky way, and it seems to have a bug where the restart prompt pops up twice, and doesn't actually restart. It only restarts when you close the window, at least on macOS.

But it would nice not to have to replicate

private async promptRestart() {
this in extensions using monkey-patch - for future updates where this can be fixed to something better.

How build this extension?

I want to make some changes for my own use but I get an error during node_modules install

I am using node 18.12.1

 ~/g/monkey-patch  yarn install
yarn install v1.22.19
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
warning [email protected]: The engine "vscode" appears to be invalid.
[2/5] Resolving packages...
warning [email protected]: This package is deprecated in favor of @types/vscode and vscode-test. For more information please read: https://code.visualstudio.com/updates/v1_36#_splitting-vscode-package-into-typesvscode-and-vscodetest
warning vscode > mocha > [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning vscode > [email protected]: This package has been renamed to @vscode/test-electron, please update to the new name
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
$ node ./node_modules/vscode/bin/install
[########################################################################################################################] 142/142Detected VS Code engine version: ^1.71.2
Found minimal version that qualifies engine range: 1.71.2
Fetching vscode.d.ts from: https://raw.githubusercontent.com/Microsoft/vscode/74b1f979648cc44d385a2286793c226e611f59e7/src/vs/vscode.d.ts
Error installing vscode.d.ts: Error: Request returned status code: 404
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Only one extension seem to get bootstrapped.

During development, I installed both monkey patch and customize-ui for testing purposes.
It seems like it would only load customize-ui and not my extension.

There is a large chance that I am doing something wrong, but I was hoping you could test it yourself since you know better.

This is not a problem when loading my scripts through config instead of the API - so it's not a show stopper for me.

Btw, monkey-patch is a life saver, thank you.

Publish to OpenVSX

This plugin has a version on openvsx, but it is very outdated. The reason it probably that it was autocompiled, and npm install no longer runs on this repository successfully.

Is it possible to publish this to OpenVSX? (same for customize-ui)
Or at the very least, release the vsix file here?

Question: setattr Can't Find Attributes

I am currently working on a test of authentication for a class and have a self.authenticate attribute in the class. While, I am using monkeypatch, it reports AttributeError: <class 'gatorgrade.output.out_issue_tracker.issueReport'> has no attribute 'authenticate'. Does setattr only support methods?

Screenshot 2023-03-22 at 6 25 42 PM

Screenshot 2023-03-22 at 6 25 24 PM

Enabling monkey patch changes the install to "OSS Dev"

This means no extensions store and a separate new .vscode folder in appdata (windows), so all your settings.json and stuff is still in the old .vscode folder... This happened after I updated my 7-8 months old VSCode to the current version. Tried reinstalling, doesn't help.

Fails to enable on macOS Catalina (10.15.4)

Getting this when I try to enable on macOS Catalina. SIP is disabled.

Monkey Patch failed: Error: Command failed: /bin/sh /var/folders/n4/fs7wrdjs2sg31rmz5w0d30b4mjv4zl/T/9ba3391b-94ab-4a91-b28a-1ffa6e93121e/script.sh
cp: /private/var/folders/n4/fs7wrdjs2sg31rmz5w0d30b4mjv4zl/T/AppTranslocation/A1E25A1E-F8C5-4C77-82DA-628178515B8F/d/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js.monkey-patch.backup: Read-only file system
cp: /private/var/folders/n4/fs7wrdjs2sg31rmz5w0d30b4mjv4zl/T/AppTranslocation/A1E25A1E-F8C5-4C77-82DA-628178515B8F/d/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js: Read-only file system
cp: /private/var/folders/n4/fs7wrdjs2sg31rmz5w0d30b4mjv4zl/T/AppTranslocation/A1E25A1E-F8C5-4C77-82DA-628178515B8F/d/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench-monkey-patch.html: Read-only file system

macOS ventura v13.0: Operation not permitted

Hi,

Since the update of macOS to v13.0 with Monkey-Patch v0.1.23.

Version: 1.72.2 (Universal)
Commit: d045a5eda657f4d7b676dedbfa7aab8207f8a075
Date: 2022-10-12T22:16:30.254Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 22.1.0
Sandboxed: No

I am getting below error:

Monkey Patch failed: Error: Command failed: /bin/sh /var/folders/j7/zntnxhkd1qq4l7nn5kbz4w6h0000gn/T/46299b26-50f7-431b-bc1a-7c59aca8c16e/script.sh 
cp: /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js.monkey-patch.backup: Operation not permitted 
cp: /Applications/Visual Studio Code.app/Contents/Resources/app/out/main.js.monkey-patch-backup: Operation not permitted cp: /Applications/Visual Studio Code.app/Contents/Resources/app/out/main.js: Operation not permitted 
cp: /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js: Operation not permitted 
cp: /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench-monkey-patch.html: Operation not permitted

What would it take to port this to AzureDataStudio ?

Just curious what it would take to do this. AzureDataStudio is very much like VSCode in how it's set up, I can even transfer some themes over that aren't available on the extensions store. Kinda wish Microsoft just made ADS a VSCode extension.

Anyways, I'm just curious what would be involved here and maybe it's something I'd be able to fork and work on. I did give it a go but it broke ADS (got a blank screen and had to uninstall from the CLI).

Cheers

Getting a "Cannot read property 'sideBar' of undefined" when toggling the side bar

Initially opened an issue in microsoft/vscode#140174 but discovered that after disabling the
monkey-patch extension, vscode did not throw that error anymore.

image

Issue Type: Bug

VS Code version: Code - Insiders 1.64.0-insider (f0054e049cd286ff317c738efe0fd8810b48ae98, 2022-01-05T05:24:27.310Z)
OS version: Darwin arm64 21.1.0
Restricted Mode: No

System Info
Item Value
CPUs Apple M1 Max (10 x 24)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 4, 4, 5
Memory (System) 32.00GB (3.00GB free)
Process Argv --crash-reporter-id 26c16dff-0d3a-4429-a92d-6ddd94bd74c9 --crash-reporter-id 26c16dff-0d3a-4429-a92d-6ddd94bd74c9
Screen Reader yes
VM 0%
Extensions (32)
Extension Author (truncated) Version
path-intellisense chr 2.6.0
vscode-eslint dba 2.2.2
gitlens-insiders eam 2022.1.504
vscode-npm-script eg2 0.3.23
prettier-vscode esb 9.1.0
vscode-jest-runner fir 0.4.47
copilot-nightly Git 1.7.4459
remotehub Git 0.21.2021121709
vscode-pull-request-github Git 0.34.2
rest-client hum 0.24.6
customize-ui ioc 0.1.55
monkey-patch ioc 0.1.16
vscode-peacock joh 4.0.0
git-graph mhu 1.30.0
dotenv mik 1.0.1
vscode-docker ms- 1.18.0
vscode-kubernetes-tools ms- 1.3.4
js-debug-nightly ms- 2022.1.417
vscode-typescript-next ms- 4.6.20220104
refactor p42 1.66.0
material-icon-theme PKi 4.11.0
material-product-icons PKi 1.1.1
vscode-yaml red 1.2.2
vscode-javascript-booster sbu 14.0.1
autoimport ste 1.5.4
code-spell-checker str 2.0.14
tabnine-vscode Tab 3.5.13
errorlens use 3.4.1
intellicode-api-usage-examples Vis 0.0.6
vscodeintellicode Vis 1.2.15
gistfs vsl 0.3.0
fig wit 0.0.5

(1 theme extensions excluded)

As of September 2022 update, Customize UI changes undone on VS Code restart

I am still working on confirming that this is a problem with Customize UI or what might have changed, but from several tests, it seems as if restarting VS Code undoes any changes from Customize UI. (Is this a Monkey Patch problem?)

From "Help: About":

Version: 1.72.0
Commit: 64bbfbf67ada9953918d72e1df2f4d8e537d340e
Date: 2022-10-04T23:21:58.256Z (1 day ago)
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 21.6.0
Sandboxed: No

Customize UI version v0.1.65.
Monkey Patch version v0.1.21.

If anyone can reproduce this, please reply? Thanks.

Untrusted html usage

Version: 1.55.0-insider (system setup)
Commit: d06d2f1d6245ce00b1c36a9cd81a9087d225173e
Date: 2021-03-26T14:01:14.867Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.21296

I get the following error when I try to modify the HTML (just replacing an inline style tag (vscode-tokens-styles)):

[uncaught exception]: Error: UNTRUSTED html usage, default trusted types policy should NEVER be reached

I have a very simple script included with Monkey Patch:

"monkeyPatch.browserModules": [
	// Will load "~/custom-modules/browser1.js" in browser process
	"/13/custom/vsm/monkey-styling/styler"
],

This script only modifies that inline style, it does nothing else. No dependencies. It worked for quite a long time now with Monkey Patch, but recently I get the error message above.

It's possible that this is nothing to do with Monkey Patch, more of some policy changes in vscode, then I'm sorry for bringing it up. (I couldn't find out what are that trusted types yet, tried to Google it, but I just find very confusing, unclear descriptions.)

Doesn't load modules anymore (1.54.1)

Version: 1.54.1
Commit: f30a9b73e8ffc278e71575118b6bf568f04587c8
Date: 2021-03-04T22:42:18.719Z (13 hrs ago)
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Darwin x64 19.6.0

I get the usual [Extension Host] Monkey Patch is active. and it does seem to replace the bootstrapper.
But my extension doesn't seem to run.

For now I disabled my extension and just use this configuration to load it directly for debugging purposes but to no avail.

"monkeyPatch.folderMap": {
    "my-custom-modules" : "~/my-custom-modules",
},

On a side note, do you know if there is a way to log from a mainprocess into the console or even pop an alert.
I can't tell if it's API breakage or the patches don't even load at all.

Enable failed?

Salut!

Monkey Patch failed: Error: Command failed: C:\Scratch\66349159-2c61-4da5-b649-92f26a358731\script.cmd
VS Codium 1.39.2, Windows 10 x64

Monkey Patch failed: Error: Command failed: C:\Scratch\32a80c7a-7739-489c-ad68-dc9cf0b8a4a7\script.cmd
VS Code 1.39.2, Windows 10 x64

What can I do?
I urge for Customize UI, because default fonts of UI make my eyes bleeding.

Thank you!

Can't run the patch because of Catalina's new R/O protection

Monkey Patch failed: Error: Command failed: /bin/sh /var/folders/1k/fc99xfks2zdff9xn_fg7ymt80000gn/T/541969d3-6ef4-48bb-b4f2-d6ce605a423e/script.sh
cp: /private/var/folders/1k/fc99xfks2zdff9xn_fg7ymt80000gn/T/AppTranslocation/14F8B44C-C70B-4C18-BD28-5799D7FB31C6/d/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js.monkey-patch.backup: Read-only file system
cp: /private/var/folders/1k/fc99xfks2zdff9xn_fg7ymt80000gn/T/AppTranslocation/14F8B44C-C70B-4C18-BD28-5799D7FB31C6/d/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js: Read-only file system
cp: /private/var/folders/1k/fc99xfks2zdff9xn_fg7ymt80000gn/T/AppTranslocation/14F8B44C-C70B-4C18-BD28-5799D7FB31C6/d/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench-monkey-patch.html: Read-only file system

I was on Mojave and now upgrading to Catalina, even with SIP disabled, the root is still on read-only protection.

[error] [uncaught exception in main]: Cannot read properties of undefined (reading 'apply')

When I click 'Retry as Sudo', the following error and cannot save the file.

[error] [uncaught exception in main]: Cannot read properties of undefined (reading 'apply'): TypeError: Cannot read properties of undefined (reading 'apply')
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js:82:14
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

Monkey Patch breaks latest Visual Code Insiders version

After updating to 1.48.0 and re-apply the patch, Visual Code suddenly won't open and boned. When I opened the app from Command Prompt, here's I got:

TypeError: bootstrap.uriFromPath is not a function at Object.<anonymous> (C:\Program Files\Microsoft VS Code Insiders\resources\app\out\bootstrap-amd.js:17:21) at Module._compile (internal/modules/cjs/loader.js:1012:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1049:10) at Module.load (internal/modules/cjs/loader.js:860:32) at Module._load (internal/modules/cjs/loader.js:772:14) at Function.Module._load (electron/js2c/asar.js:769:28) at Module.require (internal/modules/cjs/loader.js:897:19) at require (internal/modules/cjs/helpers.js:74:18) at startup (C:\Program Files\Microsoft VS Code Insiders\resources\app\out\main.js:8:1) at onReady (C:\Program Files\Microsoft VS Code Insiders\resources\app\out\main.js:8:247)

This probably an newest or recent issue on newest version of Monkey Patch because Visual Code doesn't want to open and shows the Bootstrap error. Hopefully it'll fixed soon.

Migrate package away from `vscode`

vscode package is deprecated, and actually using it from npm will fail. Yarn still works, but given this project currently uses npm, it should be migrated over to the new packages.

Failed to enable on WSL

I'm using vscode to connect to a WSL instance and work in Linux. Monkey patch fails to enable. The error I get is:

Monkey Patch failed: Error: ENOENT: no such file or directory, open '/home/anna/.vscode-server/bin/0ba0ca52957102ca3527cf479571617f0de6ed50/out/vs/code/electron-browser/workbench/workbench.html'

There's no code directory at all:

$ ls ~/.vscode-server/bin/0ba0ca52957102ca3527cf479571617f0de6ed50/out/vs
base  loader.js  platform  server

No workbench.htlm file could be found in ~/.vscode-server either.

Any ideas? Extension works fine on local Windows and throws error only in WSL.

Monkey patch corrupts the vscode 1.63.0 -- cannot open any file

I am not able to open any file.

error I am getting for every file is:

Unable to open 'blah.md': Cannot find module 'jschardet' Require stack: - electron/js2c/renderer_init.

VS Code version: Code - Insiders 1.63.0-insider (4e303fc, 2021-11-22T05:26:03.776Z)
OS version: Darwin x64 21.1.0
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 4, 4, 4
Memory (System) 16.00GB (0.02GB free)
Process Argv
Screen Reader no
VM 0%

Monkey Patch leaves VSCode in an unusable state

The latest VSCode version seem to crash when Monkey Patched, leaving the UI in an unusable state, and I can't even get the developer console to launch.

CustomizeUI related Config:

  "customizeUI.font.regular": "Inter",
  "customizeUI.font.monospace": "Input Sans",
  "customizeUI.titleBar": "inline",
  "window.titleBarStyle": "native",

VSCode version:

Version: 1.69.0
Commit: 92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9
Date: 2022-07-07T05:28:46.408Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Darwin arm64 21.1.0

Error when running Monkey Patch on M1 CPU

Encountering an error when running the extension on M1 CPU architecture:

Screenshot 2022-07-06 at 13 55 15

The Mac I'm on:
Screenshot 2022-07-06 at 13 55 55

I'll do my best to provide additional info as needed.

Thanks in advance!!

Loading modules in home directory via extension configuration fails, causes issues with Insiders

Version: 1.58.0-insider
Commit: 012b14606f75ec4fed90d7ab4154f63dffab9503
Date: 2021-06-11T05:12:17.675Z (15 hrs ago)
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Darwin x64 18.7.0

Log Screenshot

Log Content
[main 2021-06-11T20:20:30.317Z] Resolving machine identifier...
[main 2021-06-11T20:20:30.317Z] Resolved machine identifier: e4a6efdbd9e51b95219a23fd0596f5fad4a4f4fc2beb20efb752cd0ada9e50a1
[main 2021-06-11T20:20:30.318Z] Main->SharedProcess#connect
[main 2021-06-11T20:20:30.407Z] StorageMainService: creating global storage
[main 2021-06-11T20:20:30.409Z] lifecycle (main): phase changed (value: 2)
[main 2021-06-11T20:20:30.410Z] windowsManager#open
[main 2021-06-11T20:20:30.410Z] windowsManager#open pathsToOpen [ [Object: null prototype] {} ]
[main 2021-06-11T20:20:30.412Z] IPC Object URL: Registered new channel vscode:3bd64443-ca67-4558-a8a2-e2799f57c481.
[main 2021-06-11T20:20:30.413Z] window#validateWindowState: validating window state on 1 display(s) { mode: 1, x: 0, y: 23, width: 1273, height: 877 }
[main 2021-06-11T20:20:30.413Z] window#validateWindowState: 1 monitor working area { x: 0, y: 23, width: 1440, height: 877 }
[main 2021-06-11T20:20:30.413Z] window#ctor: using window state { mode: 1, x: 0, y: 23, width: 1273, height: 877 }
[main 2021-06-11T20:20:30.414Z] window: using vscode-file:// protocol and V8 cache options: bypassHeatCheck
[main 2021-06-11T20:20:30.470Z] windowsManager#open used window count 1 (workspacesToOpen: 0, foldersToOpen: 0, emptyToRestore: 0, emptyToOpen: 1)
[main 2021-06-11T20:20:30.511Z] lifecycle (main): phase changed (value: 3)
[main 2021-06-11T20:20:30.518Z] update#setState idle
[main 2021-06-11T20:20:30.518Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
[main 2021-06-11T20:20:30.753Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
[main 2021-06-11T20:20:31.162Z] vscode-file: Refused to load resource /Users/disk0/dotfile/vscode/style/out/code-custom.js from vscode-file: protocol (original URL: vscode-file://vscode-app/Users/disk0/dotfile/vscode/style/out/code-custom.js)
[47382:0611/132049.431379:INFO:CONSOLE(30)] "Error: [object Event]", source: vscode-file://vscode-app/Users/disk0/Library/Application%20Support/Code%20-%20Insiders/User/globalStorage/iocave.monkey-patch/modules/browser-entrypoint.js (30)
[main 2021-06-11T20:20:49.453Z] StorageMainService: creating workspace storage (1623442848764)

Loading with exact same configuration in standard Code edition has no issues.

I can see some font size changes after enabling, so it seems customize-ui changes are possibly loading. Additionally I can't open DevTools, Process Explorer, or About page when extension is enabled—can't check how much of this is reproducing on Windows atm, going to assume its something to do with electron issues on the current macOS insiders build

Possibly Related:

Monkey path not loading in VSCode 1.74.0

VSCode won't start. I'm testing it on macOS 13.0.1

❯ code --version
1.74.0
5235c6bb189b60b01b1f49062f4ffa42384f8c91
x64
❯ code --verbose
Loading monkey-patch
(node:56390) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'crypto')
    at P (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:25:24056)
    at i (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:25:33504)
    at get mainIPCHandle (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:32:6945)
    at p.<computed> (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:3:53298)
    at Oe.c (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:84:7310)
    at Oe.b (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:84:5809)
    at Oe.a (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:84:4864)
    at Oe.main (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:84:4709)
    at Object.<anonymous> (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:85:1732)
    at s._safeInvokeFunction (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:1337)
    at s._invokeFactory (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:1522)
    at s.complete (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:1801)
    at s._onModuleComplete (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:1112)
    at s._onModuleComplete (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:1358)
    at s._resolve (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:510)
    at s.defineModule (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:6066)
    at n (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:10527)
    at Object.R (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:6036)
    at s._safeInvokeFunction (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:1337)
    at s._invokeFactory (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:1522)
    at s.complete (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:1801)
    at s._onModuleComplete (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:1112)
    at s._onModuleComplete (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:1358)
    at s._resolve (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:510)
    at s.defineModule (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:6066)
    at y (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:6:1825)
    at h (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:2554)
    at Object.<anonymous> (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.nls.js:3:61)
    at e._createAndEvalScript (/Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:2598)
    at /Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:2237
    at /Applications/Dev/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js:82:14
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
(Use `Electron --trace-warnings ...` to show where the warning was created)
(node:56390) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

How to prevent panel actions collapse?

How to prevent panel actions collapse?
It seems to be related to

https://ticino.blob.core.windows.net/sourcemaps/17299e413d5590b14ab0340ea477cdd86ff13daf/core/vs/workbench/vs/workbench/file:/__w/1/s/src/vs/base/browser/ui/actionbar/actionbar.ts
	pull(index: number): void {
		if (index >= 0 && index < this.viewItems.length) {
			this.actionsList.removeChild(this.actionsList.childNodes[index]);
			dispose(this.viewItems.splice(index, 1));
		}
	}

vsc

Cannot grant super-user permission to Monkey Patch on Ubuntu 20.04

Hello,

When I receive the following prompt [1] and enter the correct credentials, I receive this error message [2].

[1]:
Screenshot from 2022-04-21 22-33-00

[2]:
Screenshot from 2022-04-21 22-32-34

I tried restarting VSCode and uninstalling and reinstalling the extension but to no avail. Is there a way to manually grant Monkey Patch sudo permissions ?

Sincerely,

Monkey patch prevents startup: UnhandledPromiseRejectionWarning

VS Code doesn't launch with Monkey Patch applied. I'm using Monkey Patch for CustomizeUI.

code --version
1.74.0

Output of code --verbose:

code --verbose
Gtk-Message: 10:57:17.151: Failed to load module "appmenu-gtk-module"
[47250:1212/105717.175930:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
Loading monkey-patch
(node:47250) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'crypto')
    at P (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:25:24056)
    at i (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:25:33504)
    at get mainIPCHandle (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:32:6945)
    at p.<computed> (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:3:53298)
    at Oe.c (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:84:7310)
    at Oe.b (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:84:5809)
    at Oe.a (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:84:4864)
    at Oe.main (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:84:4709)
    at Object.<anonymous> (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:85:1732)
    at s._safeInvokeFunction (/usr/share/code/resources/app/out/vs/loader.js:5:1337)
    at s._invokeFactory (/usr/share/code/resources/app/out/vs/loader.js:5:1522)
    at s.complete (/usr/share/code/resources/app/out/vs/loader.js:5:1801)
    at s._onModuleComplete (/usr/share/code/resources/app/out/vs/loader.js:6:1112)
    at s._onModuleComplete (/usr/share/code/resources/app/out/vs/loader.js:6:1358)
    at s._resolve (/usr/share/code/resources/app/out/vs/loader.js:6:510)
    at s.defineModule (/usr/share/code/resources/app/out/vs/loader.js:5:6066)
    at n (/usr/share/code/resources/app/out/vs/loader.js:5:10527)
    at Object.R (/usr/share/code/resources/app/out/vs/loader.js:6:6036)
    at s._safeInvokeFunction (/usr/share/code/resources/app/out/vs/loader.js:5:1337)
    at s._invokeFactory (/usr/share/code/resources/app/out/vs/loader.js:5:1522)
    at s.complete (/usr/share/code/resources/app/out/vs/loader.js:5:1801)
    at s._onModuleComplete (/usr/share/code/resources/app/out/vs/loader.js:6:1112)
    at s._onModuleComplete (/usr/share/code/resources/app/out/vs/loader.js:6:1358)
    at s._resolve (/usr/share/code/resources/app/out/vs/loader.js:6:510)
    at s.defineModule (/usr/share/code/resources/app/out/vs/loader.js:5:6066)
    at y (/usr/share/code/resources/app/out/vs/loader.js:6:1825)
    at h (/usr/share/code/resources/app/out/vs/loader.js:4:2554)
    at Object.<anonymous> (/usr/share/code/resources/app/out/vs/code/electron-main/main.nls.js:3:61)
    at e._createAndEvalScript (/usr/share/code/resources/app/out/vs/loader.js:4:2598)
    at /usr/share/code/resources/app/out/vs/loader.js:4:2237
    at /usr/share/code/resources/app/out/bootstrap-amd.js:82:14
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
(Use `code --trace-warnings ...` to show where the warning was created)
(node:47250) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

Uninstalling and reinstalling vscode solves the issue, but removes Monkey Patch.
Reapplying Monkey Patch then prevents startup again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.