leanprover / leanprover/lean4

Parser docstring vs syntax hover target audience confusion

Open
#5,334 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

A lot of parser and parser combinators have docstrings that aim to explain how to use the the parser, but then they end up being shown to the unsuspecting user when hovering over a piece of syntax that doesn't happen to have a better docstring.

For example in

import Lean
/-- docstring -/
theorem foo : True := trivial

if you hover over the : you get

declSig matches the signature of a declaration with required type: a list of binders and then : type 

and if you hover over the docstring you get

A docComment parses a…

Depending whether you already have #3918 you need import Lean to make these hovers visible, but note that import Mathlib implies import Lean, so that’s not the core issue.

It seems that one needs at least a way to indicate “the docstring of this parser or syntax is not meant for hovers”, and going through the code to annotate all docstrings that don’t have a useful user-facing docstring.

A more thorough solution is to somehow be able to write two docstrings, one to document Lean.Parser.Command.declSig, and one to show upon hovering : above.

Versions

Around 4.12.0

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, 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 by reproducing the declSig and docComment hover behavior from the import Lean example, focusing on parser docstrings and the : syntax hover. Review the documentation and hover behavior around Lean.Parser.Command.declSig; done means parser-oriented text is not shown as unrelated syntax help, or separate parser and hover documentation can be provided.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.