uliwitness / Stacksmith

An intuitive software erector kit targeted at people new to programming, but with enough potential to stay useful once they've learned, inspired by HyperCard.
http://stacksmith.org
131 stars 13 forks source link

Extend the syntax parsing/indenting code to give us a "context" for a certain offset. #84

Open uliwitness opened 8 years ago

uliwitness commented 8 years ago

This is mostly the code in LEODisplayInfoTableCreateForParseTree(). By being able to give a context, we could pre-fill autocompletions with sensible values depending on where your cursor is right now. It might also be good metadata to have when updating the display info while the user edits the text.

E.g. we could have contexts "toplevel" (completes to documentation comments, function definition, handler definition), "in-handler" (completes to commands, global declarations), "parameter" (completes to values and expressions).

In addition, we know what kind of object we are in, so we could filter out messages that don't make sense (like "stopMovie" only gets sent to a movie player and then passed up the message path to background, card, stack and project, so no use to offer that method in a field or button's script).