ProofGeneral / PG

This repo is the new home of Proof General
https://proofgeneral.github.io
GNU General Public License v3.0
491 stars 88 forks source link

Fix #781 PG does not position to error. #782

Closed Matafou closed 2 months ago

Matafou commented 4 months ago

We cannot use the " ^^^ " thing to compute the error location because commands are not stripped of newlines anymore (#774).

Solution: use the character position information with the following subtleties

Matafou commented 4 months ago

This needs a bit of a test and discussion.

It seems to work but it is difficult to be sure.

Things to check that I can think of.

Matafou commented 4 months ago

I just added a test that checks that the correct region is highlighted. @hendrik or @erikmd can you review pls? I sum up the fix:

Note: testing this I found something strange in error location info from coq

Matafou commented 3 months ago

This is not ready yet. I will try to fix this by the end of the summer.

erikmd commented 2 months ago

Hi @Matafou, thanks a lot for working on this!

It seems to work but it is difficult to be sure.

OK, I wouldn't have foreseen that fixing #781 would be that involved.

But anyway, if it works in practice and we can get a good CI tests coverage, that'll already be pretty good!

Is the computation of position robust to any encoding?

I saw you used byte-to-position so that should be Okay, anyway we'll be able to CI-test with a few standard encodings.

Currently I strip trailing spaces of all commands otherwise coq's error location are wrong. Should we make this an option (in case it is not suitable for other provers)?

Good question; this needs some discussion I guess, since your PR mainly touches coq.el, but also proof-shell.el.

Anyway, we don't have a CI testsuite for other provers (I had opened this issue: https://github.com/ProofGeneral/PG/issues/505 but it stalled).

test error highlighting in CI? This would need to check temporary overlays (they last 2 sec) which is not great.

I believe this is testable, and actually you already tested it IIUC:

I just added a test that checks that the correct region is highlighted.

@Hendrik or @erikmd can you review pls? I sum up the fix:

there was no sentence after your comment's colon ↑

Note: testing this I found something https://github.com/coq/coq/issues/19355

Does this mean that this PG PR will only work for Coq ≥ 8.20 ?

in this case, should we revert https://github.com/ProofGeneral/PG/pull/774 for Coq ≤ 8.19 ?

I believe the start-of-term will be dense for you as well @Matafou, but let me know (Cc @hendriktews) if you have a free slot in the upcoming days and would like to video-meet to discuss this, I'll try to join.

Matafou commented 2 months ago

The two failing tests are on coq-8.11. I will try to investigate but maybe this is not blocking. One problem remains: support the coq bug that has just been fixed in coq master?

Matafou commented 2 months ago

This seems ready. I will merge this tomorrow if no one objects. @erikmd this is an important fix imho, is there something to do to update pg distributed packages?

Matafou commented 2 months ago

This PR

Matafou commented 2 months ago
Matafou commented 2 months ago

I decided to add the fix of hardwired command strings (removing trailing spaces) in a separate commit of this same PR.

Matafou commented 2 months ago

The failed CI is not related (reached VM limit). I merge now.

erikmd commented 2 months ago

Thanks a lot @Matafou !

sorry for replying late

@erikmd this is an important fix imho, is there something to do to update pg distributed packages?

It depends on the distribution you think of: