leanprover / leanprover/lean4

RFC: docstrings on trace options

Open
#3,843 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

P-medium RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

Currently, the docstring when overing on

set_option trace.Elab.command true
set_option trace.Elab.syntax true
…

always says

enable/disable tracing for the given module and submodules

hardcoded in

def registerTraceClass (traceClassName : Name) (inherited := false) (ref : Name := by exact decl_name%) : IO Unit := do
  let optionName := `trace ++ traceClassName
  registerOption optionName {
    declName := ref
    group := "trace"
    defValue := false
    descr := "enable/disable tracing for the given module and submodules"
  }
  if inherited then
    inheritedTraceOptions.modify (·.insert optionName)

It seems the original design for trace option was that they would just indicate a module trace.Elab.Foo, but it seems in practice we have all kinds of trace options with interesting semantics that deserve to be described, so that I see what these options do in the auto-completion or hover tooltip.

An optional parameter to registerTraceClass might do. Or, more fancy, a command for

builtin_initialize
  registerTraceClass …

whose docstring is then moved to the option.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the registerTraceClass function shown in the issue and inspect how trace options provide descriptions to auto-completion and hover tooltips. Determine whether an optional parameter or a builtin_initialize command best fits the existing registration path; done means trace options expose semantics-specific docstrings instead of the hardcoded description.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.