This PR implements signature help support. When typing a function application, editors with support for signature help will now display a popup that designates the current (remaining) function type. This removes the need to remember the function signature while typing the function application, or having to constantly cycle between hovering over the function identifier and typing the application. In VS Code, the signature help can be triggered manually using `Ctrl+Shift+Space`.  ### Other changes - In order to support signature help for the partial syntax `f a <|` or `f a $`, these notations now elaborate as `f a`, not `f a .missing`. - The logic in `delabConstWithSignature` that delaborates parameters is factored out into a function `delabForallParamsWithSignature` so that it can be used for arbitrary `forall`s, not just constants. - The `InfoTree` formatter is adjusted to produce output where it is easier to identify the kind of `Info` in the `InfoTree`. - A bug in `InfoTree.smallestInfo?` is fixed so that it doesn't panic anymore when its predicate `p` does not ensure that both `pos?` and `tailPos?` of the `Info` are present.
80 lines
5 KiB
Text
80 lines
5 KiB
Text
[Elab.info]
|
|
• [Command] @ ⟨3, 0⟩-⟨3, 31⟩ @ Lean.Elab.Command.elabSetOption
|
|
• [Completion] (Command.set_option "set_option" `trace.Elab.info []) @ ⟨3, 0⟩-⟨3, 26⟩
|
|
• [Option] trace.Elab.info @ ⟨3, 11⟩-⟨3, 26⟩
|
|
1 + 2 + 3 : Nat
|
|
[Elab.info]
|
|
• [Command] @ ⟨5, 0⟩-⟨5, 16⟩ @ Lean.Elab.Command.elabCheck
|
|
• [Term] 1 + 2 + 3 : Nat @ ⟨5, 7⟩-⟨5, 16⟩ @ «_aux_Init_Notation___macroRules_term_+__2»
|
|
• [MacroExpansion]
|
|
1 + 2 +
|
|
3
|
|
-- should propagate through multiple macro expansions
|
|
===>
|
|
binop% HAdd.hAdd✝ (1 + 2)
|
|
3
|
|
-- should propagate through multiple macro expansions
|
|
• [Term] 1 + 2 + 3 : Nat @ ⟨5, 7⟩†-⟨5, 16⟩† @ Lean.Elab.Term.Op.elabBinOp
|
|
• [Term] 1 + 2 + 3 : Nat @ ⟨5, 7⟩†-⟨5, 16⟩†
|
|
• [Term] 1 + 2 : Nat @ ⟨5, 7⟩-⟨5, 12⟩ @ «_aux_Init_Notation___macroRules_term_+__2»
|
|
• [MacroExpansion]
|
|
1 + 2
|
|
===>
|
|
binop% HAdd.hAdd✝ 1 2
|
|
• [Term] 1 + 2 : Nat @ ⟨5, 7⟩†-⟨5, 12⟩†
|
|
• [Completion-Id] HAdd.hAdd✝ : none @ ⟨5, 7⟩†-⟨5, 16⟩†
|
|
• [Completion-Id] HAdd.hAdd✝ : none @ ⟨5, 7⟩†-⟨5, 12⟩†
|
|
• [Term] 1 : Nat @ ⟨5, 7⟩-⟨5, 8⟩ @ Lean.Elab.Term.elabNumLit
|
|
• [Term] 2 : Nat @ ⟨5, 11⟩-⟨5, 12⟩ @ Lean.Elab.Term.elabNumLit
|
|
• [Term] 3 : Nat @ ⟨5, 15⟩-⟨5, 16⟩ @ Lean.Elab.Term.elabNumLit
|
|
fun n m l => ↑n + (↑m + ↑l) : Nat → Nat → Nat → Int
|
|
[Elab.info]
|
|
• [Command] @ ⟨7, 0⟩-⟨7, 48⟩ @ Lean.Elab.Command.elabCheck
|
|
• [Term] fun n m l => ↑n + (↑m + ↑l) : Nat → Nat → Nat → Int @ ⟨7, 7⟩-⟨7, 48⟩ @ Lean.Elab.Term.elabFun
|
|
• [Term] Nat : Type @ ⟨7, 20⟩-⟨7, 23⟩ @ Lean.Elab.Term.elabIdent
|
|
• [Completion-Id] Nat : some Sort.{?_uniq} @ ⟨7, 20⟩-⟨7, 23⟩
|
|
• [Term] Nat : Type @ ⟨7, 20⟩-⟨7, 23⟩
|
|
• [Term] n (isBinder := true) : Nat @ ⟨7, 12⟩-⟨7, 13⟩
|
|
• [Term] Nat : Type @ ⟨7, 20⟩-⟨7, 23⟩ @ Lean.Elab.Term.elabIdent
|
|
• [Completion-Id] Nat : some Sort.{?_uniq} @ ⟨7, 20⟩-⟨7, 23⟩
|
|
• [Term] Nat : Type @ ⟨7, 20⟩-⟨7, 23⟩
|
|
• [Term] m (isBinder := true) : Nat @ ⟨7, 14⟩-⟨7, 15⟩
|
|
• [Term] Nat : Type @ ⟨7, 20⟩-⟨7, 23⟩ @ Lean.Elab.Term.elabIdent
|
|
• [Completion-Id] Nat : some Sort.{?_uniq} @ ⟨7, 20⟩-⟨7, 23⟩
|
|
• [Term] Nat : Type @ ⟨7, 20⟩-⟨7, 23⟩
|
|
• [Term] l (isBinder := true) : Nat @ ⟨7, 16⟩-⟨7, 17⟩
|
|
• [Term] ↑n + (↑m + ↑l) : Int @ ⟨7, 28⟩-⟨7, 48⟩ @ Lean.Elab.Term.elabTypeAscription
|
|
• [Term] Int : Type @ ⟨7, 44⟩-⟨7, 47⟩ @ Lean.Elab.Term.elabIdent
|
|
• [Completion-Id] Int : some Sort.{?_uniq} @ ⟨7, 44⟩-⟨7, 47⟩
|
|
• [Term] Int : Type @ ⟨7, 44⟩-⟨7, 47⟩
|
|
• [Term] ↑n + (↑m + ↑l) : Int @ ⟨7, 29⟩-⟨7, 41⟩ @ «_aux_Init_Notation___macroRules_term_+__2»
|
|
• [MacroExpansion]
|
|
n + (m +' l)
|
|
===>
|
|
binop% HAdd.hAdd✝ n (m +' l)
|
|
• [Term] ↑n + (↑m + ↑l) : Int @ ⟨7, 29⟩†-⟨7, 41⟩† @ Lean.Elab.Term.Op.elabBinOp
|
|
• [Term] ↑n + (↑m + ↑l) : Int @ ⟨7, 29⟩†-⟨7, 41⟩†
|
|
• [Completion-Id] HAdd.hAdd✝ : none @ ⟨7, 29⟩†-⟨7, 41⟩†
|
|
• [Term] n : Nat @ ⟨7, 29⟩-⟨7, 30⟩ @ Lean.Elab.Term.elabIdent
|
|
• [Completion-Id] n : none @ ⟨7, 29⟩-⟨7, 30⟩
|
|
• [Term] n : Nat @ ⟨7, 29⟩-⟨7, 30⟩
|
|
• [Term] ↑m + ↑l : Int @ ⟨7, 34⟩-⟨7, 40⟩ @ «_aux_binopInfoTree___macroRules_term_+'__1»
|
|
• [MacroExpansion]
|
|
m +' l
|
|
===>
|
|
m + l
|
|
• [Term] ↑m + ↑l : Int @ ⟨7, 34⟩†-⟨7, 40⟩† @ «_aux_Init_Notation___macroRules_term_+__2»
|
|
• [MacroExpansion]
|
|
m + l
|
|
===>
|
|
binop% HAdd.hAdd✝ m l
|
|
• [Term] ↑m + ↑l : Int @ ⟨7, 34⟩†-⟨7, 40⟩†
|
|
• [Completion-Id] HAdd.hAdd✝ : none @ ⟨7, 34⟩†-⟨7, 40⟩†
|
|
• [Term] m : Nat @ ⟨7, 34⟩-⟨7, 35⟩ @ Lean.Elab.Term.elabIdent
|
|
• [Completion-Id] m : none @ ⟨7, 34⟩-⟨7, 35⟩
|
|
• [Term] m : Nat @ ⟨7, 34⟩-⟨7, 35⟩
|
|
• [Term] l : Nat @ ⟨7, 39⟩-⟨7, 40⟩ @ Lean.Elab.Term.elabIdent
|
|
• [Completion-Id] l : none @ ⟨7, 39⟩-⟨7, 40⟩
|
|
• [Term] l : Nat @ ⟨7, 39⟩-⟨7, 40⟩
|
|
[Elab.info]
|
|
• [Command] @ ⟨8, 0⟩-⟨8, 0⟩ @ Lean.Elab.Command.elabEoi
|