bscotch / stitch

Tools and apps for GameMaker development: a CLI for pipeline development, a VSCode extension for coding, and more.
Other
119 stars 13 forks source link

Improve autocompletes for keys in typed struct literals #120

Closed adam-coster closed 1 year ago

adam-coster commented 1 year ago

For cases where a user is writing a struct literal assigned to a variable of a particular struct type, the autocomplete list for struct members should pull from the type.

/// @type {Struct.MyType}
var literal = {
  // Triggering autocomplete here should list the keys in `Struct.MyType`
  someKey: "whatever",
  // Same deal here!
}

This could be solved in a similar way as how function signatures are managed: by identifying ranges in the document and their associated struct type, which can be checked upon autocomplete-request for a given document position.

The ranges would consist of the offsets: