Eye-tracking mapping in JetBrains diff view: limitations & possible approaches #11
TTangNingzhi
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR
We’re exploring whether CodeGRITS can support eye-tracking mapping in JetBrains’ diff view (e.g., pull request reviews). In normal editors, we use
Editor
APIs likexyToLogicalPosition
to map gaze points to code tokens. In diff editors,getSelectedTextEditor()
returnsnull
, and the availableFileEditor
interface lacks these APIs. We’re looking for workarounds or API access methods to enable diff view mapping — ideas and contributions welcome.Context
Several CodeGRITS users have asked whether it’s possible to perform eye-tracking mapping in a diff view (e.g., when reviewing pull requests). The goal is to map gaze positions to code tokens in a
git diff
style editor, similar to how CodeGRITS handles normal source editors.However, our investigation shows that the current JetBrains diff editor API imposes limitations that make this non-trivial.
Current Findings
1. Standard editor approach fails in diff view
In
EyeTracker.java
, we retrieve the current editor with:This returns a
com.intellij.openapi.editor.Editor
instance, which provides the APIs we need for mapping XY coordinates to tokens — for example:xyToLogicalPosition
However, in a diff editor, this method returns
null
.2. Available alternative is too limited
For the diff editor, the only available method is:
This returns a
com.intellij.openapi.fileEditor.FileEditor
instance, which is much more limited. It does not expose key APIs likexyToLogicalPosition
that are essential for gaze-to-token mapping.Example log output when retrieving a diff editor:
3. Possible next steps
FileEditor
toEditor
for diff panes.xyToLogicalPosition
for diff editors.Editor
object.Why this matters
Supporting diff view mapping would enable eye-tracking studies during code review sessions, opening up a broader set of research scenarios beyond regular source editing.
Call for input
If anyone in the community has:
Editor
-level methods from a diff view,please share your insights here. Contributions and PRs are welcome!
Beta Was this translation helpful? Give feedback.
All reactions