erlide_eclipse
erlide_eclipse copied to clipboard
Generate documentation for function, data structure
I couldn't find the way to generate documentation for function with nightly erlide. So I think erlide will be better if when we select a function then generate doc for it by clicking context menu or hitting short-cut key. The generated doc should be simple and defined as template that we can configure later.
For example (from: http://www.erlang.se/doc/programming_rules.shtml#REF20875),
Function doc:
%%----------------------------------------------------------------------
%% Function: get_server_statistics/2
%% Purpose: Get various information from a process.
%% Args: Option is normal|all.
%% Returns: A list of {Key, Value}
%% or {error, Reason} (if the process is dead)
%%----------------------------------------------------------------------
get_server_statistics(Option, Pid) when pid(Pid) ->
......
Data structures doc:
%%---------------------------------------------------------------------
%% Data Type: person
%% where:
%% name: A string (default is undefined).
%% age: An integer (default is undefined).
%% phone: A list of integers (default is []).
%% dict: A dictionary containing various information about the person.
%% A {Key, Value} list (default is the empty list).
%%----------------------------------------------------------------------
-record(person, {name, age, phone = [], dict = []}).
I think this feature is very helpful, at least for me :) I think you can also create a context menu to create erlang header file, I have to create file with extension "*.hrl" and it's boring job.
I hope my suggestions are positive.
+1
---- theking-laptop skrev ----
I couldn't find the way to generate documentation for function with nightly erlide. So I think erlide will be better if when we select a function then generate doc for it by clicking context menu or hitting short-cut key. The generated doc should be simple and defined as template that we can configure later.
For example, Function doc:
%%---------------------------------------------------------------------- %% Function: get_server_statistics/2 %% Purpose: Get various information from a process. %% Args: Option is normal|all. %% Returns: A list of {Key, Value} %% or {error, Reason} (if the process is dead) %%---------------------------------------------------------------------- get_server_statistics(Option, Pid) when pid(Pid) -> ......
Data structures doc:
%%--------------------------------------------------------------------- %% Data Type: person %% where: %% name: A string (default is undefined). %% age: An integer (default is undefined). %% phone: A list of integers (default is []). %% dict: A dictionary containing various information about the person. %% A {Key, Value} list (default is the empty list). %%---------------------------------------------------------------------- -record(person, {name, age, phone = [], dict = []}).
I think this feature is very helpful, at least for me :) I think you can also create a context menu to create erlang header file, I have to create file with extension "*.hrl" and it's boring job.
I hope my suggestions are positive.
— Reply to this email directly or view it on GitHub.
Very good suggestion! I will look at it almost right away.
Please keep suggestions and bugs coming, it is the only way to know what people actually use and need. Otherwise I have to guess...
https://www.assembla.com/spaces/erlide/tickets/1339 https://www.assembla.com/spaces/erlide/tickets/1340
Would you think that the following ways to implement these features would work?
- Context menu on forms should have an option Source->Generate Element Comment.
- If you write -include("foo.hrl") and foo.hrl doesn't exist, there should be a quick fix to create it (Ctrl+1)
- On the context menu for defines and record definitions there should be an option Source->Move Element to Header, so that you can have them in the module at first. The selection for which header will offer the option to create a new one.
Yes, I think that way is very good. Plus: Short-cut key for Generate Element Comment.
would be nice to write "%%-" and press ENTER button, above a function, to generate the Function doc.
Similar to how Java editor does when writing "/*" and pressing ENTER above a method (or class). Or when writing "/" inline and pressing ENTER.
Good idea. Thanks!