Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show declaration keywords in hovers #7232

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

david-christiansen
Copy link
Contributor

@david-christiansen david-christiansen commented Feb 25, 2025

This PR adds declaration keywords, such as def or class, to signatures in hovers.

Declaration keywords are now shown in hovers as part of a signature. This is in support of an upcoming documentation style guide that will recommend that the text of docstrings not state what sort of declaration something is, but instead leave it to Lean to tell every user in a consistent manner.

Screenshot:
image

Declaration keywords are now shown in hovers as part of a
signature. This is in support of an upcoming documentation style guide
that will recommend that the text of docstrings not state what sort of
declaration something is, but instead leave it to Lean to tell
every user in a consistent manner.
@david-christiansen david-christiansen added the changelog-server Language server, widgets, and IDE extensions label Feb 25, 2025
@david-christiansen
Copy link
Contributor Author

In most cases, this didn't require much work. However, the name of a class, structure, or class inductive in the declaration itself is saved to the infotree using an environment in which the structure info or class info is not yet present. To make these hovers correct, hovers on names of inductive types also check whether the occurrence in question is such an occurrence, and then uses the containing declaration as a source for the keyword.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Feb 25, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Feb 25, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Feb 26, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Feb 26, 2025
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Feb 26, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR changelog-server Language server, widgets, and IDE extensions toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants