Skip to content

Allow highlighting instructions in ClassFileEditor#2708

Merged
trancexpress merged 1 commit intoeclipse-jdt:masterfrom
danthe1st:class-file-editor-selection
Apr 7, 2026
Merged

Allow highlighting instructions in ClassFileEditor#2708
trancexpress merged 1 commit intoeclipse-jdt:masterfrom
danthe1st:class-file-editor-selection

Conversation

@danthe1st
Copy link
Copy Markdown
Contributor

@danthe1st danthe1st commented Dec 22, 2025

What it does

This PR allows selecting/highlighting instructions in the class file editor using:

  • method name
  • method signature
  • code index (position in the method which is displayed at the beginning of a class file)

This is used to view the current instruction pointer when debugging class files without attached sources (the debugging part is implemented in eclipse-jdt/eclipse.jdt.debug#831.

image image

video:

Screencast_20260402_144851.webm

Ideally, this would be done without needing to "parse"/search through the disassembly text but I don't think there is a good way to do that

How to test

See eclipse-jdt/eclipse.jdt.debug#831

Author checklist

@iloveeclipse
Copy link
Copy Markdown
Member

Screenshot?

@danthe1st
Copy link
Copy Markdown
Contributor Author

danthe1st commented Dec 22, 2025

Screenshot?

I plan to add one but I currently have issues with my development setup after rebasing it.

@danthe1st
Copy link
Copy Markdown
Contributor Author

Screenshot?

Added.

@danthe1st danthe1st force-pushed the class-file-editor-selection branch 6 times, most recently from 8a8c2b6 to a9a1346 Compare January 10, 2026 15:21
@danthe1st danthe1st marked this pull request as ready for review January 10, 2026 15:30
@SougandhS SougandhS force-pushed the class-file-editor-selection branch from a9a1346 to 3916a18 Compare January 12, 2026 03:34
@danthe1st danthe1st force-pushed the class-file-editor-selection branch from 3916a18 to 3a392f4 Compare February 28, 2026 13:07
@eclipse-jdt-bot
Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

org.eclipse.jdt.ui/META-INF/MANIFEST.MF
org.eclipse.jdt.ui/pom.xml

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 7fdb94e31eb87cf1ef0f8b90aca655993cbaa494 Mon Sep 17 00:00:00 2001
From: Eclipse JDT Bot <jdt-bot@eclipse.org>
Date: Sat, 28 Feb 2026 13:11:39 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/org.eclipse.jdt.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.ui/META-INF/MANIFEST.MF
index 2d6f4e8ff1..2b3c023d46 100644
--- a/org.eclipse.jdt.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.ui
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.ui; singleton:=true
-Bundle-Version: 3.37.0.qualifier
+Bundle-Version: 3.37.100.qualifier
 Bundle-Activator: org.eclipse.jdt.internal.ui.JavaPlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
diff --git a/org.eclipse.jdt.ui/pom.xml b/org.eclipse.jdt.ui/pom.xml
index 59b583dcf7..2ac6bd499d 100644
--- a/org.eclipse.jdt.ui/pom.xml
+++ b/org.eclipse.jdt.ui/pom.xml
@@ -18,7 +18,7 @@
   </parent>
   <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.ui</artifactId>
-  <version>3.37.0-SNAPSHOT</version>
+  <version>3.37.100-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
 	<build>
-- 
2.53.0

Further information are available in Common Build Issues - Missing version increments.

@SougandhS SougandhS added the enhancement New feature or request label Feb 28, 2026
@danthe1st danthe1st force-pushed the class-file-editor-selection branch from 91c83df to fe024b9 Compare March 8, 2026 10:49
@danthe1st
Copy link
Copy Markdown
Contributor Author

(push is just rebasing)

@iloveeclipse Would you like to review this?

@danthe1st danthe1st force-pushed the class-file-editor-selection branch from fe024b9 to fa5d0af Compare March 16, 2026 19:26
@danthe1st
Copy link
Copy Markdown
Contributor Author

danthe1st commented Mar 16, 2026

Alternatively, would you be interested in reviewing this/share your thoughts? @jjohnstn
If you have a better idea than parsing the class file output (that wouldn't make the PR much more complicated), I'll happily take a look at that as well.

@danthe1st danthe1st force-pushed the class-file-editor-selection branch from fa5d0af to c3aabfc Compare April 2, 2026 07:44
@danthe1st
Copy link
Copy Markdown
Contributor Author

Sorry to ping random committers but I didn't get a review until now and I think something along the lines of this could be useful for anyone wanting to view what is going on in some library where the source could not be resolved.

@trancexpress

@trancexpress
Copy link
Copy Markdown
Contributor

I'll try to take a look on Sunday, I hope that isn't too late?

Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Outdated
Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Outdated
Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Outdated
@danthe1st danthe1st force-pushed the class-file-editor-selection branch 2 times, most recently from 9d1384a to 6fb6fa3 Compare April 2, 2026 17:46
Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Outdated
Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Outdated
@danthe1st danthe1st force-pushed the class-file-editor-selection branch 2 times, most recently from 322cef3 to adfe332 Compare April 3, 2026 12:00
@trancexpress trancexpress force-pushed the class-file-editor-selection branch from adfe332 to b9a9b57 Compare April 5, 2026 04:08
Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Outdated
@trancexpress
Copy link
Copy Markdown
Contributor

trancexpress commented Apr 5, 2026

Just two small things from me, I'll let Copilot also do a review here.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support in the JDT ClassFileEditor (no-source/disassembly view) to programmatically highlight a specific bytecode instruction by method + signature + code index, enabling external tooling (e.g., debugging) to show the current instruction pointer when source isn’t available.

Changes:

  • Added instruction highlighting/unhighlighting API to ClassFileEditor, including lightweight parsing/caching of disassembly text to locate instructions.
  • Introduced a new internal preference key constant intended to source the instruction-pointer highlight color.
  • Added JUnit tests for highlighting behavior and wired them into the automated test suite.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Adds highlight/unhighlight logic, disassembly parsing + caching, and preference-based color initialization.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IUIConstants.java Adds a constant for the instruction-pointer color preference key.
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/editor/ClassFileEditorTests.java New tests validating instruction highlighting behavior in the disassembly widget.
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/AutomatedSuite.java Includes the new test class in the automated suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java Outdated
Comment thread org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IUIConstants.java Outdated
@danthe1st danthe1st force-pushed the class-file-editor-selection branch from 960b2fd to 0152036 Compare April 7, 2026 05:31
@trancexpress trancexpress merged commit ddca7a0 into eclipse-jdt:master Apr 7, 2026
13 checks passed
@danthe1st danthe1st deleted the class-file-editor-selection branch April 7, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants