Community
    • Login

    Changing language association of file extension

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    fileextension
    6 Posts 3 Posters 867 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.
    • jofe95J
      jofe95
      last edited by jofe95

      Hi everyone,
      I’d like to change the language association of the file extension “inc” from Pascal to Assembly language.
      I already modified the “ext” attributes in “langs.xml” in the AppData\Roaming\Notepad++ directory accordingly (deleted “inc” in “pascal” entry, inserted it in “asm” entry). However, the changes don’t take effect after several times closing and reopening Notepad++; opened *.inc files are still associated with Pascal.
      Could anybody please help to solve this problem?
      Thanks in advance!

      [Edit:] My debug info:
      Notepad++ v8.5.2 (64-bit)
      Build time : Apr 4 2023 - 19:55:32
      Path : C:\Program Files\Notepad++\notepad++.exe
      Command Line :
      Admin mode : OFF
      Local Conf mode : OFF
      Cloud Config : OFF
      OS Name : Windows 10 Pro (64-bit)
      OS Version : 22H2
      OS Build : 19045.2846
      Current ANSI codepage : 1252
      Plugins :
      mimeTools (2.9)
      NppConverter (4.5)
      NppExport (0.4)

      Mark OlsonM 1 Reply Last reply Reply Quote 0
      • Mark OlsonM
        Mark Olson @jofe95
        last edited by

        @jofe95
        Did you verify that your changes to the langs.xml file were not overwritten?

        I have no idea how to solve this, but my first guess is that Notepad++ overwrote your changes on exit.

        jofe95J 1 Reply Last reply Reply Quote 0
        • jofe95J
          jofe95 @Mark Olson
          last edited by

          @Mark-Olson
          Thanks for your reply.
          I checked it, my changes were not overwritten; the file still contains

          <Language name="asm" ext="asm inc" commentLine=";" commentStart="/*" commentEnd="*/">
          ...
          <Language name="pascal" ext="pas pp p lpr" commentStart="{" commentEnd="}">
          
          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @jofe95
            last edited by PeterJones

            @jofe95 said in Changing language association of file extension:

            I checked it, my changes were not overwritten; the file still contains

            Did you leave blah.inc open in Notepad++ when you exited Notepad++? If so, the “current session” remembers which Language is associated with an individual file.

            I did the following sequence:

            1. Open blah.inc under the old setup, and see that it’s Pascal
            2. Edit %AppData%\Notepad++\langs.xml, move the inc from pascal to asm
            3. Exit Notepad++
            4. Run Notepad++
            5. blah.inc is still open as a Pascal file
            6. Close blah.inc while Notepad++ is still running
            7. Open blah.inc: it is now an Assembly file

            If I do a different sequence:

            1. Open blah.inc under the old setup, and see that it’s Pascal
            2. Edit %AppData%\Notepad++\langs.xml, move the inc from pascal to asm
            3. Close blah.inc while Notepad++ is still running
            4. Exit Notepad++
            5. Run Notepad++
            6. Open blah.inc: it is an Assembly file
            Mark OlsonM jofe95J 2 Replies Last reply Reply Quote 2
            • Mark OlsonM
              Mark Olson @PeterJones
              last edited by

              @PeterJones
              Thanks for explaining this. I honestly had forgotten that this behavior existed. I was on the verge of submitting a feature request at the official repo because it seemed like some files whose extensions had UDL file associations were not being lexed on startup, and then it turned out that it was just that they were not lexed when I last closed Notepad++.

              I wonder if there’s a way to override this behavior? (Yes, probably PythonScript, but I consider that the method of last resort)

              1 Reply Last reply Reply Quote 0
              • jofe95J
                jofe95 @PeterJones
                last edited by

                @PeterJones
                OK, after reopening the *.inc file, it seems to work now. Thank you!

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