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.jsand Notepadd++ still applies XML syntax. In the same way, if I keep.xspfand 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
.xmlso 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login