editor icon indicating copy to clipboard operation
editor copied to clipboard

Import statement autocompletions for gametest

Open Xterionix opened this issue 2 years ago • 1 comments

Summary Autocompletions are unavailable when trying to import anything from the gametest modules

To Reproduce Steps to reproduce the behavior:

  1. Create a new bridge project with gametest enabled
  2. Click on the main.js file
  3. Type world or any of the other objects from gametest
  4. Control+Space

Observed behavior world doesn't show in the autocompletions Expected behavior The autocompletions should show world as a suggestion and using tab should auto-import it

Screenshots / File Attachments image

Platform

Windows 11 - Edge v2.3.1

Xterionix avatar Aug 19 '22 10:08 Xterionix

I've looked into this and Monaco apparently doesn't support this yet. I am not sure whether/when we will find the time to implement this ourselves so here's some information in case someone else wants to pick this up:

Generally there are two things we need to do:

  1. Finding all exported symbols from a module and then proposing them with a completion item provider
  2. Upon selecting a completion item, parse imports within the file and merge the new imported symbol into an existing import or add a new import statement

You can find a reference implementation for an older monaco version here: https://github.com/stackblitz/monaco-auto-import/tree/master/src/auto-complete

solvedDev avatar Dec 07 '22 12:12 solvedDev