Community
    • Login

    How to prevent auto syntax highlighting for files with xml tag in first line?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 647 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pintassilgoP
      pintassilgo
      last edited by

      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.

      pintassilgoP 1 Reply Last reply Reply Quote 0
      • pintassilgoP
        pintassilgo @pintassilgo
        last edited by

        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?

        Lycan ThropeL 1 Reply Last reply Reply Quote 1
        • Lycan ThropeL
          Lycan Thrope @pintassilgo
          last edited by Lycan Thrope

          @pintassilgo ,

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

          1 Reply Last reply Reply Quote 0
          • rdipardoR
            rdipardo
            last edited by

            Answered on GitHub.

            1 Reply Last reply Reply Quote 3
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors