bazelbuild / stardoc

Stardoc: Starlark Documentation Generator
Apache License 2.0
108 stars 45 forks source link

Export full path of symbols in ModuleInfo #81

Closed erenon closed 1 year ago

erenon commented 3 years ago

The ModuleInfo proto does not export the full path/label of the symbols, nor the other info protos. I'd like to write templates that automatically add load usage, e.g:

load('//foo/bar:baz.bzl', 'qux')

But the /foo/bar:baz.bzl part is not available for the template.

alexeagle commented 3 years ago

We also need to include the line number in the original .bzl where the symbol was defined. This sourcemap allows the docsite to give users an "edit this" link that takes you to the right spot to contribute documentation fixes.

tetromino commented 1 year ago

The new native starlark_doc_extract rule coming in Bazel 7 will give you ModuleInfo.file (the label of the module overall) and *Info.origin_key (the label of the file where the symbol was originally defined, and the name under which it was defined there) - and we are switching over Stardoc to use the new rule.

Unfortunately, for memory-saving reasons, we can't directly give you line numbers.