@@ -79,6 +79,60 @@ Now if you open this workspace in VS Code and open one of the source
7979files that was indexed, you should have go-to-definition and the other
8080features available.
8181
82+ ## Example: browse the React codebase with Glean
83+
84+ Clone a copy of React:
85+
86+ ```
87+ $ git clone --depth 1 https://github.com/facebook/react.git
88+ $ cd react
89+ ```
90+
91+ Start a Glean server:
92+
93+ ```
94+ $ glean-server --db-root .glean --port 1234 &
95+ ```
96+
97+ If you don't have ` Flow ` installed:
98+
99+ ```
100+ $ sudo npm install -g flow-bin
101+ ```
102+
103+ Index the code into a DB called ` react/0 ` :
104+
105+ ```
106+ $ grep -v '^%' scripts/flow/config/flowconfig >.flowconfig
107+ $ glean index flow . --write-root "" --service localhost:1234 --db react/0
108+ ```
109+
110+ Put the following into ` /tmp/react/.vscode/settings ` :
111+
112+ ```
113+ {
114+ "glean-lsp": {
115+ "repo": "react"
116+ },
117+ "glspc.server.command": "glean-lsp",
118+ "glspc.server.commandArguments": ["--service", "localhost:1234"],
119+ "glspc.server.languageId": [
120+ "typescript", "javascript"
121+ ]
122+ }
123+ ```
124+
125+ Start VS Code, and open the folder ` react ` that you cloned. You
126+ probably want to disable the built-in TypeScript extensions to avoid
127+ conflicts: ` Ctrl-Shift-X ` and filter on built-in extensions (Show
128+ Built-in Extensions in the ` ... ` dropdown), then disable the
129+ extensions for TypeScript for this workspace only.
130+
131+ Now open a ` .js ` file, and you should have navigation features
132+ provided by ` glean-lsp ` : try right-click and "Go to Definition" or "Go
133+ to References". Check that the Outline view is populated. Try symbol
134+ search with ` Ctrl-T ` .
135+
82136## Troubleshooting
83137
84138In the "Output" pane, select the output for the LSP client in the
0 commit comments