Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the largest filesize supported by VS Code syntax highlighting?

VS Code provides syntax highlighting automatically for xml and json files out-of-the-box. But when you start to process file that is larger than a certain size, the syntax highlighting no longer works.

Many other features might be disabled as well.

For example,

  • Open a json/xml file less than 10MB, everything is normal.
  • Open a json/xml file larger than 40MB, syntax highlighting does not work.

What is the root cause for this, and what is the exact limit of file size for these capabilities to work?

like image 447
Sajuuk Avatar asked Dec 05 '18 05:12

Sajuuk


1 Answers

This is controlled by the "editor.largeFileOptimizations" setting in VS Code. As of VS Code 1.30, the limits are:

  • 20MB
  • Or 300K lines

These values are defined here

You can disable this behavior by setting "editor.largeFileOptimizations": false. However we disable features on large files for performance reasons, and forcing VS Code to syntax highlight large files may result in poor editor performance.

like image 117
Matt Bierner Avatar answered Nov 15 '22 09:11

Matt Bierner