Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exposes
Lua.docScriptPath
as a config value, which should be a path that points to a user's documentation script. This script overrides/script/cli/doc/export.lua
, which is used by the server to export docs.Here is the API, all of which can be overriden by the userscript:
export.getLocalPath(uri)
: Called when the documentation needs to get the path of asource
relative to theDOC
path. Returns the relative path, or the absolute path, prefixed with the string'[FOREIGN]'
export.positionOf(rowcol)
: Wrapper forguide.positionOf(rowcol[1], rowcol[2])
export.sortDoc(a,b)
: A comparison function used bytable.sort
that is used to sort every piece of documentation in alphabetical order.export.documentObject(source, has_seen)
: A function that gets called on everysource
object. It is responsible for filtering each source to their correspondingexport.makeDocObject[<TYPE>]
functionexport.makeDocObject[<TYPE>]
: A table of functions that are responsible for building their corresponding<TYPE>
's documentation. TYPES include'type'
,'variable'
,'doc.class'
, etc.'INIT'
corresponds to every documentation object before it is processed by its corresponding type.export.gatherGlobals()
: Called when the documentation needs an exhaustive list of the globals it should export documentation. By default this includes the result ofvm.getAllGlobals()
. Returns the collected variables/types.export.makeDocs(globals, callback)
: Documentsglobals
fromexport.gatherGlobals()
by callingexport.documentObject
on each one; updates its progress by callingcallback
when a global is finished being documented. Returns a table of the collected documentationexport.serializeAndExport(docs, outputDir)
: Serializes documentation tables fromexport.makeDocs
to json and markdown, Writes them to<outputDir>/doc.json
and<outputDir>/doc.md
, respectively. Returns these paths.By default
Lua.docScriptPath
is""
and will execute the default documentation generation script atscript/cli/doc/export.lua
(with the above specified default behaviors).For convenience, the
script/vm/compiler.lua
module now has a functionvm.getSimpleClassFields
, which can be used to get class fields without them recursing into other classes.This has only been tested running the server manually with the
--doc
and--doc_out_path
parameters, it has not been tested it by running it in VSC.I made this because documentation was getting very unwieldy to generate, and saw doc sizes shrink by a factor of 10 when a custom documentation script was applied.