What should I set for 'json.maxItemsComputed' in VS Code?

Viewed 14083

The default states 5000 symbols. Is this dependent on the machine's performance or something else?

From VS Code settings:

JSON: Max Items Computed The maximum number of outline symbols and folding regions computed (limited for performance reasons).

2 Answers

This relates to the GUI buttons in the editor, you can use to fold down the JSON tree.

If there are more items than the maximum, the routine that prepares those buttons will just give up, and the buttons won't be displayed. I've experienced it for a package-lock.json in a project with lots of dependencies.

A reasonable approach for this would be:

  • Leave it at the default
  • If you encounter a JSON file that doesn't show the folding controls, consider whether you actually need them
    • if you don't need them - no problem
    • if you do need them - increase the limit (perhaps temporarily)
    • if you then experience performance problems editing JSON files, reduce the limit

To avoid performance issues with large JSON files, JSON language support now has an upper limit on the number of folding regions and document symbols it computes (for the Outline view and breadcrumbs). By the default, the limit is 5000 items, but you can change the limit with the setting json.maxItemsComputed.

Related