Vscode: how to generate a list of all variables used in code?

Hallo, I am starting to document a large program SoilWater-ToolBox, is there a way to generate a list of the all the variables used in the program ?

I am using DocumenterDocumenter.jl

Many thanks for any help you may provide :grinning:

All variables? I don’t think that is possible, because variables can have different labels in the same program.

The constant can be documented with:

julia> """
       speed of light
       """
       const c = 300_000
c

help?> c
search: c cp cd csc cot cos cmp cld cis cat csch cscd coth cotd cosh cosd cosc copy conj chop ceil cbrt Cmd ccall const catch Char

  speed of light

julia>

as any other function. And a “help.md” file with (or put the command below in any other file of the docs):

# Help entries

'''@autodocs
Modules=[PackageName]
'''

(the above ticks should be back-ticks)

will generate the entries of all those commented functions or constants in your manual.

2 Likes

Thanks, that is really helpful.

So therefore there is no automatic function which could derive a list of all the variables used in the code.

May be VScode could provide a list of all the variables used in the program as in the outline panel.

Can’t you just use names here?

My code is a huge hydrological model so I want to generate the names so I can document them in the documents.

Right, I meant the names function:

julia> module Foo
       const c = 3
       x() = c
       end
Main.Foo

julia> names(Foo, all=true)
8-element Array{Symbol,1}:
 Symbol("#eval")   
 Symbol("#include")
 Symbol("#x")      
 :Foo              
 :c                
 :eval             
 :include          
 :x     

Just need to filter out unneeded/auto-generated symbols.