Community
    • Login

    Assigning a special UDL Languages

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 81 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.
    • Franz-Josef BadeF
      Franz-Josef Bade
      last edited by

      Hi,
      Surely, this is a little problem, but… unfortunately, I can’t solve it; I’m not familiar with notepad++.
      I want to use a UDL for files *.ahk. I’ve chosen the language “ini” in order to avoid to create a new language. But instead of commenting lines with “;” only at the beginning, commenting is applied to lines with “!” and “#”, too.
      More generally, in which way is the ini-language assigned to ahk-files? I see two alternatives:

      1. Choosing “Menu-Language” then ”I” and “INI File”
      2. Modifying the file “langs.xml” by including “ahk” into the option “ext”.
        <Language name=“ini” ext=“ini inf url wer ahk” commentLine=“;”
        But the 2. alternative does not work … and the first one neither (in avoiding the “!” commenting)…
        Thanks in advance for helping me to understand UDL-logics.
        FJB
      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Franz-Josef Bade
        last edited by PeterJones

        @Franz-Josef-Bade said in Assigning a special UDL Languages:

        I want to use a UDL for files *.ahk. I’ve chosen the language “ini” in order to avoid to create a new language.

        Those two statements are self-contradictory, because the UDL system and the existing builtin-language system should be thought of as two separate systems (update: which I can understand is confusing to someone new to the app).

        If you want a User Defined Language, then you use Language > User Defined Language > Define your language…, and you set your extension to match your filetype. If you want to use a built-in language “INI file” to handle your syntax highlighting, then you can use Settings > Style Configurator > Language: INI file and set user ext to ahk. Neither of these solutions requires changing langs.xml, so don’t do that.

        If you want to use the existing INI language, then you are going to have to accept all its features, including ! and # comments.

        If you don’t want those extra comments, then you will have to use the User Defined Language system. But since you are new to Notepad++, I would recommend using one of the prebuilt UDL publically available: specifically, the User Defined Language [UDL] Collection includes two AutoHotKey UDL definitions. I believe you would want the AutoHotKey V2 definition.

        To install the UDL from the collection, follow the instructions in the UDL Collection README – given you are new to Notepad++, I recommend following the “easy way” by installing my CollectionInterface plugin: after installing the plugin, and running the Plugins > CollectionInterface > CollectionInterface: Download command, you would scroll to AutoHotKey V2, decide whether or not to include the AutoCompletion additional file, and then Download. After the plugin finishes installing, it will restart Notepad++, and the UDL should be applied every time you open a file ending in .ahk.

        Good luck.

        Franz-Josef BadeF 1 Reply Last reply Reply Quote 2
        • Franz-Josef BadeF
          Franz-Josef Bade @PeterJones
          last edited by

          @PeterJones
          Many thanks, Peter, for your patient ;-) and informative explanation.
          I take the easy way (collectionInterface), it works…
          In my naivety, I imagined that langs.xml is directly connected to Settings>Style Configurator>Languages … ; in the sense that the file is the base of what is offered in the StyleConfigurator>Languages…
          Apparantly, it is’nt so… a real pity ;-)
          Again, many thanks, Peter.
          FJB

          PeterJonesP 1 Reply Last reply Reply Quote 1
          • PeterJonesP
            PeterJones @Franz-Josef Bade
            last edited by

            @Franz-Josef-Bade said in Assigning a special UDL Languages:

            I take the easy way (collectionInterface), it works…

            Glad it works. Making it “easy” is why I created that plugin.

            In my naivety, I imagined that langs.xml is directly connected to Settings>Style Configurator>Languages …

            Actually, it is. But you almost never need to edit it yourself. Style Configurator gives you access to every field that a normal user (like you) needs. If you edit the ext="..." list in langs.xml (and restart Notepad++), then the new extensions you add will show up in the Default ext list. But there’s no reason to do that, because adding something to the User ext list in the Style Configurator will have the same result. (Those user extensions are actually stored in your active theme, where all the colors are stored. The langs.xml is for the “default” extensions and “default” keywords, which you don’t need to edit.)

            ; in the sense that the file is the base of what is offered in the StyleConfigurator>Languages…
            Apparantly, it is’nt so… a real pity ;-)

            Again, no, it literally is the basis for the default keywords an default extensions. But the user keywords and user extensions are what the user should be editing, with regards to those.

            Regarding why you conclude it doesn’t affect that: My guess is that when you tried to add ahk to the langs.xml extension list, you neglected one or both of two necessary steps: 1) you have to save then exit Notepad++ and restart, because Notepad++ only reads that file on startup; and/or (2) you needed to close and re-open the blah.ahk file, because Notepad++ only uses the extension to determine the Language selection when you open a file, and it remembers it from one session to a next, so if you launch Notepad++ with the file having been open the last time, it will remember whatever its Language was set to the last time, rather than re-applying the file-extension rule for setting Language.

            But, as I said, and you’ve already implemented: the right way for getting the AHK highlighting you want is with the predefined UDL which you’ve installed using the plugin. So good job.

            Franz-Josef BadeF 1 Reply Last reply Reply Quote 2
            • Franz-Josef BadeF
              Franz-Josef Bade @PeterJones
              last edited by PeterJones

              @PeterJones
              Again, thanks a lot and good luck/success for your further work.
              Ps. Do you know perhaps an old program “VEDIT”? I worked with it for some decennies ;-) , but …

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