Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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).

like image 483
Babadzhanov Avatar asked Jul 15 '20 15:07

Babadzhanov


People also ask

What is VSCode settings JSON file?

These files have a JSON extension, and JSON files are commonly used to configure vscode settings since they are familiar with many languages and developers, and the JSON structure is straightforward to comprehend. How to Open Settings.json File? There are various ways to open the Settings.json file and we will discuss each of Them.

What is JSON in Visual Studio?

JSON is a data format that is common in configuration files like package.json or project.json. We also use it extensively in Visual Studio Code for our configuration files.

What is the JSON editor mode in VS Code?

This mode is used for the VS Code configuration files such as settings.json, tasks.json, or launch.json. When in the JSON with Comments mode, you can use single line (//) as well as block comments (/* */) as used in JavaScript. The current editor mode is indicated in the editor's Status Bar.

How do I Reset my JSON settings in VS Code?

Open the settings.jsonfile with the Preferences: Open Settings (JSON)command and you should see the error highlighted with red squiggles. How can I reset my user settings? The easiest way to reset VS Code back to the default settings is to clear your user settings.jsonfile.


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
like image 54
slim Avatar answered Nov 15 '22 05:11

slim


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.

like image 22
TremAibar Avatar answered Nov 15 '22 05:11

TremAibar