Ignition script editor, it kinda sucks

scripting
#1

I’ve been learning to use ignition for the last few months. The Designer is honestly pretty good. It’s flexible, so flexible that you could possibly make programmes that aren’t just about SCADA and such.
However one of my biggest pet peeves in using the Designer has been the script editor.

The script editor lacks so many basic features most other programming focused editors have. Automatic construction of commonly used multi line functions like loops, collapsing groups of code and my personal worst, no indentation lines.
Especially since (P/J)ython relies on indentation to order it’s code. The amount of times I couldn’t tell what was going wrong simply because my indents were wrong is staggering.

I’m wondering what you all think about this? Are there some simple solutions I’m not aware of maybe? Or do we all just silently struggle?

1 Like

#2

Pretty much. Particularly for event scripts, and for troubleshooting.

I tend to do bulk editing of script modules in Kate with a compatible modeline, then paste the whole thing into Ignition. Pasting the whole thing avoids the garbled indentation from selective pasting. /:

1 Like

#3

Fair enough. I’m personally not very familiar with most of the Ignition specific functions yet, so I have been making use of the script editor for those few helpful Ignition specific features it does have.

I did find an interesting thread about someone who had made a library of mock system functions however. Ignition mock scripts on GitHub

Still, it’d be perfect if you were somehow able to make use of you editor of choice in the Designer itself.

0 Likes

#4

Tough to do that in a cross-platform way, at least from Java. Someday, far in the future, browser technologies will cover all the bases, even for the designer. Ten years, perhaps, kinda like fusion power… /:

2 Likes

#5

Once we are used to IDE’s with features like intellisense etc. we feel handicapped without them. However its too much to expect Ignition script editor to be an IDE! What is supported itself is unprecedented ! No other SCADA supports scripting! This in my opinion is the best feature of Ignition that makes it flexible and extendable. Imagine days when we used to write code using plain text editors like ed and vi!

However I think some basic features of editor like search/replace should be supported. It will make life a lot easier for a developer.

1 Like

#6

Fair enough.
I’d personally be satisfied with two things: Indentations lines and collapsible groups of code.

Just having these two features would be so nice both during writing and when looking back at already written code. It would allow me to declutter event scripts and make it a lot easier to handel indentation.

0 Likes

#7

Agreed, I think some of these are already in pipeline in Ignition’s road-map when I wrote to them on this topic last time.

However I think the script code is not going to be huge, running into 1000’s of lines! You can achieve so much with small scripts due to power of python and the rich set of library of well thought out functions supported by Ignition. So guess its manageable without advanced features like collapsible grouping of code etc. That’s just my view, but of course more the features the merrier it is for a developer.

1 Like

#8

Blockquote
…collapsible groups of code.

You can collapse a code block by highlighting it and doing a CTRL + >

Another favorite to get previous clipboard items:
CTRL + Shift + V

0 Likes

#9

Consider commenting/voting here: https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/script-editor-improvments.

Also see this one: https://inductiveautomation.canny.io/ignition-features-and-ideas/p/break-points-and-a-good-debugger. @KathyApplebaum, am I reading your last Sep. 20 comment on this one correctly as suggesting we will be able to use our editor of choice for scripts soon?

0 Likes

#10

What she means is now that many of the script resources are saved to the filesystem in .py files you can open and edit them with whatever editor you’d like (assuming you’re on the gateway machine). You can save changes to the file on the filesystem and they will be picked up by Ignition.

4 Likes

#11

Thanks @Kevin.Herron. Would it make sense to have a setting somewhere to set path to desired script editor and then have right-click->Scripting as well as library scripts open with that editor?

0 Likes

#12

I don’t really mind it to be honest. It’d be cool if there was a way to link up Ignition with VS Code somehow but I have no idea if that’s even feasible.

0 Likes

#13

Working with external editors would basically require the designer writing resources you’re editing to disk, which would be a change to resource editing similar in scale with the changes to resource storage on the gateway that happened in 8.0. It’s possible, and something we have looked into, but it’s also definitely not a trivial change to make.

4 Likes

#14

You’re right, I had no idea.
However, after being collapsed they aren’t retained in their collapsed state after closing the editor and there’s no way to distinguish different collapsed groups of code.

that being said, it’s better than nothing.

0 Likes

#15

Maybe someday in the future then?

I don’t know much about how Ignition was built, so I don’t know if these features would be harder to implenent than making it possible to work with external editors.

0 Likes