Skip to content

Commit db01059

Browse files
authored
add documentation for vscode devtools (#12205)
1 parent e022f72 commit db01059

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

.semgrepignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ dist/
1111
# custom paths
1212
__tests__/
1313
./docs/source/data/subscriptions.mdx
14+
./docs/source/development-testing/developer-tooling.mdx
54.7 KB
Loading
39.3 KB
Loading

docs/source/development-testing/developer-tooling.md renamed to docs/source/development-testing/developer-tooling.mdx

+35
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,38 @@ You can install the extension via the webstores for [Chrome](https://chrome.goog
4040
While your app is in dev mode, the Apollo Client Devtools will appear as an "Apollo" tab in your web browser inspector. To enable the devtools in your app in production, pass `connectToDevTools: true` to the `ApolloClient` constructor in your app. Pass `connectToDevTools: false` if want to manually disable this functionality.
4141

4242
Find more information about contributing and debugging on the [Apollo Client Devtools GitHub page](https://github.com/apollographql/apollo-client-devtools).
43+
44+
## Apollo Client Devtools in VS Code
45+
46+
The Apollo VSCode extension ships with an instance of the Apollo Client Devtools.
47+
You can use it to remotely debug your client, which makes it possible to also debug React Native and node applications.
48+
49+
The following sections walk through how to install and integrate with the extension.
50+
51+
<Note>
52+
This feature is currently released as "experimental" - please try it out and give us feedback in our [GitHub issues](https://github.com/apollographql/vscode-graphql/issues)!
53+
</Note>
54+
55+
* Install the Apollo VS Code extension: [start installation](vscode:extension/apollographql.vscode-apollo) | [marketplace page](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo)
56+
* Set the "Apollographql > Dev Tools: Show Panel" setting to "detect" or "always" in the VS code settings dialog.
57+
<img class="screenshot" alt="A screenshot of the VS Code settings dialog focusing on the 'Show Panel' option" src="../assets/devtools/vscode-setting.png"/>
58+
* In your code base, install the `@apollo/client-devtools-vscode` package:
59+
```sh
60+
npm install @apollo/client-devtools-vscode
61+
```
62+
* After initializing your `ApolloClient` instance, call `registerClient` with your client instance.
63+
```js
64+
import { registerClient } from "@apollo/client-devtools-vscode";
65+
66+
const client = new ApolloClient({ /* ... */ });
67+
68+
// we recommend wrapping this statement in a check for e.g. process.env.NODE_ENV === "development"
69+
const devtoolsRegistration = registerClient(
70+
client,
71+
// the default port of the VSCode DevTools is 7095
72+
"ws://localhost:7095",
73+
);
74+
```
75+
* Open the "Apollo Client DevTools" panel in VS Code.
76+
* Start your application. It should automatically connect to the DevTools.
77+
<img class="screenshot" alt="Apollo Client Devtools in a VS Code panel" src="../assets/devtools/vscode-panel.png"/>

0 commit comments

Comments
 (0)