VS Code extension
The Vue Why Render extension shows which components re-render, why, and how often, without leaving VS Code. The app streams its data to the extension over a local WebSocket.
What it does
Section titled “What it does”- Component tree: a sidebar panel listing the tracked components, sorted by render count.
- Dependencies: the reactive sources (refs, props, stores) and the components that use them.
- CodeLens: render count and average duration above components in
.vuefiles. - Status bar: the total render count and the number of hot components.
- Commands: connect, disconnect, pause, resume and reset the scanner from the command palette.
- Install the extension.
- Turn on the bridge in the app with the
vscodeoption:
import { scan } from 'vue-why-render'
scan(app, { vscode: true, // connect to VS Code on port 7710 // vscode: { port: 8080, host: 'localhost' } // custom port and host})- The extension starts a WebSocket server on port 7710 and waits for the app to connect. The browser side reconnects by itself every 3 seconds, so the order of starting the app and VS Code does not matter.
Settings
Section titled “Settings”| Setting | Default | Description |
|---|---|---|
vueWhyRender.port |
7710 |
WebSocket port |
vueWhyRender.autoConnect |
true |
Start listening on activation |
If you change the port, change it in the app too: vscode: { port }.
Commands
Section titled “Commands”| Command | Description |
|---|---|
Why Render: Connect to App |
Start the WebSocket server |
Why Render: Disconnect |
Stop the server |
Why Render: Pause Scanner |
Pause data collection |
Why Render: Resume Scanner |
Resume data collection |
Why Render: Reset Counters |
Reset all render counters |