What's the best way to keep track of longer device/agent programs?


#1

I’m a beginner but my device/agent programs are getting longer and longer, and it’s difficult to keep track of them on the small windows shown by the IDE. But copying these programs to MS Word, for example, loses indentation and the color scheme of the IDE. Is there any better way to keep track of longer device/agent programs besides the IDE, or some way to make the IDE windows full screen, or some way to store them off line formatted for editing purposes? Thanks in advance for any suggestions.


#2

Have you tried collating your code into classes and tables? If so, you can use Alt-0 and Alt-Shift-0 to collapse and expand structures.


#3

I use notepad++

It’s a nice editor for scripting

https://notepad-plus-plus.org/

It can highlight opening and closing tags, parenthesis, brackets, if-statements, etc.

Squirrel is not one of languages on its list, but you can create your own custom one that has Squirrel’s syntax configured. It also numbers lines. That helps too.


#4

You could also try the fullscreen code editing mode. The button is in the top right-hand corner of the editor pane - I’ve attached a screenshot.


#5

I edit my device and agent code in an editor locally (I use vim, but alternatives exist) and then use the Build API(*) to push the code. This means that I can (a) keep my code in git, and (b) do some preprocessing in the same way as smittytone’s Squinter project. vim also has syntax colouring for Squirrel source files, which is useful.

(*) I lied; I actually use the internal API that the IDE currently uses, because the public Build API didn’t exist when I wrote my scripts; you should use the Build API – that’s what it’s for.


#6

Thanks for all comments. I will try to understand them as I go along.
coverdriven: Sorry, I do not understand your comment. Is there a further explanation somewhere of classes, tables, and what alt-0 does?
rogerlipscombe: I read the description of Build API but so far it is not clear to me how to actually use it on Windows 7. I will keep working on it.
I assume that there is no way to simply store the device/agent code directly to a disk file and then load it back after editing, although I suspect that is what Build API might do if I can figure out how to actually use it.
Thanks again for all comments.


#7

Check out this discussion : https://forums.electricimp.com/discussion/comment/17230/#Comment_17230


#8

One of the more advanced setups would be my project:

https://forums.electricimp.com/discussion/4093/wrench-preprocessor-and-build-tools-for-the-electric-imp-platform#latest

It lets you build libraries and include them in the main project. You can then upload to the cloud and log locally.


#9

And for Mac folks who prefer a GUI: https://forums.electricimp.com/discussion/2869/mac-users-squinter-utility-for-managing-device-agent-code-and-libraries#latest.


#10

I found a setup that works pretty well for me on Windows: I use Visual Studio with the Build API. I use VS “external tools” for imp log and imp push - the log shows in the output window, and have a button/hotkey for the push. I can also use a batch file for the push, which concatenates files before the push so that I can have source in multiple files (allowing me to share source between projects). I associate .nut files with javascript, which gets the syntax coloring close to what it should be. :slight_smile: