intellij-arend icon indicating copy to clipboard operation
intellij-arend copied to clipboard

"Extend selection" doesn't properly work in equational reasoning

Open marat-rkh opened this issue 3 years ago • 4 comments

Consider the following code:

\func +-swap (m n p : Nat) : m + (n + p) = n + (m + p) =>
  m + (n + p) ==< (inv $ +-assoc m n p) >==
  (m + n) + p ==< rewrite {1} (+-comm m n) idp >==
  (n + m) + p ==< +-assoc n m p >==
  n + (m + p) `qed
  1. Put a caret at any position in any expression on the left side of ==<.
  2. Invoke "Edit | Extend Selection" multiple times to select the whole left side (say m + (n + p) at the beginning).

Expected result: selection extends to cover the left side. Actual result: everything after => is selected.

marat-rkh avatar Apr 21 '21 08:04 marat-rkh

This is because how expressions are parsed. They are BinOpSequence in the Psi syntax.

You can select expressions by abusing the 'show type' action -- put your caret on ==< and invoke 'show type'. It selects the expression for you.

ice1000 avatar Apr 21 '21 08:04 ice1000

Btw, are you a new Arend developer? You seem to be too active as a user :thinking:

ice1000 avatar Apr 21 '21 08:04 ice1000

Yes, I am, on a part- time basis)

This is because how expressions are parsed. They are BinOpSequence in the Psi syntax.

But as far as I understand, it should be possible using Concrete AST.

You can select expressions by abusing the 'show type' action -- put your caret on ==< and invoke 'show type'. It selects the expression for you.

Nice, thanks for the trick)

marat-rkh avatar Apr 21 '21 09:04 marat-rkh

Now, it extends a little bit, but then jumps to the whole expression anyway.

valis avatar Oct 07 '21 19:10 valis

Can't reproduce

sxhya avatar Jul 21 '23 14:07 sxhya