#333 Fansh with completion and a native example

cgrinds Wed 13 Aug 2008

I wanted to play around with adding native code to Fan. To do so, I choose to add simple completion to fansh. For example:

a := [,]
a.TAB

will present you with:

add               addAll            all               any
binarySearch      capacity          clear             compare
contains          containsAll       containsAllSame   containsSame
dup               each              eachr             equals
exclude           find              findAll           findIndex
findType          first             get               hash
index             indexSame         insert            insertAll
intersection      isEmpty           isImmutable       isRO
isRW              join              last              make
makeObj           map               max               min
of                peek              pop               push
reduce            remove            removeAt          removeSame
reverse           ro                rw                set
size              slice             sort              sortr
swap              toImmutable       toStr             trap
trim              type              union             unique

while

a.ad TAB will present you with:
add      addAll

Currently I "complete" on defined scopes, types, and simple expressions like the ones shown above.

If you're interested in trying it:

  1. Grab fansh.pod and replace your FAN_HOME/lib/fan/fansh.pod
  2. Grab jline.jar and drop it in your FAN_HOME/lib/java/ext dir

brian Thu 14 Aug 2008

That sounds really cool! I'm head deep in some stuff right now, but I'll check out soon. Funny I was just thinking about that problem the other day when considering how I was going to embed fansh into flux (I think for that problem I'm going to use the normal syntax coloring editor I've developed on top of StyledText).

So you must have figured out some of the native stuff without any docs and just looking at code then? That stuff is pretty tricky, so hopefully it wasn't too painful.

cgrinds Thu 14 Aug 2008

Yes I figured out the native stuff by reading code. The biggest challenge was getting bootstrap builds to work, once I got that figured out I didn't have any trouble.

Login or Signup to reply.