# Code completion for the engine in the playground

**URL:** <https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525>\
**Category:** Feature requests\
**Created:** [November 8, 2022, 9:55pm UTC](https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525 "2022-11-08T21:55:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [November 8, 2022, 9:55pm UTC](https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525/1 "2022-11-08T21:55:23Z")

</div>

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](https://playground.babylonjs.com/#XUVYT0).

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?? 🤔

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 8, 2022, 11:21pm UTC](https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525/2 "2022-11-08T23:21:18Z")

</div>

cc @RaananW

My workaround is scene.getEngine() instead of engine 🙂

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 9, 2022, 10:42am UTC](https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525/3 "2022-11-09T10:42:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 9, 2022, 10:43am UTC](https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525/4 "2022-11-09T10:43:05Z")

</div>



---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 23, 2022, 2:57pm UTC](https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525/5 "2022-11-23T14:57:25Z")

</div>

That’ll work 🙂

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

Thanks for the suggestion

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 23, 2022, 2:57pm UTC](https://forum.babylonjs.com/t/code-completion-for-the-engine-in-the-playground/35525/6 "2022-11-23T14:57:28Z")

</div>


