Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow folding of Proofs and Sections #137

Open
Arkhist opened this issue May 23, 2020 · 7 comments
Open

Allow folding of Proofs and Sections #137

Arkhist opened this issue May 23, 2020 · 7 comments
Labels
enhancement New feature or request prio:high

Comments

@Arkhist
Copy link

Arkhist commented May 23, 2020

VSCoq should allow its users to fold Proof/Qed blocks and Section/End blocks.

I believe this feature should be implemented on the language-server side: implementing it as a language configuration feature could create conflicts between the different block types.

@swils
Copy link

swils commented May 23, 2020

I'm only learning Coq, so not an expert, but I'm not convinced that this needs something on the side of the language server. In my personal experience, VSCoq already folds a lot of stuff properly, at least for the simple proofs that I'm currently doing. Could you perhaps send me a couple of snippets that you think cannot be folded properly without the language server?

(By coincidence, the last few days I have been looking at the internals of VSCoq. And perhaps changes to the TextMate definition might allow better folding. Currently everything is in the patterns section; but not much in the repository section. I think (but not sure) that improving this might help with folding. And an unrelated thing that could potentially also be improved is the binding to the scope selectors, spreading it out over more TextMate root groups.)

@Arkhist
Copy link
Author

Arkhist commented May 23, 2020

I inspected the source code of the extension and it does seem like all of the folding happening is caused by the auto folding of VSCode itself when using proper indentation.

I am working with libraries that don't start their proof at a different indentation level and in files with more than 2000 lines, folding becomes very useful.

Here is a minimal example where folding doesn't work.

Section test.

Theorem foo: forall a b: Prop, a /\ b -> b /\ a.
Proof.
intros.
split.
destruct H as [Ha Hb].
exact Hb.
destruct H as [Ha Hb].
exact Ha.
Qed.

Theorem bar: forall a b: Prop, a \/ b -> b \/ a.
Proof.
intros.
destruct H.
right.
assumption.
left.
assumption.
Qed.

End test.

@TheoWinterhalter
Copy link

Note that Proof is not mandatory at the beginning of a proof, which might make folding harder.

@swils
Copy link

swils commented May 24, 2020

No @Arkhist you're right. Improving the TextMate file does not improve the folding. Too bad...

@Blaisorblade
Copy link
Contributor

I share @Arkhist's experience.

Note that Proof is not mandatory at the beginning of a proof, which might make folding harder.

Omitting Proof is problematic for other reasons, so only folding proofs that start with Proof could already help.

@TheoWinterhalter
Copy link

You're right.

@fakusb fakusb added the enhancement New feature or request label Dec 17, 2020
@rtetley
Copy link
Collaborator

rtetley commented Aug 26, 2024

Related to #799

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prio:high
Projects
None yet
Development

No branches or pull requests

6 participants