Community
    • Login

    Default Langauage for Files with No Extension

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 605 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.
    • waynecnrW
      waynecnr
      last edited by

      How can I set the default Language (XML, or JSON) for files with no extension?

      1 Reply Last reply Reply Quote 0
      • Terry RT
        Terry R
        last edited by

        @waynecnr said in Default Langauage for Files with No Extension:

        How can I set the default Language (XML, or JSON) for files with no extension?

        I don’t think you can, at least not with the configuration options available to you. In the case of XML or JSON, when you go to settings, style configurator, then select xml or json in the language box, you can ONLY add additional file extensions. There isn’t an option to remove the default ones, which is essentially what you want.

        I ran a small test and got these results:
        You can run Notepad++ from the commandline with additional arguments. So
        notepad++ -lxml d:\temp\this-is-an-xml-file-with-no-ext
        would load the named XML file (which has no extension) and then command Notepad++ to colourise it using the XML lexer.

        If the XML file had (on it’s first line) some code such as
        <?xml version="1.0" encoding="UTF-8" ?> (taken from the config.xml file, part of Notepad++ installation)
        then Notepad++ would automatically use the XML lexer as it does attempt to interpret the language to use by the content of the file. I presume a JSON file would also need to have some unique (to JSON) coding at/near the start so it could also be automatically recognised.

        Terry

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