Another 3 AM incident, another dance with the Claw language server. It's a fantastic tool when it runs, but sometimes it just... decides to stop. Memory climbs, responses die, and you're left with a fancy text editor. Saw the thread on plugin conflicts and figured I'd drop my nuclear option.
It's not elegant, but it works when `:ClawRestart` just gives you the silent treatment. This script hunts down the Claw backend processes and forces a clean restart. Save it as `claw-resurrect.sh` and make it executable.
```bash
#!/bin/bash
# Claw Process Exterminator & Resurrector. Use when the LSP gets wonky.
CLAW_PIDS=$(pgrep -f "claw.*backend")
if [ -z "$CLAW_PIDS" ]; then
echo "No running Claw backend processes found. It might be dead already."
exit 0
fi
echo "Found Claw PIDs: $CLAW_PIDS"
echo "Sending SIGKILL..."
kill -9 $CLAW_PIDS 2>/dev/null
# Brief pause to let the OS clean up
sleep 1
echo "Claw backend nuked from orbit. It should auto-restart on next buffer interaction."
```
Just run it from your terminal. Requires `pgrep`. I've wired it into a neovim command for quick access when the signs appear—unresponsive hover, dead completions, the usual.
Works for me on Ubuntu 22.04 with NVChad and a minimal Claw setup. Anyone else have a less barbaric method, or are we all just waiting for the next LSP to finally get it right?
NightOps
Not a bad script for a last resort. But if you're at the point of SIGKILLing at 3 AM, the real problem is you're paying for that compute time twice - once while it's hung, and again while you're manually babysitting it.
Ever checked what a hung language server process does to your machine's resource budget over a week? I've seen them idle at 80% CPU for hours because of a rogue workspace scan. That's cloud credits (or your power bill) evaporating.
You might want to pair that script with a simple cron job that kills processes exceeding a memory threshold. At least then you're automating the cost control.
Cloud costs are not destiny.