Thursday, December 13, 2007

Erlang TextMate integration - Documentation lookup

I have made some progress with ErlyMate, my pet project for adding first class Erlang support to TextMate. Based on a new architecture with an Erlang background server (starts and stops together with TextMate, wrote a Cocoa plugin for that) I implemented a very first and highly experimental approach of edoc lookup. More technical details can be found at the googlecode project page.

And here a screencast to show you how it looks and feels like (requires latest flashplayer, and asks you to upgrade to it, if you don't have it, because video is h264/HE-AAC encoded):



To view the ErlyMate screencast:




Get Adobe Flash player





2 comments:

Alain O'Dea said...

I really like the idea of ErlyMate. I have been digging into Erlang since I bought Joe Armstrong's new book back in July. TextMate has been my tool of choice on this. Java programming pays my mortgage and I am tired of the bloated IDEs it necessitates. I am really looking forward to trying ErlyMate and would gladly help with beta testing it.

Alain O'Dea said...

I have written Variable-completion for Erlang in TextMate using Erlang to generate the PList for tm_dialog.

erl_complete.erl:
-module(erlang_complete).
-export([complete/0]).

complete() ->
    io:format("{menuItems = ("),
    lists:map(
        fun(Item) ->
            io:format("{title = ~s;},", [Item])
        end,
        sets:to_list(
            sets:from_list(
                collect(io:get_line(''))))
        ),
    io:format(");}").

collect(eof) ->
    [];
collect(Line) ->
    matches(Line, collect(io:get_line(''))).

matches(Line, MatchesIn) ->
    {match, MatchIndices} = regexp:matches(Line, "[A-Z][a-zA-Z0-9_@]*"),
    lists:foldl(
        fun({Start, Length}, Matches) ->
            [string:substr(Line, Start, Length)|Matches]
        end,
        MatchesIn, MatchIndices).



It is very slow due to the Erlang VM startup overhead. I would like to integrate this functionality into erlymate so I can take advantage of the background Erlang server.

Unfortunately, I have not figured out how to get erlymate running yet.