You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 like xyToLogicalPosition to map gaze points to code tokens. In diff editors, getSelectedTextEditor() returns null, and the available FileEditor 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:
source.getSelectedTextEditor()
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:
source.getSelectedEditor()
This returns a com.intellij.openapi.fileEditor.FileEditor instance, which is much more limited. It does not expose key APIs like xyToLogicalPosition that are essential for gaze-to-token mapping.
Investigate the internal implementation of the JetBrains diff editor.
Look for any exposed APIs or adapters that bridge FileEditor to Editor for diff panes.
Identify if there’s an equivalent to xyToLogicalPosition for diff editors.
Explore whether each diff pane (left/right) can be accessed individually as an 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:
Experience working with the JetBrains diff editor APIs, or
Found a workaround to access Editor-level methods from a diff view,
please share your insights here. Contributions and PRs are welcome!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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
EditorAPIs likexyToLogicalPositionto map gaze points to code tokens. In diff editors,getSelectedTextEditor()returnsnull, and the availableFileEditorinterface 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 diffstyle 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.Editorinstance, which provides the APIs we need for mapping XY coordinates to tokens — for example:xyToLogicalPositionHowever, 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.FileEditorinstance, which is much more limited. It does not expose key APIs likexyToLogicalPositionthat are essential for gaze-to-token mapping.Example log output when retrieving a diff editor:
3. Possible next steps
FileEditortoEditorfor diff panes.xyToLogicalPositionfor diff editors.Editorobject.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!
BetaWas this translation helpful?Give feedback.
All reactions