PG icon indicating copy to clipboard operation
PG copied to clipboard

Indentation issue : "\in"

Open KimayaBedarkar opened this issue 1 year ago • 2 comments

SSReflect uses \in as opposed to the unicode to indicate membership in lists. However, the former is not indented correctly. Example:

Lemma test:
  forall a : nat,
    a \in [::] ->
          False. (* indented by 4 spaces*)

as opposed to:

Lemma test:
  forall a : nat,
    a ∈ [::] ->
    False. (* not indented *)

KimayaBedarkar avatar Apr 04 '24 19:04 KimayaBedarkar

Hi. Sadly the coq-smie-user-tokens variable that usually can solve this kind of problem does not work in this case because "\" is not considered as part f a token by PG's lexer. I will think about a way to include this characters in lexing but this will not happen in a short future I am afraid. Sorry...

Poor work around: put parenthesis around a \n [::].

Matafou avatar Sep 09 '24 16:09 Matafou

Actually I think I found a simple way to fix this. @KimayaBedarkar can you test this? I get this indentation now:

Require Import mathcomp.ssreflect.ssrbool.

Definition xx := nat.
Module foo.
  (* from PG issue #757 *)
  Lemma test:
    forall a : nat,
      a \in [::] ->  (* "\in" should be detected as one token *)
      False.
  Proof.
  Abort.

  Lemma test2:
    forall a : nat,
      a \in  (* "\in" should be detected as one token *)
        [::] ->
      False.
End foo.

Matafou avatar Sep 10 '24 08:09 Matafou