Zulip Chat Archive

Stream: metaprogramming / tactics

Topic: Printing multiple commands using Try this


Paul Lezeau (Jan 06 2025 at 09:00):

I'm trying to write a command that prints out a "try this" suggestion with multiple commands. Is there a clean way of doing this?
E.g. my first attempt was something along the lines of the following:

import Mathlib
open Lean Elab Tactic Meta Tactic.TryThis Command

elab "#testing " : command => Command.liftTermElabM do
  let command1 : Command  `( #check Nat.add)
  let command2 : Command  `( #check Nat.div)
  let command : Command  `($command1:command $command2:command)
  let suggestion : SuggestionText := .tsyntax command
  let suggestion : Suggestion := { suggestion := suggestion }
  addSuggestion ( getRef) suggestion

but this doesn't work.

Paul Lezeau (Jan 06 2025 at 09:07):

The idea would be to get both commands simultaneously when clicking on the try this, rather than getting multiple try this suggestions by using addSuggestions


Last updated: May 02 2025 at 03:31 UTC