rbeckman-nextgen / test-mc

test-migration
1 stars 0 forks source link

Add the ability to auto-complete code in the JavaScript editor #3519

Closed rbeckman-nextgen closed 4 years ago

rbeckman-nextgen commented 4 years ago

It would be amazing if you could start typing something like a function/class name, and have the editor show a list of possible options. Or press "." after a variable, and have it show a list of possible methods.

Imported Issue. Original Details: Reporter: narupley Created: 2015-01-22T12:40:40.000-0800

rbeckman-nextgen commented 4 years ago

Done:

!RSTA Autocomplete 1.gif!

Everything in our userutil packages is being automatically parsed and converted into auto-complete references. All of our current code templates are in the list too, as well as any user-defined code templates. There are also standard JavaScript variables / functions / code blocks built-in, and it will parse your current document and add things like function names and in-scope variables to the list as well.

Imported Comment. Original Details: Author: narupley Created: 2015-01-28T15:42:56.000-0800

rbeckman-nextgen commented 4 years ago

It would be great if through the settings panel the user could specify whether auto activation occurs when any letter is typed or by pressing the trigger key. They could even specify a delay time too:

http://javadoc.fifesoft.com/autocomplete/org/fife/ui/autocomplete/CompletionProviderBase.html#setAutoActivationRules(boolean, java.lang.String) http://javadoc.fifesoft.com/autocomplete/org/fife/ui/autocomplete/AutoCompletion.html#setAutoActivationDelay(int)

Imported Comment. Original Details: Author: brentm Created: 2015-01-28T17:01:00.000-0800

rbeckman-nextgen commented 4 years ago

I'm just wondering, what's a use-case where you would want to change this? Having the editor open the auto-complete popup whenever you type any letter sounds like it might get annoying. Regarding the delay, right now the default is 300 ms I think, so it's basically almost instantly. Is there ever a case where you would want it to wait a bit before opening?

Talking specifically about the JavaScript code editor of course... I mean for a text field that auto-completes a list of tags for example, I think the "letters" parameter makes sense.

Imported Comment. Original Details: Author: narupley Created: 2015-01-28T18:28:05.000-0800

rbeckman-nextgen commented 4 years ago

I think the use case is that some users may prefer that autocomplete behave that way. For some people, it may be annoying that it pops up whenever you start typing, but for others it may be equally annoying to have to type ctrl-space every time you want to see what completions are available. I would guess that there are enough users with that preference to warrant making it configurable.

The case for the delay would be if they do enable auto-activation on letters, they may not want it to pop up immediately after a letter is typed, maybe only if they pause typing for 1000ms or so because they're having trouble remembering a class name or something. This would be similar to Eclipse's content assist settings.

Imported Comment. Original Details: Author: brentm Created: 2015-01-29T10:31:36.000-0800

rbeckman-nextgen commented 4 years ago

Understood, makes sense. On the Administrator settings, I could put a line for the letters option (radio buttons Yes/No), and a line for the "others" option (text field). It would default to No, and "." (period). Also a line for the delay time.

Imported Comment. Original Details: Author: narupley Created: 2015-01-29T10:37:07.000-0800

rbeckman-nextgen commented 4 years ago

Sounds good to me.

Imported Comment. Original Details: Author: brentm Created: 2015-01-29T10:39:49.000-0800

rbeckman-nextgen commented 4 years ago

Revision 7569: Added three new components to the code editor panel in the Administrator settings view. A field for the auto-completion activation characters, a check box to include letters, and a field for the activation delay. Added a properties class for the auto-completion settings, and had them stored as a user OS preference like the other RSTA settings.

Imported Comment. Original Details: Author: narupley Created: 2015-02-01T09:53:03.000-0800

rbeckman-nextgen commented 4 years ago

Verified the functionality across multiple OSes. Tested out various delays as well as different Auto-Complete Characters, including letters.

My only comment here is having the ability to change Auto-Complete Characters. I can't think up a scenario when anyone would possibly want to auto-complete on a particular character, for example a comma (maybe a paren makes sense though). If we're going to go this route, maybe it would make sense to limit this to a set of certain characters.

Also, as it stands, that field can take in a large number of characters. I didn't count the actual total but was able to input at least the whole of the alphabet and all numbers with room for more. Maybe we want to limit this field as well to certain number of characters.

Imported Comment. Original Details: Author: jaysenp Created: 2015-02-02T15:41:22.000-0800

rbeckman-nextgen commented 4 years ago

Well, a user may want to not necessarily auto-complete on all letters (via the checkbox), but only on a select few letters. Like if they use the connectorMessage object a lot, they may add "c" to the list. We could add a limit if we wanted, but I'm not sure it's necessary. If the user really wants to include all the letters except a specific one, and numbers too, then that's their prerogative.

Imported Comment. Original Details: Author: narupley Created: 2015-02-03T08:29:50.000-0800

rbeckman-nextgen commented 4 years ago

Understood. At the very least then, it might be worthwhile to allow this field to grow to meet the number of characters entered. I know this is probably a little nit-picky but the entirety of the text is not shown if outside the default component's bounds. I can easily copy paste the text into an editor, or elsewhere, to view the text as a workaround.

Imported Comment. Original Details: Author: jaysenp Created: 2015-02-03T10:38:50.000-0800

rbeckman-nextgen commented 4 years ago

That's also true of pretty much every other text field in the application though. We sometimes have combo boxes auto-resize themselves because they hold finite sets of pre-determined values. But I don't think there's any place where we allow text fields to be auto-resized.

Imported Comment. Original Details: Author: narupley Created: 2015-02-04T07:26:24.000-0800

rbeckman-nextgen commented 4 years ago

Ah okay. I figured that there was already a precedence set for this on the settings panel. It could be that this is a bug instead. See attached file.

Imported Comment. Original Details: Author: jaysenp Created: 2015-02-04T09:31:50.000-0800

rbeckman-nextgen commented 4 years ago

As far as I know that's a bug haha.

Imported Comment. Original Details: Author: narupley Created: 2015-02-04T10:28:39.000-0800

rbeckman-nextgen commented 4 years ago

Auto completion, activation characters and delay were all tested and verified to work.

Imported Comment. Original Details: Author: jaysenp Created: 2015-02-04T10:39:03.000-0800