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

Use offsets from .bgv file to select appropriate text #10510

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JaroslavTulach
Copy link
Contributor

@JaroslavTulach JaroslavTulach commented Jan 18, 2025

Enso is trying to generate IGV graph for our internal IR:

We had issues to provide proper nodeSourceLocation information. I had to debug visualizer code to find out what's wrong. While doing that I made few fixes.

  • we were providing -1 as line location - IGV was then doing nothing - with 75d41ee it at least opens the file
  • I was getting NullPointerExceptions so I am adding checks and assert to catch that earlier
  • Last, but not least: we do provide start and end offsets for Enso nodes. Let's use them!

Location used

With these changes IGV picks up start and end offset from location property and is capable to select appropriate source range. CCing @tkrodriguez, @sdedic, @Akirathan

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 18, 2025

private Line findLine(EditorCookie cake, int line) {
try {
return cake.getLineSet().getOriginal(line - 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -63,24 +67,48 @@ private void openOrView(boolean focus) {
return;
}
int line = location.getLine();
int[] offsets = location.getOffsetsOrNull();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Text based languages (like Truffle ones) are likely to fill offsets rather than line numbers. Passing the offsets to the LocationOpener in faba84a and using the offsets rather than line when present. More an experiment for your consideration than bullet proof code right now.

@fniephaus fniephaus requested a review from tkrodriguez January 21, 2025 13:34
@JaroslavTulach JaroslavTulach changed the title More robust visualizer when reading custom .bgv file Use offsets from .bgv file to select appropriate text Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant