Hi,
I am Bach Le from National University of Singapore. I have been programming in Erlang for 1-2 years and it has replaced C++ as my favourite language (serious). Aside from closed projects, I have several open-source Erlang projects which can be found at:
https://github.com/bullno1?tab=repositories. I have also contributed to some open source Erlang projects such as locks, cowboy and epgsql.
I do most of my Erlang development using vim and vimerl. One of the problem I frequently face is recalling the precise type of an argument or the fine implications of arguments. I feel that better code completion and documentation browsing is important to help Erlang reach a wider audience and make programmers more productive. Erlang currently has edoc which generates HTML documents, however it has the following limitation:
- Searching is not good enough
- No interface for integration into other programs such as text editors
I would like to propose an Erlang application called edoc_server which does the following:
- It uses the edoc application to generate documents, indexes and store them in a cache
- It exposes searching, browsing through a HTTP interface using cowboy. Both HTML for human consumption and JSON/XML for machine consumption will be supported.
- Incremental search is supported
The documents can be accessed in several ways:
- For learning a new library/browsing for functionalities, an user can start edoc_server in daemon mode and use his web browser to browse the document similar to the current edoc or OTP document system. However, he can quickly search for a module/application/function using an incremental search box similar to erldocs.com
- When an user is working on his code, he can quickly reference the document with a terminal tool for example, the command: edoc_search gproc:reg/2 will prints the document for gproc:regs/2 with all parameters, results and success types.
- When an user is debugging/testing his application from the Erlang shell, if edoc_server is in the code path, he can call edoc_search:get_doc from the shell similar to the terminal variant.
- Finally, for a text editor, it can connect to a running edoc_server through the REST interface to support code completion and documentation hover tooltip. The incremental search interface will help to provide low latency reply.
Currently, I think the most challenging aspect is to implement a fast enough search implementation. However, since the amount of data is very small as compared to memory of a modern computer an average developer uses. I believe it is possible to keep everything in memory and only cache to disk to avoid having to scan through source codes every time edoc_server is started.