Apart for simple programs I find the arduino IDE a bit lacking. I tend to use Notepad++ for larger projects but found the built in C++ language setting did not highlight some arduino keywords so I have started working on a User Defined Language to better suit the arduino. Attached is my work in progress, I the hope someone else may find it helpful. I have not exhaustive added all the core keywords yet so there may be some problems. EDIT: I have updated the language file so re-download to test. EDIT2: See later post for more compatible way to add Arduino to N++
TCWORLD:
Cool. Does it work with keywords defined in the keywords.txt files?
Also, you appear to have missed 'print' and 'println' :~
The latest version I posted I only went through the main entries on the references page Arduino - Home but now you have told me about the more concise list I will update some more when I get time.
print & println work for me if proceeded by Serial. what context do you use it in that does not work?
Have updated and uploaded (see first post) the language file to include the core keywords. A couple of known issues that I don't know how to work around are...
Arduino IDE colours entire #define, #if etc. lines in same colour (brown) but I can only get the keyword to colour and the rest of the line colours according to word/number scheme.
Folding/unfolding does not work properly if the bracket symbol '}' is directly on end of text.
void loop(){
int x=y } //Folds properly
void loop(){
int x=y} //Does not fold properly
If I make {}, operators to cure problem of being directly on end of word then folding breaks altogether.
Graynomad:
I haven't tried but maybe Serial1/2/3 and other 3rd party calls like lcd.print()
Tricky one this, lcd is not a core keyword as it's derived from LiquidCrystal so could be called anything. I could add the .print etc keywords for standard libraries but obviously I cannot add all keywords for non standard libs.
Serial1/2/3 should be added in next few minutes. EDIT: Added
Surely, the best option would be to scan for, and parse, the existing keywords.txt files that the Arduino IDE uses for this purpose, and add the content to the XML file.
Right, I thought there may be an option to do say *.print, {word}.print $word.print or whatever. OTOH this is just a variable or object like any other and you can't highlight every variable.
I have added all I can find fro the standard Libraries but despite adding entries like (.rightToLeft) for LCD they don't highlight. I suspect the simple user language in Notepad++ is beyond the complex lexicon definition needed or it's beyond me.
I have updated the attachment in the top post to the current definition I have created. Baring bug fixes I don't think I can do much more.
I used to use Notepad++ for my Arduino programming so this should be a welcome addition when I return to coding for them.]I used to use Notepad++ for my Arduino programming so this should be a welcome addition when I return to coding for them.
I'm glad someone else may benefit from all this tinkering. I am surprised nobody else has done anything like this (that I could find) for NPP.
My latest thought is to download a portable version of NPP and add arduino keywords directly to the C++ language definition. As I don't otherwise program in C++ then I have no problem with potentially breaking the normal C++ setting but as it's the portable version it won't matter to me.
After several attempts to configure a Arduino bias user defined language for Notepad++ (NPP) I managed to get something close to what I wanted (all the core and standard library keywords) but some keywords would not highlight as expected and I put this down to limitations of the otherwise excellent NPP user language lexicon. I was going to give up at that but then had the idea of adding Arduino keywords to NPP's built in C++ lexicon. This does seem to work better but at the expense of confusing the C++ language for pure C++ programming. My final solution was to download a portable version of NPP and perform my Arduino C++ additions on this copy so I have a normal C++ version to fall back on if needed.
If your interested then download and extract a portable version of NPP via here Notepad++ Portable (development text editor) | PortableApps.com
Load it up, configure it to you liking and install any plugins you use.
Open Style Configurator (Settings->Style Configurator...)
Under 'Language' select 'C++' and then select 'INSTRUCTION WORD' under 'Style'. This should show two text boxes on the right called 'Default keywords' & 'User-defined keywords'.
Copy & paste the line below that begins 'abs acos' into the 'User-defined keywords' text box.
Under 'Style' select 'TYPE WORD' and copy & paste the below line beginning 'boolean byte' into the 'User-defined keywords' text box.
Under 'User ext.' type 'ino' (without the ' markers) into the box provided
Finally, click 'Save & Close' button and you should now have a portable Arduino bias C++ editor in NPP
INSTRUCTION WORDS
abs acos analogRead analogReference analogWrite asin atan atan2 attached attachInterrupt autoscroll available begin beginPacket beginTransmission BIN bitClear bitRead bitSet bitWrite blink ceil CHANGE clear close connect connected constrain cos createChar cursor DEC DEFAULT degrees delay delayMicroseconds detachInterrupt digitalRead digitalWrite direction display EEPROM endPacket endTransmission Ethernet EthernetClient EthernetServer exists exp EXTERNAL FALLING File FILE_READ FILE_WRITE floor flush HALF_PI HEX HIGH highByte home INPUT INPUT_PULLUP INTERNAL INTERNAL1V1 INTERNAL2V56 interrupts IPAddress isListening Keyboard leftToRight LiquidCrystal listen LOW lowByte LSBFIRST map max micros millis min mkdir Mouse MSBFIRST NewSoftSerial noAutoscroll noBlink noCursor noDisplay noInterrupts noTone OCT onReceive onRequest open OUTPUT overflow parsePacket peek pinMode position pow print println pulseIn radians randomSeed read readMicroseconds receive remoteIP remotePort remove requestFrom rightToLeft RISING rmdir round scrollDisplayLeft scrollDisplayRight SD seek send Serial Serial1 Serial2 Serial3 Servo setBitOrder setClockDivider setCursor setDataMode setSpeed shiftIn shiftOut sin size SoftwareSerial speed SPI SPI_CLOCK_DIV128 SPI_CLOCK_DIV16 SPI_CLOCK_DIV2 SPI_CLOCK_DIV32 SPI_CLOCK_DIV4 SPI_CLOCK_DIV64 SPI_CLOCK_DIV8 SPI_MODE0 SPI_MODE1 SPI_MODE2 SPI_MODE3 sqrt status step Stepper stop stream tan tone transfer TWO_PI version Wire write writeMicroseconds
Thanks Riva, this is a welcome addiiton for those of us that use NPP.
And the install was delightfully simple: after downloading the xml file linked in the first post, in NPP I opened the 'Defined Language dialog' (under the View menu option), clicked "Import" and navigated to the downloaded "userDefineLang.xml" file
Hi mem,
The most compleat intergration is to follow the instructions in post 13 but use the values in post 14 as could not get everthing working properly using the xml method. I would be better to start a new thread as this one is a bit confusing now but this will have to wait till I get home in a few days.
I would be interested to know why the xml approach is not working as you want. The NPP user-defined language seems easier for users to install and more flexible for those of use that want to switch between Arduino colouring and straight C++. Please do post a link if you start a new thread on this topic.