This PR adds support for interactivity to the combined "try this" messages that were introduced in #9966. In doing so, it moves the link to apply a suggestion to a separate `[apply]` button in front of the suggestion. Hints with diffs remain unchanged, as they did not previously support interacting with terms in the diff, either. <img width="379" height="256" alt="Suggestion with interactive message" src="https://github.com/user-attachments/assets/7838ebf6-0613-46e7-bc88-468a05acbf51" />
44 lines
879 B
Text
44 lines
879 B
Text
/--
|
|
info: Try this:
|
|
[apply] termination_by xs.length / 2 - i
|
|
-/
|
|
#guard_msgs in
|
|
def foo (xs : String) (i : Nat) (a b : String.Iterator) : Bool :=
|
|
if xs.length / 2 ≤ i then
|
|
true
|
|
else if a.curr ≠ b.curr then
|
|
false
|
|
else
|
|
foo xs (i + 1) a.next b.prev
|
|
termination_by?
|
|
|
|
/--
|
|
info: Try this:
|
|
[apply] termination_by xs.length / 2 - i
|
|
-/
|
|
#guard_msgs in
|
|
def bar (xs : String) (i : Nat) (a b : String.Iterator) : Bool :=
|
|
if i < xs.length / 2 then
|
|
if a.curr ≠ b.curr then
|
|
false
|
|
else
|
|
bar xs (i + 1) a.next b.prev
|
|
else
|
|
true
|
|
termination_by?
|
|
|
|
|
|
/--
|
|
info: Try this:
|
|
[apply] termination_by xs.length / 2 - i
|
|
-/
|
|
#guard_msgs in
|
|
def baz (xs : String) (i : Nat) (a b : String.Iterator) : Bool :=
|
|
if ¬ (i < xs.length / 2) then
|
|
true
|
|
else
|
|
if a.curr ≠ b.curr then
|
|
false
|
|
else
|
|
baz xs (i + 1) a.next b.prev
|
|
termination_by?
|