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

Display tooltips correctly (when loc is None) #17012

Closed
wants to merge 1 commit into from

Conversation

jfehrle
Copy link
Member

@jfehrle jfehrle commented Dec 19, 2022

Fixes: #16987

The case where loc is None is the important one--none of the calls to CWarnings.create pass loc. I haven't figured out the fix for the Some case yet. IMO that's not urgent, though I will work on it in the next few days.

Error messages also generate tooltips. These seem to work correctly even when loc is provided. FWIW, I found 79 places in the source of errors that can provide loc.

Attn: @Zimmi48 @ejgallego

@jfehrle jfehrle added the kind: fix This fixes a bug or incorrect documentation. label Dec 19, 2022
@jfehrle jfehrle added this to the 8.17+rc1 milestone Dec 19, 2022
@jfehrle jfehrle requested a review from a team as a code owner December 19, 2022 04:04
@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Dec 19, 2022
let start, stop = match loc with
| None -> start_sentence, stop_sentence
| Some loc ->
(* FIXME: tooltips don't show correctly for this case *)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fail to see the point of this PR over #16978 , for the None case the code is the same, for Some case the code is wrong, whereas the on in #16978 should be correct TTBOMK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ejgallego The explanation provided by Jim is that your last commit in your PR reintroduces a performance issue:

The last commit ("Fix bizarre location-handling code.") reintroduces the O(n^2) behavior. The ones before it are OK. (Pff.v, a 1.2 MB file, takes about 3 minutes to run in CoqIDE both on master and with the first 3 commits. With the 4th commit, I gave up after 10 minutes, and it had only processed half the source.)

So the point of this PR is supposed to be: fix the tooltip issue without reintroducing the quadratic behavior.

Note that I'm just commenting based on my reading of the comments, I haven't looked at the actual code on either PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a look into the performance issue, but it is not introduced in the code part this PR is touching, the last commit in the PR does indeed touch 2 different code paths.

I'll split the commit in two. This PR still makes little sense as we have better code for the Some path in the other PR, whereas this one just puts some code that looks pretty strange.

Copy link
Member Author

@jfehrle jfehrle Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fail to see the point of this PR

The issue is unrelated to your original PR. I took the part of your changes that made sense. Currently, no warning uses the code for the Some branch, and IIRC your code was not correct for the Some case. I assumed it was urgent to get your other code into 8.17 and that we should fix the tooltip problem in 8.17. Fixing the Some case doesn't have to be in 8.17, though I planned to look at it very soon. Now I'm not sure I should bother.

Copy link
Member

@ejgallego ejgallego Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My code was almost correct for the Some case, it only did mishandle the case where UTF-8 symbols where before in the buffer, whereas the current code here mishandles all of them. Moreover it was noted as a fixme which is now fixed.

Indeed, why you would like to spend time fixing something that is already fixed is an interesting question.

Note that when taking parts of the code of some other developer, it may sensible to ask them first what are they planning to do with it, otherwise you risk indeed doing double work.

By the way, you should be able to hit the Some case, at least quite a few warnings do set ?loc , then why the feedback may be discarded at the STM level is a different issue.

I think having better tests is much welcome in this area.

@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Dec 21, 2022
@ejgallego
Copy link
Member

Original PR improved and merge. Thanks a lot @jfehrle for all the comments and testing.

We may want to open a new bug for the tooltips that are lost due to "detached" feedback (but that's a way harder issue to fix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: fix This fixes a bug or incorrect documentation. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[coqide] Tooltip locations are broken in master
3 participants