Ref: https://www.electronjs.org/blog/v8-memory-cage
Ensure VS Code is installed. Wrap it as a Node executable:
echo > ~/.local/bin/node-electron <<<EOF
#!/bin/bash
export ELECTRON_RUN_AS_NODE=1
exec "/Applications/Visual Studio Code.app/Contents/MacOS/Electron" "$@"
EOF
Intercept node with:
cat > ~/.local/zed-bin/node <<<EOF
#!/bin/bash
NODE_BIN=$HOME/.volta/bin/node
# If there are at least 3 arguments and the 3rd contains "eslintServer.js"
if [[ $# -ge 2 && "$2" == *"eslintServer.js"* ]]; then
# Run your custom command
exec ~/.local/bin/node-electron --max-old-space-size=1536 "$2" --stdio
else
exec "$NODE_BIN" "$@"
fi
EOF
Link npm
into this bin directory:
ln -s ~/.volta/bin/npm ~/.local/zed-bin/npm
In Zed, point node.path
to our wrapper script:
{
"node": {
"path": "/Users/qbane/.local/zed-bin/node"
}, ...
}