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.
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.
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:
{
to the first identifier