Autocomplete Bug 2

I used to be able to write any of my scripts name and get autocomplete of the script name and functions. Now, nothing autocompletes unless it is within the script I’m editing.

Hi @guzu,

Just checking: auto compete for other scripts will work only if those scripts are open in the current code editor instance.

Also auto complete seems to not be working if you are using ES6 classes.

@Leonidas
Nope. Script open, and no ES6 classes. Still doesn’t work.

Hmm, is it possible to share a project that reproduce the issue? Autocomplete intellisense in JS is quite complex to get right since everything is dynamic.

Playcanvas uses the tern server (https://ternjs.net/) to handle this, which does a great job but it can’t nail each and every case as in Typescript.

I think all my projects suddenly stopped working.

Maybe I’ll create another account to test in case my account is curropted for some reason.

1 Like

Nope. It is most likely broken.
Even creating a new account didn’t solve it.

Are you sure it works for you?
Try creating a script, for example:

  var Test=pc.createScript('test');

Now create another script

 Te //autocomplete fails to complete the "Test"

Hi @guzu,

If you implement an initialize() method to your test.js script, autocomplete from other files seems to be working just fine.

For example:

var Test = pc.createScript('test');

// initialize code called once per entity
Test.prototype.initialize = function() {
  
    Test.api = this;
};

And here is me accessing this property from another script:

image

Well, I have been struggling for few days. And now I kinda see how you can replicate it.

With the same test app you made, close the tab containing the editor. Then try opening the editor again. It should fail.

As a workaround, I go to the script I want to use and use auto-complete before I can use it.