# Ignition script editor, it kinda sucks

**URL:** <https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313>\
**Category:** General Discussion\
**Tags:** scripting\
**Created:** [October 23, 2019, 11:46am UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313 "2019-10-23T11:46:14Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![RadicalRumin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/radicalrumin/32/11543_2.png) [@RadicalRumin](https://forum.inductiveautomation.com/u/RadicalRumin)\
**Post date:** [October 23, 2019, 11:46am UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/1 "2019-10-23T11:46:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 23, 2019, 12:15pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/2 "2019-10-23T12:15:28Z")

</div>

> [@RadicalRumin](#):
>
> Or do we all just silently struggle?

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. /:

---

<div class="post-metadata">

**Author:** ![RadicalRumin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/radicalrumin/32/11543_2.png) [@RadicalRumin](https://forum.inductiveautomation.com/u/RadicalRumin)\
**Post date:** [October 23, 2019, 12:20pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/3 "2019-10-23T12:20:58Z")

</div>

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](http://forum.inductiveautomation.com/t/ignition-mock-scripts-on-github/16468)

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 23, 2019, 1:04pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/4 "2019-10-23T13:04:10Z")

</div>

> [@RadicalRumin](#):
>
> Still, it’d be perfect if you were someone able to make use of you editor of choice in the Designer itself.

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.... /:

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 23, 2019, 1:31pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/5 "2019-10-23T13:31:12Z")

</div>

> [@RadicalRumin](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![RadicalRumin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/radicalrumin/32/11543_2.png) [@RadicalRumin](https://forum.inductiveautomation.com/u/RadicalRumin)\
**Post date:** [October 23, 2019, 1:35pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/6 "2019-10-23T13:35:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 23, 2019, 1:43pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/7 "2019-10-23T13:43:54Z")

</div>

> [@RadicalRumin](#):
>
> I’d personally be satisfied with two things: Indentations lines and collapsible groups of code.

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.

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [October 23, 2019, 7:34pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/8 "2019-10-23T19:34:41Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [October 23, 2019, 9:55pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/9 "2019-10-23T21:55:59Z")

</div>

Consider commenting/voting here: [https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/script-editor-improvments](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](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?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 23, 2019, 9:58pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/10 "2019-10-23T21:58:06Z")

</div>

> [@witman](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [October 23, 2019, 10:25pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/11 "2019-10-23T22:25:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![SillyBear](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sillybear/32/9290_2.png) [@SillyBear](https://forum.inductiveautomation.com/u/SillyBear)\
**Post date:** [October 24, 2019, 8:31pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/12 "2019-10-24T20:31:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 24, 2019, 8:41pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/13 "2019-10-24T20:41:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RadicalRumin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/radicalrumin/32/11543_2.png) [@RadicalRumin](https://forum.inductiveautomation.com/u/RadicalRumin)\
**Post date:** [October 25, 2019, 6:42am UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/14 "2019-10-25T06:42:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RadicalRumin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/radicalrumin/32/11543_2.png) [@RadicalRumin](https://forum.inductiveautomation.com/u/RadicalRumin)\
**Post date:** [October 25, 2019, 6:45am UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/15 "2019-10-25T06:45:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![filipg](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@filipg](https://forum.inductiveautomation.com/u/filipg)\
**Post date:** [March 18, 2020, 5:05pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/16 "2020-03-18T17:05:18Z")

</div>

Thank you [pturmel](http://forum.inductiveautomation.com/u/pturmel) for reference to Kate - it’s superior to notepad++ for scripts, which I have already been using.

I like how Kate subtly shows embedded tabs. I just spent 2 days debugging a copy of proven code ruined by auto-indents-from-hell (AIFH). Now to install it on all the machines I use…

If someone is stuck with built-in script editor, my “work-around” has been to add additional comment lines for key keywords that used the left-margin as a hard reference - that made correcting AIFH give reliable (more) results. Example:

```auto
####################else
 					else:
 					 	logger.info( "AOV304_Opened value = 0 but poor sum (for average) quality")
################except:
 				except:
 					logger.info("AOV304_Opened initial = 0, value = 1, begin = %s vs end = %s which FAILED TO SUBTRACT" % (time_now,startedTAG.value) )
 					# From http://www.perfectabstractions.com/blog/debugging-and-testing-gateway-event-scripts
 					import sys
 					from java.lang import Exception
 					exceptionType, exception, stacktrace = sys.exc_info()
 					if exceptionType == Exception:
 						exception = exception.getCause()
 					exceptionName = exception. __class__. __name__
 					logger.error(exceptionName+" : "+str(exception))
############else
 			else:
 				logger.info( "AOV304_Opened value = 0 but poor started quality")
########else			
 		else:
 			logger.info( "AOV304_Opened initial = 0 but unrecognized newValue.value (newValue = %s" % (newValue) )

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 18, 2020, 5:40pm UTC](https://forum.inductiveautomation.com/t/ignition-script-editor-it-kinda-sucks/29313/17 "2020-03-18T17:40:25Z")

</div>

> [@filipg](#):
>
> Now to install it on all the machines I use…

No install required if you run Kubuntu or other KDE-flavored Linux (:
