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

Tooltip gets stuck #1412

Closed
guilhermevrs opened this issue Mar 7, 2018 · 5 comments
Closed

Tooltip gets stuck #1412

guilhermevrs opened this issue Mar 7, 2018 · 5 comments

Comments

@guilhermevrs
Copy link

Hi,

We are facing some weird issues with the tooltip on hover.

Sometimes, when your mouse hover an object and you scroll or change tab, the tooltip shows up and gets stuck on it.
Example:

2018-03-07_09-54-08

We can get the tooltip to disappear sometimes when returning to the correct tab where it was generated. But it's not a silver bullet solution, sometimes it does not want to go away.
The only way is to actually restart atom.

When we disable the atom-typescript plugin, the tooltip disappears. But after re-enabling it, the tooltip come again to the same position.

I have tried to reproduce a couple of times and noticed that on the console, you get errors like:

Uncaught (in promise) Error: ENOENT: no such file or directory, open 'C:\dev\null\inferredProject1*'

where the number in the end gets incremented every time a new occurence of the error happens.

OS: Windows
Atom: 1.24.0
Atom-typescript: 12.3.3

@guilhermevrs guilhermevrs changed the title Issues with the tooltip Tooltip gets stuck Mar 7, 2018
@andyrichardson
Copy link

Thanks for the suggestion, I have also encountered this issue.

It might be worth mentioning that ctrl+shift+f5 can be used to quickly restart the editor.

@lierdakil
Copy link
Collaborator

I have occasionally observed similar behaviour, but could never reproduce it.

Uncaught (in promise) Error: ENOENT: no such file or directory, open 'C:\dev\null\inferredProject1*'

A stack trace would be very helpful.

lierdakil added a commit that referenced this issue Mar 7, 2018
@guilhermevrs
Copy link
Author

Unfortunately the console does not log any stack trace, otherwise I would have posted :(

I haven't had enough time to dive into the code and debug it (now that I can reproduce systematically).

Quickly looking, the problem may be related to this method

private async showExpressionType(e: {clientX: number; clientY: number}) {

What do you guys think?

If you point me out some basis, I can try to put some breakpoints and see what it's going on

@lierdakil
Copy link
Collaborator

If you point me out some basis, I can try to put some breakpoints and see what it's going on

Well, I think it's clear that some kind of race condition is going on, and looking at the code closely, there aren't that many places where it could be. The only meaningful async function being showExpressionType, and the only meaningful (i.e. not usually resolved straight away) await there being here:

result = await client.execute("quickinfo", {

This is pure speculation, but I would expect something like this is happening:

  1. showExpressionType is triggered on timeout
  2. showExpressionType awaits on quickinfo
  3. Active editor changes
  4. quickinfo resolves
  5. The tooltip for a previously active editor is shown

I guess this could be solved by a boolean flag, but that's ugly. Sadly, promises aren't cancellable.

The problem is exacerbated by an architectural flaw where each editor has its own tooltip (which is in hindsight an obvious mistake since there's no "valid" way to get multiple tooltips)

... anyway, 12.3.4 fixes the architectural flaw, which should help somewhat. Tooltip might still get "stuck", on occasion, but it should "unstuck" itself once mouse moves over any typescript editor. I'll try to figure out a more permanent solution, but I hope this will do until then.

@lierdakil
Copy link
Collaborator

Please open new issues if something similar happens after v12.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants