Author Topic: Arduino .ino files  (Read 223 times)

StephenW

  • Senior Community Member
  • Posts: 189
  • Hero Points: 21
Arduino .ino files
« on: April 01, 2019, 05:39:19 am »
I am doing my first Arduino project, and I have run into a problem with the .ino files that Arduino uses.  These are "sketch" files supported by their IDE and toolchain, but they are actually just C++ files.  I prefer to use SlickEdit, rather than their IDE, so I added *.ino to the settings for what files are C/C++ files, and that mostly worked.  But there is still one place that *.ino is not working.  When I build my project and there are compile errors, the error messages produced by the GCC compiler only give the file name, without extension.  And SlickEdit then tries to find a matching *.c or *.cpp or similar file to match that name.  It does not look for an *.ino file, and I have not found any way to change how that works.  Is there some configuration option I have not found, or do I need to start digging through the macro source to see if I can fix it there?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4638
  • Hero Points: 371
Re: Arduino .ino files
« Reply #1 on: April 08, 2019, 07:10:52 pm »
Do these error messages ever contain a file extension?

If these error message can be uniquely identified (differentiated from others), please post a sample. Maybe a new error parsing regex could be added to your configuration.

I don't think SlickEdit has a list of extensions it attempts to append to error message filenames that are missing an extension but I could be wrong.

StephenW

  • Senior Community Member
  • Posts: 189
  • Hero Points: 21
Re: Arduino .ino files
« Reply #2 on: April 09, 2019, 08:30:31 am »
I have learnt a bit more about how the Arduino tools work.  It seems there is a preprocessor pass that creates a temporary file with the .ino.cpp extension, from the .ino file.  The .ino.cpp file has appropriate #line preprocessor lines added to it so that it retains the correct line number information from the .ino file.  Errors and warnings in other files (library .cpp files, or .h files for example) get the file extension in the error message and SlickEdit finds the correct file.  It seems to be only errors in the .ino file that do not get a file extension.  I have attached the output of a recent build that has an example of both.  SlickEdit pops up a window asking where to find the correct file for errors in the .ino file, but it does not allow me to tell it the correct file name, just the directory to look in.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4638
  • Hero Points: 371
Re: Arduino .ino files
« Reply #3 on: April 09, 2019, 12:41:25 pm »
Somebody messed up this tool.

Changing the error parsing regex isn't a great solution due to ambiguities. A list of extensions to try if the filename has no extension is best.

Here's a work around but you'll need v23.0.1

Load the attached macro  with Macro>Load Module...

Set the macro variable "def_next_error_try_ext_list" to ".ino".  Macro>Set Macro Variable...

This should do the trick.

StephenW

  • Senior Community Member
  • Posts: 189
  • Hero Points: 21
Re: Arduino .ino files
« Reply #4 on: April 10, 2019, 04:52:26 am »
Thank you, that is much better.  The next error function is working!  But it looks like there is somewhere else that needs the same fix.  When I double click on an error line applying to the .ino file, I still get the popup window asking where to find it.  And the little red X icons on the left of the main window for the errors lines are not appearing in the .ino file - they actually appear at the end of other files.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4638
  • Hero Points: 371
Re: Arduino .ino files
« Reply #5 on: April 10, 2019, 12:23:16 pm »
I’ll see if that can be tweaked too.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4638
  • Hero Points: 371
Re: Arduino .ino files
« Reply #6 on: April 10, 2019, 01:32:25 pm »
These changes should handle the other cases.

Just load this new version of the module. You should need to set the macro variable again.

StephenW

  • Senior Community Member
  • Posts: 189
  • Hero Points: 21
Re: Arduino .ino files
« Reply #7 on: April 10, 2019, 02:44:20 pm »
Many thanks, the error message handling is all working nicely now.