diff --git a/website/.vitepress/config.ts b/website/.vitepress/config.ts index 26c64edd..c2421d2a 100644 --- a/website/.vitepress/config.ts +++ b/website/.vitepress/config.ts @@ -72,6 +72,7 @@ export default defineConfig({ text: 'Tooling Overview', link: '/guide/tooling-overview.html', collapsed: true, items: [ { text: 'Editor Integration', link: '/guide/tools/editors.html' }, + { text: 'JSON mode', link: '/guide/tools/json.html' }, ], }, { text: 'API Usage', link: '/guide/api-usage.html', collapsed: true, diff --git a/website/guide/tooling-overview.md b/website/guide/tooling-overview.md index 3db14c7a..04bf8f7c 100644 --- a/website/guide/tooling-overview.md +++ b/website/guide/tooling-overview.md @@ -66,20 +66,7 @@ The format of the JSON output is an array of match objects. ] ``` -By default, ast-grep prints the matches in a JSON array that is formatted with indentation and line breaks. -`--json` is equivalent to `--json=pretty`. This makes it easy to read the output by humans. -However, this might not be suitable for other programs that need to process the output from ast-grep. For example, if there are too many matches, the JSON array might be [too large to fit in memory](https://www.wikiwand.com/en/Out_of_memory). - -To avoid this problem, you can use the `--json=stream` option when running ast-grep. This option will make ast-grep print each match as a separate JSON object, followed by a newline character. This way, you can stream the output to other programs that can read one object per line and parse it accordingly. - -`--json` accepts one of the following values: `pretty`, `stream`, or `compact`. - -:::danger `--json=stream` requires the equal sign -You have to use `--json=