Listing all names available in a module

Is there a way to figure out which names are available in the context of a given module? I want to list all names defined in the module, and imported into the module’s namespace with using, and all modules referenced with import. I know about propertynames(module, true), but that only solves the first part of the problem.

(Context: Emacs development environment for Julia. This is necessary to implement autocompletion.)

julia> using DSP

help?> names
search: names fieldnames propertynames nameof NamedTuple dirname tempname fullname basename fieldname gethostname backend_name

  names(x::Module; all::Bool = false, imported::Bool = false)

  Get an array of the names exported by a Module, excluding deprecated names. If all is true, then the list also includes non-exported names defined in the module, deprecated names, and compiler-generated
  names. If imported is true, then names explicitly imported from other modules are also included.

  As a special case, all names defined in Main are considered "exported", since it is not idiomatic to explicitly export names from Main.

julia> names(DSP, all=true, imported=true)
166-element Array{Symbol,1}:
 Symbol("##meta#112")           
 Symbol("##xcorr#11")           
 Symbol("#1#4")                 
 Symbol("#2#5")                 
 Symbol("#3#6")                 
 Symbol("#7#8")                 
...
3 Likes

Thanks, that works. I missed names while looking too hard at propertynames.

Is there a way to make this work for names brought in implicitly with using?