bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Include additional rule info while exporting builtins

Open withered-magic opened this issue 2 years ago • 4 comments

My WIP Starlark LSP currently uses the ApiExporter to dump all types + globals to the builtins.pb proto, which the LSP then loads at runtime to provide type information/hover docs for Bazel builtins. Right now, the ApiExporter only sets the name and is_mandatory fields of rule Params, limiting the ability of the LSP to provide type checking for rules (e.g. validating argument types). This PR adds additional getters on RuleDocumentationAttribute for the attribute type, default value, documentation, allowing the LSP to use this additional information.

withered-magic avatar Jan 30 '24 02:01 withered-magic

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Jan 30 '24 02:01 google-cla[bot]

@sgowroji Any pointers on getting CI to pass? Looks like a potential flake but I can't see the retry button in the usual place in the Buildkite UI.

withered-magic avatar Jan 30 '24 08:01 withered-magic

Retried and looks good now.

keertk avatar Feb 02 '24 02:02 keertk

Thank you!

withered-magic avatar Feb 02 '24 09:02 withered-magic

I don't think we should continue trying to represent a native rule class as a callable builtin.Value. Instead, we should simply represent it using a message specifically designed for describing a rule class: a stardoc_output.RuleInfo.

See also discussion in https://github.com/bazelbuild/bazel/pull/21929

tetromino avatar Jun 20 '24 23:06 tetromino