Community
    • Login

    Feature Request: Add Arduino Sketch INO files to file menu

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 4 Posters 2.8k 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.
    • Alan KilbornA
      Alan Kilborn
      last edited by

      @Meta-Chuh said:

      extract it, and copy Arduino_Language_0.2.0.xml to %AppData%\Notepad++\userDefineLangs\

      after that all .ino files will be automatically detected and highlighted as arduino files.

      I’m kind of an Arduino dabbler, so I tried this, and as a portable N++ user I copied to …\npp.7.6.6.bin\userDefineLangs\

      After a restart of N++ I loaded a valid .ino file and the file type on Notepad++'s status bar still said “C++ source file” (which I presume is Scintilla deciding that enough of my file looks like C++?). I guess my expectation was that the status bar would say “INO file” (based upon your description of what would happen; maybe I interpreted it poorly).

      Anyway, did I do something wrong, or maybe this method doesn’t work for portable N++?

      SInce I didn’t get the first part to work, I didn’t try the 2nd part (autocomplete).

      Thx, MC!

      Alan KilbornA 1 Reply Last reply Reply Quote 2
      • Alan KilbornA
        Alan Kilborn @Alan Kilborn
        last edited by

        …actually it is very reasonable that an .INO file is detected as C++ (if that’s what’s happening)…the Arduino stuff really is C++, it’s just the designers thought they’d be cute and complicate things by giving the “main” file of the project the .INO extension (all other files, if any, have the typical .h, .cpp extensions).

        1 Reply Last reply Reply Quote 2
        • PeterJonesP
          PeterJones
          last edited by

          @Alan-Kilborn said:

          which I presume is Scintilla deciding that enough of my file looks like C++

          AFAIK, Scintilla doesn’t guess things like that. Looking in Settings > Style Configurator > C++, .ino is in the list of default extensions, because Arduino .ino files are C++; they’ve just got some other libraries included, and the main() function is buried in one of those libraries, rather than being something you include in your source code. But it’s the definition of .ino being a default extension in the C++ list that causes Scintilla to recognize it as such.

          I tried to replicate your results – I exited notepad++, downloaded, extracted into my portable userDefineLangs folder, reloaded Notepad++, saw Arduino in my UDL list, and opened an .ino file (randomly downloaded off the interwebs), and it properly recognized as a UDL-Arduino file.

          Alan KilbornA 1 Reply Last reply Reply Quote 2
          • Alan KilbornA
            Alan Kilborn @PeterJones
            last edited by

            @PeterJones

            Ah, okay. Thx, Peter. I’m not anywhere close to knowing much about UDLs. Or, apparently that N++ knows by default that INO is in the extension list for C++…

            So if I load the .INO file, like I said it will say C++ on the status bar. If I go to the Language menu I see “Arduino” right below “Define your language…”, but it is not ticked. If I select it it becomes ticked and now my status bar says “User Defined language file - Arduino”.

            I guess I would have thought that I would not have had to select the UDL and it would have automatically known. But as it is still in the extension list for C++…hmmmmm…

            1 Reply Last reply Reply Quote 1
            • PeterJonesP
              PeterJones
              last edited by

              @Alan-Kilborn said:

              I guess I would have thought that I would not have had to select the UDL and it would have automatically known

              And it did auto-identify on mine. The status bar properly says “User Defined Language file - Arduino”. The extension in the UDL overrides a “default ext” from another language.

              “What’s your debug info?” ;-) Seriously, though, I don’t know why yours is behaving differently.

              1 Reply Last reply Reply Quote 2
              • PeterJonesP
                PeterJones
                last edited by

                @Jim-Pruitt said:

                INO’s are a subset of C but I saw no option in the file types.

                Personally, though I’ve been experimenting with the Arduino UDL just for purposes of helping, I would be more likely to actually just use the C++ syntax highlighter that it wants to use.

                If I cared about highlighting Arduino-specific keywords, I would probably add user-defined keywords (Settings > Style Configurator > Language: C++ > Style: INSTRUCTION WORD or TYPE WORD, add to the User-defined keywords box).

                Alternatively, I would look for the EnhanceAnyBuiltinLexer.py that @Ekopalypse shares here, and add the Arduino-specific keywords/highlighting there. (This will allow more options, for doing more styles than just adding user-defined keywords attached to one or two styles in C++.)

                Alan KilbornA 1 Reply Last reply Reply Quote 4
                • PeterJonesP
                  PeterJones
                  last edited by

                  @PeterJones said:

                  And it did auto-identify on mine.

                  @Alan-Kilborn,

                  I cleared it out and started fresh. It still auto-detects for me:

                  1 Reply Last reply Reply Quote 3
                  • Alan KilbornA
                    Alan Kilborn @PeterJones
                    last edited by Alan Kilborn

                    @PeterJones said:

                    If I cared about highlighting Arduino-specific keywords, I would probably add user-defined keywords (Settings > Style Configurator > Language: C++ > Style: INSTRUCTION WORD or TYPE WORD, add to the User-defined keywords box).

                    I agree. I did some more experimentation with the Arduino UDL, and I don’t really see the point of its creation. It is simply C++ with some additional “keywords” that can easily be handled, if desired, as Peter says.

                    Autocompletion, however, may make it useful…off to experiment with that now…

                    1 Reply Last reply Reply Quote 2
                    • Alan KilbornA
                      Alan Kilborn
                      last edited by

                      Okay, after some trials, the autocompletion for Arduinio IS useful, for Function parameters hint on input.

                      [ BTW, I can’t stand Notepad++'s main auto-completion, namely Enable auto-completion on each input. I have a Pythonscript that does “completion” for me in a much better manner IMO. ]

                      So…I’m wondering (mainly out of curiosity, but I would use it) if there is a reasonable way to not use the “first part” but yet use the “second part” of @Meta-Chuh 's original solution for this?

                      First part = copy Arduino_Language_0.2.0.xml to %AppData%\Notepad++\userDefineLangs\

                      Second part = copy Notepad++.Arduino.0.2.0\APIs\Arduino.xml form above’s zip into autoCompletion inside your notepad++ program folder

                      Meta ChuhM 1 Reply Last reply Reply Quote 2
                      • Meta ChuhM
                        Meta Chuh moderator @Alan Kilborn
                        last edited by

                        @Alan-Kilborn

                        only if you merge the parts you need from Arduino.xml to cpp.xml.
                        so you would use the c++ lexer with an extended cpp.xml autocompletion file for arduino.

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