How to prevent auto syntax highlighting for files with xml tag in first line?
-
I often need to edit a file that has 20,000 tags. Notepad++ hangs for 10 seconds on opening that file because it reads from the first line:
<?xml version="1.0" encoding="UTF-8"?>
then automatically applies XML syntax highlighting, and this process is super heavy and slow for that file.
I need to empasize: Notepad++ is detecting XML because of the first line. It’s not due to file extension. File extension is XSPF and this doesn’t matter. I can rename it to.js
and Notepadd++ still applies XML syntax. In the same way, if I keep.xspf
and just remove the first line, then Notepad++ opens the file without any formatting (and all slowness goes away!).So my question is how to prevent this. I need to open this file as “Normal text”, without any formatting.
This is not caused by XML Tools, this happens even without any plugin.
Also I don’t know why Notepad++ is so inefficient with XML files. SciTE opens the same file instantly, with syntax highlighting and fold marks.
-
I just realized that the first line
<?xml version="1.0" encoding="UTF-8"?>
is what’s causing the bug.
If I remove that line, but rename the file to
.xml
so that Notepad++ will sill open it with XML syntax highlight, the file opens instantly.So it’s not that Notepad++ is unable to properly handle XML files. It’s just that the first line is triggering some strange bug.
Should I report this?
-
Maybe you should. I never saw that behavior when I was trying to read just text, but then again, I didn’t rename the ext .xml. :)
-
Answered on GitHub.