Skip to content

Conversation

@supersaiyansubtlety
Copy link
Member

@supersaiyansubtlety supersaiyansubtlety commented Sep 28, 2025

Adds #140

based on #304 rebased


Notes:

  • There's one weird issue I don't know what to make of: selecting javadoc text breaks the text rendering. They're just JTextAreas. I've tried using JEditorPanels instead, and I've tried disabling the drag-to-move feature; neither helped.
  • There's one TODO that will require a followup PR (Use dispel magic + a little polish #317): declaration snippets should include the original source's line numbers; requires line number offset implementation in syntaxpain.
  • This does not use JToolTip or ToolTipManager because I couldn't get a custom JToolTip to properly move+resize when the mouse moved to a new token. Instead it uses a custom JWindow for the tooltip and several Timers to manage it.
  • The tooltip size is limited to half the screen width/height. All tooltip content except the parent label is in a scroll pane which fills available space. If there's not enough room for everything, the scroll pane gets automatically scrolled to the bottom so the declaration snippet is in view. Unfortunately this means the top portion of javadocs are scrolled off the top. Ideally the javadocs and the snippet would have separate scroll panes (the snippet already has one from BaseEditorPanel), but I couldn't get two scroll panes to resize smartly in limited space (at least in a GridBagLayout, used to expand to fill width).

Improvements to RecordGetterFindingVisitor:

  • renames it RecordIndexingVisitor
  • adds map of record classes to component fields
  • adds map of record classes to component getters
  • makes its results accessible
  • fixes a bug preventing it from finding inner records' getters because it used getName() instead of getFullName()

Also makes navigating to a record component getter declaration with no explicit declaration navigate to its field instead.


The tooltip:

The tooltip shows the parent, javadocs, and declaration snippet of the entry under the cursor.

enigma-entry-tooltip

Clicking the parent label or tokens within the declaration snippet updates the tooltip with that entry's info; control-clicking navigates to the entry. Control-clicking a top-level class' package navigates to that package. The tooltip may be moved by dragging from anywhere that doesn't have other click functionality.

Tooltips and their interact-ability can each be disabled; configs are in a new editor.toml file. This moves #304's persistent config to editor.toml.

editor.toml:
# Whether editors' quick find toolbars should remain visible when they lose focus.
# default: true
persistent_quick_find = true

# The settings for the editor's entry tooltip.
[entry_tooltip]
	# Whether tooltips are enabled.
	# default: true
	enable = true
	# Whether tooltips can be clicked and interacted with to navigate their content.
	# default: true
	interactable = true

Tasks:

  • obtain entry under cursor
  • account for entry type
  • account for entry source (current class/other class)
  • show declaration of entry in source
  • de-indent trimmed declaration source
  • add javadoc if present
  • add entry parent name
  • make tooltips disablable
  • make tooltips optionally clickable
  • allow clicking entries inside tooltip to update the tooltip with that entry
  • polish
  • merge upstream once Quick find tool bar #304 is merged (both mess with EditorPanel)
  • merge upstream once Fix navigation to method calls within lambdas and static initializers #308 is merged (both add javaparser and LineIndexer)

add "bread crumbs" back button to go back to previous tooltip contents not tooltip-y

@supersaiyansubtlety
Copy link
Member Author

ready once #304 and #308 are merged

Comment on lines +93 to +105
this.clazz = null;
this.recordComponents.clear();
this.fields.clear();
this.methods.clear();
Copy link
Member Author

Choose a reason for hiding this comment

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

please double-check that moving the clearing here and clearing fields+methods won't break anything

Comment on lines +219 to +222
// Put all main content in one big scroll pane.
// Ideally there'd be separate javadoc and snippet scroll panes, but multiple scroll pane children
// of a grid bag parent don't play nice when space is limited.
// The snippet has its own scroll pane, but wrapping it in this one effectively disables its resizing.
Copy link
Member Author

Choose a reason for hiding this comment

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

If anyone has ideas on how to improve this, please discuss on discord and make a followup PR.

…rds' getters

make RecordGetterFindingVisitor's getter map accessible
fix DeclarationSnippetPanel for record component getters
expand RecordGetterFindingVisitor to provide maps of record classes to their fields and methods
make EntryTooltip show record field javadocs for record classes
make EntryTooltip show record field javadocs for record getters if they don't have their own javadocs
remove main content scroll pane border
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request user interface affects the enigma ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show javadocs/other information on hover

1 participant