# Disable Scripting Auto-Complete

**URL:** <https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [November 20, 2024, 9:49pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898 "2024-11-20T21:49:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 20, 2024, 9:49pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/1 "2024-11-20T21:49:38Z")

</div>

I have gotten very used to a specific process while I'm writing Python code. Namely, anytime I use characters that are used in pairs I'll just quickly add them both first and then add the content between then (i.e. { }, ( ), " ", ' ', etc.).

Recently there's been an update where I've noticed that the script will auto-complete these special characters and add the closing character for you, so often times I'll end up with {}} instead of {}.

There was also a feature added to auto-wrap strings in quotes if you highlight the string and press quote. This can be annoying at times as well.

Is there a way to disable this behavior?

---

<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:** [November 20, 2024, 10:50pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/2 "2024-11-20T22:50:51Z")

</div>

Basically no, although I'm sure @justinedwards.jle can cook something up.

To give a starting point, you'll need to find every `com.inductiveautomation.ignition.designer.gui.tools.PythonTextArea`,  
call its' `getTextArea()` method to retrieve the inner RSyntaxTextArea, then `setInsertPairedCharacters(false)`.

You might be able to do something fun with `com.inductiveautomation.ignition.designer.gui.tools.PythonTextArea.Companion.INSTANCE`, which should (somewhere in memory internally) have a list of open `PythonTextArea` instances, but it won't be super easy to get at.

In some future release I could add the ability to toggle this behavior to the right click 'options' menu you get, but it won't be for some time, and it's pretty low priority (unless more people are annoyed by it and just haven't said anything).

---

<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:** [November 20, 2024, 11:00pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/3 "2024-11-20T23:00:30Z")

</div>

> [@paul-griffith](#):
>
> more people are annoyed

I find it mildly annoying. FWIW.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [November 21, 2024, 1:09am UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/4 "2024-11-21T01:09:53Z")

</div>

I haven't experienced it as it must not be in the version I am using. I tend to do the same thing as @amarks, and would find it annoying until I just decided to get used to it.

---

<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:** [November 21, 2024, 1:20am UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/5 "2024-11-21T01:20:13Z")

</div>

It's kind of the default for any programming-oriented editor/IDE.

![vscode2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/da2f5b6fa45564d0d87b6ba7f0701d21952484c9.gif)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 21, 2024, 3:33am UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/6 "2024-11-21T03:33:21Z")

</div>

When I'm using a function like `system.gui.color`, I often ignore the auto complete and type my numbers in directly, so I end up with something like this: `system.gui.color(240, 240, 0 green, blue, alpha)`. Then, on the last character, I'll intuitively press shift + end to highlight the unwanted text ` red, green, blue)` expecting it to vanish when I type the last character `)`.

...but the unwanted text doesn't vanish. Instead, the closing parenthesis is not administered, and my cursor is simply kicked down to the next row leaving all of the unwanted text unaltered.

The other Ignition auto-complete related thing that trips up my flow are floats. I'll be typing a float and, when I hit the decimal key, the auto complete pops up and sometimes gets in the way.

I imagine these occurrences are the natural result of switching back and forth between development software. Similar things happen to me when I switch OS environments. For example, keyboard shortcuts sometimes don't do what I want them to do because I've somehow mixed up the cmd and ctrl keys 😡 🤣 🤣.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/3/6349fe139aeeed591a8e441e1896fda7af7bbbe4.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 21, 2024, 4:54am UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/7 "2024-11-21T04:54:31Z")

</div>

> [@paul-griffith](#):
>
> setInsertPairedCharacters

~~I couldn't find that attribute~~ , but I was able to disable the autocomplete for any open script editor by running this script in the script console:

```python
def getAllComponentsOfClass(container, className):
	foundComponents = []
	for component in container.components:
		if component. __class__. __name__ == className:
			foundComponents.append(component)
		else:
			foundComponents.extend(getAllComponentsOfClass(component, className))
	return foundComponents

from java.awt import Window
for window in Window.getWindows():
	scriptEditors = getAllComponentsOfClass(window, 'PythonTextArea$textArea$1')
	for editor in scriptEditors:
		for listener in editor.document.documentListeners:
			if listener. __class__. __name__ == 'AutoCompletion$AutoActivationListener':
				editor.document.removeDocumentListener(listener)

```

It simply removes the listener responsible for auto completion from all of the open script editors.

**Edit:** See update in [this post](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/11)

---

<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:** [November 21, 2024, 4:25pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/8 "2024-11-21T16:25:19Z")

</div>

> [@justinedwards.jle](#):
>
> I often ignore the auto complete and type my numbers in directly

You can just toggle parameter assistance off?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/f/bf5d1d79ebee79aebf8fc578bdfbc53da84ddd81.png)

If you do that once, it'll take effect on all open script editors and any new ones for the duration of that designer instance. Not as good as a persistent setting, but a lot easier to do 🤷

> [@justinedwards.jle](#):
>
> I'll be typing a float and, when I hit the decimal key, the auto complete pops up and sometimes gets in the way.

This one we're tracking as a bug, just low impact enough it hasn't gotten prioritized ☹

> [@justinedwards.jle](#):
>
> I couldn't find that attribute,

```python
for window in Window.getWindows():
	ptas = getAllComponentsOfClass(window, 'PythonTextArea')
	for pta in ptas:
		pta.textArea.insertPairedCharacters = False

```

---

<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:** [November 21, 2024, 4:29pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/9 "2024-11-21T16:29:10Z")

</div>

As a total aside, I'd recommend making your `getAllComponentsOfClass` function a generator, so you're not needlessly building up lists (unless you want to be) when doing these traversal operations:

```python
def getAllComponentsOfClass(container, className):
	for component in container.components:
		if component. __class__. __name__ == className:
			yield component
		else:
			for c in getAllComponentsOfClass(component, className):
				yield c

```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 21, 2024, 9:06pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/10 "2024-11-21T21:06:49Z")

</div>

> [@paul-griffith](#):
>
> You can just toggle parameter assistance off?

This is not something I would do. Overall, I actually like the auto complete, and I hope it gets developed further. Sometimes my flow gets tripped up when some little unexpected thing happens, but I was only contemplating it in this context because I was pinged in this post. As far as nuisances go, Ignition's auto complete is hardly a blip on my radar.

In any case, if somebody wanted to override some aspect of the auto complete behavior, or create their own, I imagine wrapping or replacing that document listener would be the simplest approach.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 21, 2024, 9:19pm UTC](https://forum.inductiveautomation.com/t/disable-scripting-auto-complete/98898/11 "2024-11-21T21:19:17Z")

</div>

~~[quote="PGriffith, post:8, topic:98898"]~~

~~ 

```python
for window in Window.getWindows():
	ptas = getAllComponentsOfClass(window, 'PythonTextArea')
	for pta in ptas:
		pta.textArea.insertPairedCharacters

```

 ~~

[/quote]

~~I actually did this per your instruction originally, and I couldn't find the attribute. The `pta.textarea` call doesn't retrieve a pure RSyntaxTextArea. It gets a PythonTextArea$textArea$1'. However, even when I approached it reflectively to get at the raw class, `.gerClass().getSuperclass().getSuperclass()`, in this case, I didn't see that attribute on the RSyntaxTextArea.~~

**Update:** After updating my test gateway to 8.1.44, I noticed an extra `'` get added whenever I would create a comment block using `'''`. I hadn't seen that behavior before, and I remembered this post. Running the test again, the attribute is there, so the fact that I couldn't find it was because I wasn't using the latest version.

Here is an updated version of the script based on the feedback above:

```python
from java.awt import Window
def getAllComponentsOfClass(container, className):
	for component in container.components:
		if component. __class__. __name__ == className:
			yield component
		else:
			for c in getAllComponentsOfClass(component, className):
				yield c

for window in Window.getWindows():
	if window.visible:
		scriptEditors = getAllComponentsOfClass(window, 'PythonTextArea$textArea$1')
# Use this for Perspective's advanced style sheet:
# scriptEditors = getAllComponentsOfClass(window, 'RSyntaxTextArea') 
		for editor in scriptEditors:
			editor.insertPairedCharacters = False

```

I've tested it and it works

One interesting observation I made while subsequently testing was in the Perspective style sheet—which is the only pure RSyntaxTextArea I'm aware of in Ignition. It does auto complete the `'` on the first press, but it deletes the auto completion if the apostrophe is pressed a second time, and the quadruple apostrophe doesn't occur, so perhaps the key to fixing the `PythonTextArea$textArea$1` nuisance duplications is in the style sheet's implementation.
