How to force syntax highlighting for large XML files?

2

For large XML files it seems like the Visual Studio text editor will not attempt to do syntax highlighting, so everything is black and white.

Is there a way to force it to parse for highlighting?

Louis

Posted 2012-11-22T23:26:01.877

Reputation: 18 859

Just how large are we talking about here? – Karan – 2012-11-23T21:32:32.490

@Karan I'm sorry, it's 14MB. – Louis – 2012-12-16T02:37:49.503

1Actually, I just noticed the Output window shows a warning: 'file.xml' is too large to open with XML editor. The maximum file size is '10' MB. Please update the registry key 'HKCU\Software\Microsoft\VisualStudio\11.0_Config\XmlEditor\MaxFileSizeSupportedByLanguageService' to change the maximum size. Changed that fixed it =! – Louis – 2012-12-16T02:41:14.837

Answers

2

It turns out the maximum file size for the XML editor is 10 MB. After changing the limit in the following key, syntax highlighting is back with no noticeable performance issues:

HKCU\Software\Microsoft\VisualStudio\11.0_Config\XmlEditor\MaxFileSizeSupported‌​ByLanguageService

Run regedit to navigate to that path in the Windows Registry. HKCU stands for HKEY_CURRENT_USER.

Louis

Posted 2012-11-22T23:26:01.877

Reputation: 18 859

1

Run this in powershell for VS 2017 and higher

$vsWherePath = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
$installPath = &$vsWherePath -all -latest -property installationPath
$vsregedit = Join-Path $installPath 'Common7\IDE\vsregedit.exe'
& $VsRegEdit read "$installPath" "HKLM" "XmlEditor" "MaxFileSizeSupportedByLanguageService" string
& $VsRegEdit set "$installPath" "HKLM" "XmlEditor" "MaxFileSizeSupportedByLanguageService" string 100
& $VsRegEdit read "$installPath" "HKLM" "XmlEditor" "MaxFileSizeSupportedByLanguageService" string

Daniel Fisher lennybacon

Posted 2012-11-22T23:26:01.877

Reputation: 125