vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

Code Completion and Reflection Challenge #191

Closed cawoodm closed 11 years ago

cawoodm commented 11 years ago

CraftyJS (http://craftyjs.com/release/0.5.3/crafty.js) looks to be well-structured and annotated. Nevertheless Scripted doesn't seem to pick up the method signatures.

Crafty.spr then Ctrl+Space doesn't fetch the sprite() method

crafty

It's quite weird what it does fetch and again it seems to sort the members in a case-sensitive way (I though that was fixed).

    /**@
    * #Crafty.sprite
    * @category Graphics
    * @sign public this Crafty.sprite([Number tile], String url, Object map[, Number paddingX[, Number paddingY]])
    * @param tile - Tile size of the sprite map, defaults to 1
    * @param url - URL of the sprite image
    * @param map - Object where the key is what becomes a new component and the value points to a position on the sprite map
    * @param paddingX - Horizontal space in between tiles. Defaults to 0.
    * @param paddingY - Vertical space in between tiles. Defaults to paddingX.
    * Generates components based on positions in a sprite image to be applied to entities.
    *
    * Accepts a tile size, URL and map for the name of the sprite and it's position.
    *
    * The position must be an array containing the position of the sprite where index `0`
    * is the `x` position, `1` is the `y` position and optionally `2` is the width and `3`
    * is the height. If the sprite map has padding, pass the values for the `x` padding
    * or `y` padding. If they are the same, just add one value.
    *
    * If the sprite image has no consistent tile size, `1` or no argument need be
    * passed for tile size.
    *
    * Entities that add the generated components are also given a component called `Sprite`.
    * 
    * @see Sprite
    */
    sprite: function (tile, tileh, url, map, paddingX, paddingY) {
aeisenberg commented 11 years ago

After a very brief look, there are a few things going on here:

  1. most of the jsdoc comments in crafty are malforned, Currently, we only support a strict interpretation of Closure compiler jsdoc. See here: https://developers.google.com/closure/compiler/docs/js-for-compiler. I'd like to make this more flexible and error tolerant, but that is just one of the many things we need to work on.
  2. Crafty makes use of a custom extend function as a form of mixins. This is not something we recognize (and I'm not sure how we could recognize this in a generalizable way).

So, I don't see any bugs here, only things that haven't been implemented yet (or are difficult to implement), even though it may not seem that way from a user's perspective.

cawoodm commented 11 years ago

OK, I think I'm gonna invest some time in re-writing the library to suit scripted. I so want to be able to do this: http://vimeo.com/36579366 (see esp 6:00)

or

http://livecoding.io/3419309