Community
    • Login

    Arduino language support

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 7.5k 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.
    • JP RoyJ
      JP Roy
      last edited by

      Just updated N++ to 7.9.1 and having problems with Arduino as a User defined Language. Before the update, I could see highlighted arduino keywords like Pinmode and a Function list was visible. Any idea what may have happened ?

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @JP Roy
        last edited by

        @JP-Roy

        Check here to see if ino is still set, maybe? :

        5b91403b-211e-439d-ac69-1dc10e62db08-image.png

        1 Reply Last reply Reply Quote 1
        • JP RoyJ
          JP Roy
          last edited by

          I verified this and the User ext: box was empty like it is in your comment. I added ino and it made no difference.

          Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @JP Roy
            last edited by

            @JP-Roy

            Oh, wait, I missed the part about you doing this as a UDL.
            I don’t use any UDLs so I’m not familiar with.
            Maybe someone else can help with that part.

            “Function List” has changed how it works in 7.9.1.
            But again, we are talking about using it with a UDL, so someone else will have to chime in with help.

            1 Reply Last reply Reply Quote 1
            • PeterJonesP
              PeterJones @JP Roy
              last edited by PeterJones

              @JP-Roy

              So, with Arduino code (which is just c++, really), you have two choices.

              1. If you want it to inherit all the features of the c++ lexer (including complex syntax highlighting and folding customized for c++ rules, plus builtin function list support), but just add the automatic association and a few keywords:
                1. As @Alan-Kilborn said, add ino (no dot) to the c++ user ext box
                2. Go into the INSTRUCTION WORD and/or TYPE WORD entries shown in the same screen that Alan showed, and fill in the user-defined keywords list with the Arduino-specific keywords
                3. If you don’t feel there are enough different colors (like you want to highlight Arduino keywords a different color than c++ keywords), you can add extra highlighting to a builtin lexer (like the C++ lexer) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo (his script works with a UDL, too)
              2. If, instead, you want to leverage the UDL you created in an older version of Notepad++ and is still in your list for NPP v7.9.1:
                1. Make sure the UDL is set up properly:
                  1. Languages > User Defined Language > Define your language
                  2. Pick Arduino (or whatever you named it) from the user language dropdown
                  3. make sure that ext is set to ino (no dot)
                    6a0b448c-3f43-417d-99d6-1ade4ee743e2-image.png
                  4. If it’s missing, you will have to re-create the UDL to match what you used to have.
                  5. Make sure you don’t have ino in the c++ user ext list if you go this route.
                2. Function List: Port the Arduino Function List parser that you implied you had into the v7.9.1 structure:
                  1. Close all Notepad++. Open a single new instance of Notepad++.
                  2. Open the old %AppData%\Notepad++\functionList.xml 🛈
                  3. Copy one of the new %AppData%\Notepad++\functionList\___.xml files to %AppData%\Notepad++\functionList\arduino.xml, and open
                  4. Copy the arduino <parser>...</parser> section from the old functionList.xml overtop the <parser>...</parser> section of the new arduino.xml file
                  5. open %AppData%\Notepad++\functionList\overrideMap.xml
                  6. Copy the <association id=... from the old functionList.xml into the overrideMap.xml; as explained in the official docs, the id should be the name of the XML file, so id="arduino.xml" in my nomenclature.
                3. References:
                  • This post gives the overview of the UDL+FunctionList process
                  • This post had some interim links, but has the useful summary (similar to my section 2.2 here):

                    To move your customized functionList.xml settings to the new format, you move the <association id=...> from functionList.xml into functionList\overrideMap.xml. And you move the <parser> section for your individual language into the XML file in the folder.

                  • official UDL overview => https://npp-user-manual.org/docs/user-defined-language-system/
                  • official Function List overview => https://npp-user-manual.org/docs/function-list/
                  • official v7.9.1 Function List config file details => https://npp-user-manual.org/docs/config-files/#v7-9-1-and-later-versions

              Since Arduino adds only keywords, and not brand new syntax, to c++, I don’t see a good reason for using UDL; I think the end result would be a lot more usable. But either one will work.

              JP RoyJ 1 Reply Last reply Reply Quote 5
              • JP RoyJ
                JP Roy @PeterJones
                last edited by

                @PeterJones I went with the 2nd option of keeping the Arduino UDL and creating the arduino.xml and modifying the overrideMap.xml and it worked !

                Thank you very much for your awesome support !!

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