Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Conversation

@ijsnow
Copy link
Contributor

@ijsnow ijsnow commented Jul 8, 2018

This PR moves the position finding for events outside of hoverifier. This is part of the steps for modularizing this code base.. This will close #4.

It was tested in sourcegraph/sourcegraph and everything works as expected.

@ijsnow ijsnow requested a review from felixfbecker July 8, 2018 19:41
@codecov
Copy link

codecov bot commented Jul 8, 2018

Codecov Report

Merging #9 into master will increase coverage by 0.39%.
The diff coverage is 63.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   51.94%   52.33%   +0.39%     
==========================================
  Files          14       15       +1     
  Lines         541      577      +36     
  Branches      134      138       +4     
==========================================
+ Hits          281      302      +21     
- Misses        260      275      +15
Impacted Files Coverage Δ
src/helpers.ts 46.66% <100%> (ø) ⬆️
src/HoverOverlay.tsx 10.25% <100%> (ø) ⬆️
src/testutils/mouse.ts 60.52% <53.33%> (-26.15%) ⬇️
src/positions.ts 63.15% <63.15%> (ø)
src/hoverifier.ts 55.03% <70.83%> (+0.19%) ⬆️
src/token_position.ts 71.96% <0%> (+1.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c374679...23d9f34. Read the comment docs.

hoverOverlayRerenders: Observable<{
hoverOverlayElement: HTMLElement
scrollElement: HTMLElement
}>
Copy link
Contributor

Choose a reason for hiding this comment

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

where do these changes come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cmd+s in vscode... Prettier doing its thing but not sure why to be honest

@felixfbecker
Copy link
Contributor

@ijsnow any more cleanup you want to do here?

@ijsnow
Copy link
Contributor Author

ijsnow commented Jul 9, 2018

Did you run it after your changes? It doesn't work anymore.

@felixfbecker
Copy link
Contributor

No, I thought my changes were noops. Do you know which specific change?

@ijsnow
Copy link
Contributor Author

ijsnow commented Jul 10, 2018

@felixfbecker

So there are two bugs in this PR, one was caused by your changes to my changes, the other was caused by my original PR it seems.

  1. 0699bf8 these weren't unused. Without the position being there, the jump will get overwritten if you click on a token on a line that isn't selected. There is probably some underlying problem that should be fixed somewhere but I'm not sure where to look.

Essentially there is some race condition caused by the mouseover and click events along with the jumpTargets observable firing causing the overlay to not be pinned unless jumpTargets also have positions.

  1. Going directly to a link with a valid token position doesn't open the tooltip anymore. This one was caused by my PR, not your changes.

@felixfbecker
Copy link
Contributor

0699bf8 these weren't unused. Without the position being there, the jump will get overwritten if you click on a token on a line that isn't selected.

That's weird cause it wasn't part of jumpTargets before (and is still not part of the type):

https://sourcegraph.sgdev.org/github.com/sourcegraph/codeintellify@c374679b17dad859a9544784c6ce5cfea7d9213a/-/blob/src/hoverifier.ts#L328

@ijsnow
Copy link
Contributor Author

ijsnow commented Jul 10, 2018

I believe it's because the event operator just emits the positions of events and doesn't do any kind of custom filtering. That's how I think it should be. It's possible that we lost some filtering along the way. If you run the code, you'll see the bug I'm talking about and if you add those back in, you'll see that the problem is fixed.

// TODO locateTarget is purely needed here to get `hoveredToken.part` for diffs
// We should define a function that takes care of _only_ figuring out the `part`
// so we don't have to use locateTarget
const hoveredToken = locateTarget(target, codeElement, false)
Copy link
Contributor

Choose a reason for hiding this comment

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

@ijsnow FYI

@felixfbecker felixfbecker merged commit f6547cc into master Jul 11, 2018
@felixfbecker felixfbecker deleted the external-positions branch July 11, 2018 18:05
@sourcegraph-bot
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createHoverifier should accept positions

4 participants