Code completion for the engine in the playground

Heya, I was wondering if there’s any way we can get the code completion working for the engine in the JS playground to avoid having to look up its property and function names/spellings in the API doc?

The only way that I found that works so far is to create the engine manually and assign it to a global like in this PG.

But ideally it would work in the default and existing playgrounds as well. I tried editing the playground source in my local repo to pass engine and canvas to the createScene function but the playground editor still couldn’t autocomplete for them. So I guess the editor itself would have to be adapted to support that?? :thinking:

1 Like

cc @RaananW

My workaround is scene.getEngine() instead of engine :slight_smile:

2 Likes

This has been the case for quite some time now, and I do agree - it would be nice to have the engine get the right type. I also use seb’s workaround to make sure i get auto-complete working correctly.

I’ll try finding a workaround to set the engine’s type. The issue is the way the code is running - engine is not set by the monaco editor but by the playground code itself. this is the reason it doesn’t get the type.

1 Like

That’ll work :slight_smile:

[Playground] define engine and canvas as globals by RaananW · Pull Request #13278 · BabylonJS/Babylon.js (github.com)

Thanks for the suggestion