-
Notifications
You must be signed in to change notification settings - Fork 451
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
chore: remove @ from rw? suggestions, and enable hover on constants in #check #3911
Conversation
Mathlib CI status (docs):
|
There will be some downstream breakage, but should be minor so I'm not going to fix ahead of time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the PR message:
improving the hover behaviour in #check.
Could you mention what's being improved in the PR message? I seem to be able to hover over everything except for the constant itself, so I'm guessing it's that this lets you hover over the constant? That makes some sense, for being able to see the docstring, even if you don't need to see the type.
In leanprover#3911, a refactor to share `MessageData` code between `ppConst` and the signature pretty printer unintentionally caused the signature pretty printer to use the `pp.tagAppFns` option. This causes, for example, `+` in `a + b` to independently have its own hover information. This affects `#check` and was reported by Kevin Buzzard [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/degraded.20hover.20experience.20on.20.23check/near/449380674).
In #3911, a refactor to share `MessageData` code between `ppConst` and the signature pretty printer unintentionally caused the signature pretty printer to use the `pp.tagAppFns` option. This causes, for example, `+` in `a + b` to independently have its own hover information due to the fact that `notation` app unexpanders use the head function's syntax as the `ref` when constructing the notation syntax. This behavior of `pp.tagAppFns` is intentional, and it is used by docgen, but it should not be activated for signatures. This affects `#check` and was reported by Kevin Buzzard [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/degraded.20hover.20experience.20on.20.23check/near/449380674). This PR also makes sure the initial `ref` when applying app unexpanders is `.missing`, rather than whatever random value might be present in the `CoreM` context.
Replaces the unused
Lean.PrettyPrinter.ppConst
withMessageData.ofConst
(which similarly avoids an unnecessary@
) and that further generates a hover for the constantUses this in
TryThis.addRewriteSuggestion
, so thatrw?
suggestions don't have unnecessary@
s.Add
MessageData.signature
, as a wrapper aroundPrettyPrinter.signature
, using the same machinery to generate hovers for constants, improving the hover behaviour in #check so that we get second order pop-up for constants in the signature. (Not sure how to write tests for second order hovers, so there is no test for this.)