Autocomplete Bug


#1

Hello everybody,

I’m really sorry that my first post on this forum is a bug-report.
So basically, when I define multiple Variables at once, I put one “var” at the beginning and define the different variables after that, with every single one being placed in a new line, to make it look nicer.
It then looks something like that:
Unbenannt
But despite the fact, that this is legitimate Javascript-Code, the Autocomplete-Function doesn’t work properly anymore. Is there any reason, for why this is happening.

Sincerely,
Julian Kennerknecht

(Anyway, I still think Playcanvas is a really good engine, and I love working with it. Just wanted to point that out.)


#2

Hi,

The Code Editor looks for var scriptType = pc.createScript(scriptName) in a regex and tries to set the type of scriptType from that regex. So your code there basically causes the regex to not match causing that error.

Autocomplete in general works fine with regular javascript but for some of our types we have to give hints to the autocomplete engine as to what a type is in order for it to work and we kind of assume that scripts will stick to the format generated when one creates a script from the Editor.


#3

Yeah, I must say, I’ve never seen var declarations formatted quite like that before! :smile:


#4

Well. Then I will have to stick to the rules.:sweat_smile: