March 7, 2024 • Engineering/VS Code
The VS Code extension runtime uses Node.js (via Electron) and you can thus use Node.js related debugging tool.
Here's a quick guide on how to record performances traces of VS Code extensions:
/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron --inspect-extensions=9333
After VS Code is started, you want to head over to Chrome and go to chrome://inspect
which should open up a view like this:
From here you want to configure the inspect server that we just started on port 9333. To do this, click on "Open dedicated DevTools for Node", go to the "Connection" tab if that is not open yet, and make sure to add localhost:9333
to the list like this:
Now, head back to the chrome://inspect
tab and you should see a new remote target that you can inspect. For me this looks like this:
Clicking this will open a (somewhat reduced) DevTools view. Great! We've almost got it. From here you can go to the "Performance" tab to record a trace. Then, swap tabs to the VS Code window and interact with the extension. Come back later to stop the recording and export it. Voila!
Engineer at Tailwind Labs.
Prev: Engineer at Sourcegraph and Meta, curator of This Week in React, React DOM team member, and Team Lead at PSPDFKit.