New Plugin - Roact Complete (Code Completions)

I made a plugin with the brand new Script Editor API Beta Feature to handle Roact code completions. Note that you will have to manually enable the beta feature first for the plugin to work!

Things it completes

  • Static members of the Roact library

    image

  • Code snippets for filling in lifecycle methods:

    image

    image

  • Understands private fields:

    image

  • Understands props / state fields:

    image

  • Fills in Instance types in createElement:

    image

  • Knows Instance and Component props in createElement bodies:

    image

  • Can auto-fill all props for convinience:

    image

    image

Enjoy, and let me know if I missed anything you had hoped for!

69 Likes

This is amazing! It was very annoying to deal with huge stack traces trying to understand what you did wrong… then it turned out to be simply a typo. Definitely something every Roact user should have installed.

Just a bit confused on how to enable the new autocomplete API. I have ‘Script Editor API’ beta enabled and even ‘AutocompleteAPI’ flag forced on, still getting relevant errors.

3 Likes

What error, post the stack trace?

3 Likes

As I said, its related to the autocomplete APIs missing, and I cannot to get them to work. ‘AutocompletionItemKind is not a valid member of Enum’ is the error I’m getting. You don’t need to worry about this as it’s not your fault, just cleared up a misunderstanding.

Amazing!

I didn’t know it was possible to make custom-autocompletes with the Script Editor API.

Well done.

Sounds like you’re running a significantly out of date copy of Studio. Have you updated recently? These APIs are hot off the press so if you last updated a couple weeks ago you may not have them.

It wasn’t possible until literally a few weeks ago, so you’re not out of the loop!

Loving the plugin, however there appears to be an error when using the command bar:

Ah, I totally forgot about that case, I’ll get a fix in tonight!

1 Like

really cool, does this support roactrodux, rodux and roactspring too?

HOLY THATS GOOD, THANK YOU SO MUCH MAN GOOD JOB!s

i noticed when you use a different variable name than the name you supplied to extend, the autocomplete doesnt work. theres no support for setState method auto complete as well. Context’s dont auto complete Provider/Consumer and the render callback and value property doesnt get detected in the property field. with portals they dont support auto complete for the target property.

Hey, i have an issue with he autocomplete, how did you get it to replace the current line you are typing with the new code. Using RegisterAutocompleteCallback does not replace the current line, it just makes a new one ontop.

The key is looking at the already typed text. The autocomplete callback will not make any assumption about what already typed text to replace.

E.g. If the user has typed “works” your completion has to be adding “pace”, not adding “workspace”.

It looks like this doesn’t support doing local e = Roact.createElement. No autocompletes are available when making elements with e.

Could support for this be added?