[erlang-questions] Help with Sublime Text 2 Code Completion

Andrew Berman rexxe98@REDACTED
Thu Apr 12 22:06:15 CEST 2012


Hey Erik,

That looks interesting.  Currently, I'm looping through the results of
erlang:loaded() which is very fast, then doing Module:module_info(exports)
and doing a fuzzy search on those which is why I wanted to load all the
modules.  By loading them all, they're already cached for me so that's one
less thing I would have to do.  Is using beam_disasm fast?  Is loading all
the modules really that bad?  I can't imagine it uses that much memory that
it would be an issue.  Using beam_disasm would mean I would have to cache
the results myself which means memory would be used anyway.  Thoughts?

Thanks,

Andrew


On Thu, Apr 12, 2012 at 3:57 AM, Erik Søe Sørensen <eriksoe@REDACTED>wrote:

> Are you sure that you want to *load* all the modules?
> (Especially in these days, when modules may have 'on_load' hooks which
> you're probably not interested in running indiscriminately - and which may
> fail...)
>
> An alternative, in case you merely wish to know the list of exported
> functions from a beam file FileName:
>     {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName).
>     Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0].
>
> Den 12. apr. 2012 09.35 skrev Gustav Simonsson <
> gustav.simonsson@REDACTED>:
>
>
>> If you know which modules are in the added code paths you can simply loop
>> over them and load each of them using the functions in the code module.
>>
>> Typically in Erlang systems one knows which modules exist, but if you
>> cannot know that prior to adding a new code path my guess is that you
>> have to search your newly added code paths and use e.g. code:load_file/1
>>
>> Regards,
>> Gustav Simonsson
>>
>> Sent from my PC
>>
>> ----- Original Message -----
>> > From: "Andrew Berman" <rexxe98@REDACTED>
>> > To: "Erlang Questions" <erlang-questions@REDACTED>
>> > Sent: Thursday, 12 April, 2012 1:13:17 AM
>> > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code Completion
>> >
>> >
>> > Hey all,
>> >
>> >
>> > Been a while since I posed this question, but I'm still stuck on
>> > trying to load all the beam files. Is there some magic way to tell
>> > the VM to load all the beams in the code path or do I have to loop
>> > through the code path and load them all manually? How would I go
>> > about doing it that way if that is what is required?
>> >
>> >
>> > Thanks,
>> >
>> >
>> > Andrew
>> >
>> >
>> > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED >
>> > wrote:
>> >
>> >
>> > All,
>> >
>> >
>> > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang
>> > code completion. My thought is to have a server or node running and
>> > then talk to that node using erl_call. I have it working with the
>> > stdlib, but I want the code completion to be dynamic such that the
>> > plug-in tells the remote node to add code paths. I have that working
>> > too, but the issue is loading the actual modules in the new code
>> > path. Since the erlang vm loads modules only upon access, when I
>> > call erlang:loaded() or code:all_loaded(), the modules added with
>> > the new code path do not show. Do I have to loop through the BEAMs
>> > in the new code path and manually load them or is there a better way
>> > to do it? I'm trying to make the completion use a fuzzy search such
>> > that something like "li" brings up all modules with "li" in it which
>> > is why I need to be able to have the entire list of modules loaded
>> > already.
>> >
>> >
>> > Thanks,
>> >
>> >
>> > Andrew
>> >
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://erlang.org/mailman/listinfo/erlang-questions
>> >
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120412/6c652e09/attachment.htm>


More information about the erlang-questions mailing list