-
-
Notifications
You must be signed in to change notification settings - Fork 33
Entry tooltips #307
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
Entry tooltips #307
Conversation
81b370f to
d3bec0e
Compare
aa80cb4 to
d861d51
Compare
enigma/src/main/java/org/quiltmc/enigma/impl/plugin/RecordIndexingVisitor.java
Show resolved
Hide resolved
b4a17b3 to
5f2b17d
Compare
| // 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. |
There was a problem hiding this comment.
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.
… and timers, respectively
…t's the same class (editor bounds were 0x0 when setting source) navigate to tooltip target entry declaration when showing tooltip
stop excluding curly braces from method and class sources
…declaration' message show <init> for constructor simple names
add/remove EntryTooltip's global listeners on open/close reset TooltipManager on key presses
bcbc5aa to
be44d7d
Compare
move FeaturesSection.autoSaveMappings to EditorConfig eliminate FeaturesSection
ix0rai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is amazing! just a couple last nitpicks before we merge
enigma/src/test/java/org/quiltmc/enigma/input/z_tooltip/Constructors.java
Show resolved
Hide resolved
enigma-swing/src/main/java/org/quiltmc/enigma/gui/panel/EntryTooltip.java
Outdated
Show resolved
Hide resolved
enigma-swing/src/main/java/org/quiltmc/enigma/gui/panel/EntryTooltip.java
Outdated
Show resolved
Hide resolved
* add POC tooltip to EditorPanel editor that shows full name of entry under cursor * update tooltip content when mouse moves, but can't get JToolTip to resize+move * replace EditorPanel's use of JToolTip and TooltipManager with JWindow and timers, respectively * check if same token instead of same entry when updating tooltip * replace complex Optional composition with consumer methods * extract BaseEditorPanel without tooltip, navigator, or listeners * display entries' entire outer source class in their tooltips * always set tooltipEditor classhandle instead of setting source when it's the same class (editor bounds were 0x0 when setting source) navigate to tooltip target entry declaration when showing tooltip * add javaparser dep matching #308 * implement source trimming for classes using javaparser * minor improvements * minor cleanup * make trimFactor a param instead of a field * implement source trimming for methods * match declarations only by range and extract findDeclaration * inline variable * implement field source trimming stop excluding curly braces from method and class sources * fix tooltip source trimming for static record fields add "No source available" label when there's no classhandle * update TODOs centralize target name reporting * extract TooltipEditorPanel * trim param tooltip target source to parent method refine error messages * fail early when target declaration token is missing add local source trimming * fix tooltip source trimming for constructors * minor refactor * show record component parent instead of just component; matches param showing parent method * when excluding implements from record component parent, find token instead of assuming offset * close and destroy tooltip when source changes * silently ignore missing declaration tokens (until #252 is fixed) * restore quickFindToolbar to ui stop closing tooltip's class handles as tabs may still need them; remove ClassHandleListener instead rename TooltipEditorPanel -> DeclarationSnippetPanel extract EditorTooltip add test input for easier manual tooltip testing * restore EditorPanel popupMenu functionality * improve caret pos logic in BaseEditorPanel::setSource * replace source with message if the declaration token could be found * implement source snippet unindenting * replace entry simple name label with formatted parent name label * add 'From: ' prefix to parent label left-align tooltip rows * add javadocs to tooltip * allow disabling tooltip * make tooltip optionally interactable implement dragging to move tooltip * prevent hiding tooltip when cursor is over a token or the tooltip * fix parent label for top-level classes and add missing dot separator for package format labels use GridBagLayout for param javadocs (currently takes up extra space) * allow clicking entries withing tooltip to populate tooltip with that entry's information * fix calculation for offsetting multiline snippet pos to un-trimmed pos allow clicking parent entries in tooltips to populate tooltip when ctrl+clicking entries in tooltips, open entry tab * minor improvements, add TODOs * resolve references when finding tooltip targets * customize tooltip target highlighting * update TODOs regarding records * polish tooltip positioning fix exception when consumeMousePosition... methods where passed a component that wasn't showing fix several cases where the tooltip would hide when it shouldn't or hiden't when it should * increase padding at outer edges of tooltip rows add tooltip border * use a JPanel with a GridBagLayout instead of a Box as the content pane for EditorTooltip; allows elements to expand to fill their space double-pack in EditorTooltip's declarationSnippet source set listener to eliminate extra space, because swing </3 * reject some TODOs * ctrl+click on parent package label to naviage to package * fix tooltip separators improve "No source available" message formatting * respect tooltip ineractable config for parent package clicking add z_ prefix to tooltip test input to avoid changing SearchMappingsTest * use global focus listener to ensure tooltip is closed when neither it nor its editor has focus * move consumeMousePosition... methods to GuiUtil * rename EditorTooltip -> EntryTooltip use GridBagConstraintsBuilder in EntryTooltip respect scale config in EntryTooltip * use GridBagConstraintsBuilder in initEditorPane * make tooltip focusable; enables copying tooltip content * fix hiding tooltip immediately after re-populating it simplify tooltip focus and hiding logic * remove tooltip to editor click forward as it didn't work consistently remove unecessary insteractable tooltip click listener * add EntryTooltip.repopulated field for workaround * deobfuscate parent package * focus class selector when navigating to parent package from tooltip * scroll to class selector path when navigating from entry tooltip parent * move Config.persistentEditorQuickFind to EditorConfig.persistentQuickFind * rename config getter methods to match their ids and update Config javadoc * fix another tooltip focus issue * fix bug preventing RecordGetterFindingVisitor from finding inner records' getters make RecordGetterFindingVisitor's getter map accessible fix DeclarationSnippetPanel for record component getters * rename RecordGetterFindingVisitor -> RecordIndexingVisitor 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 * clear things in visitEnd instead of visit clear fields and methods * fix for java 17 * tighten RecordIndexingVisitor encapsulation * make navigating to a record component getter with no explicit declaration navigate to its field instead * add nullable annotation * only set BaseEditorPanel.editor text once * fix typo * tweak moveMaintainingAnchor * close entry tooltip on key press * close tooltip on KEY_TYPED instead of KEY_PRESSED so ctrl+c can copy * add javaparser to lib list in README * cleanup createSnippet * fix swapped un/bounded names * make LineIndexer::getIndex return -1 for out-of-bounds positions, add LineIndexerTest * rename EditorTooltipSection -> EntryTooltipSection * limit EntryTooltip size * put main tooltip content in a scroll pane * focus snippet editor ui on source set remove main content scroll pane border * checkstyle * replace AtomicInteger gridY's with primitive ints * hard cap tooltip width at 600px (scaled) * expand parent package path when navigating from tooltip * explicitly check if source is bounded when setting 'Unable to locate declaration' message show <init> for constructor simple names * improve constructor name check * use 'inherited from' label for tooltip labels for entries that resolved to a parent * dispatch key events that close the entry tooltip to the previously focused component * close entry tooltip with global mouse listener * add gui for entry tooltip config * deduplicate check box sync logic * javadoc createSyncedCheckBox * javadoc syncStateWithConfig override * move tooltip management to EnitorPanel.TooltipManager add/remove EntryTooltip's global listeners on open/close reset TooltipManager on key presses * minor refactor * make 'tooltips' consistently plural in user-facing strings * dispatch KEY_PRESSED events that close entry tooltips (with exception for ctrl+c) * rework moveMaintainingAnchor when tooltip shrunk * move FeaturesSection.enableClassTreeStatIcons to StatsSection move FeaturesSection.autoSaveMappings to EditorConfig eliminate FeaturesSection * ensure RecordIndexingVisitor is cleared in visitEnd * make several tooltip string translatable * make a snippet string translatable
Adds #140
based on #304rebasedNotes:
JTextAreas. I've tried usingJEditorPanels instead, and I've tried disabling the drag-to-move feature; neither helped.JToolTiporToolTipManagerbecause I couldn't get a customJToolTipto properly move+resize when the mouse moved to a new token. Instead it uses a customJWindowfor the tooltip and severalTimers to manage it.BaseEditorPanel), but I couldn't get two scroll panes to resize smartly in limited space (at least in aGridBagLayout, used to expand to fill width).Improvements to
RecordGetterFindingVisitor:RecordIndexingVisitorgetName()instead ofgetFullName()Also:
FeaturesSectionby movingenableClassTreeStatIconstoStatsSectionandautoSaveMappingstoEditorConfigThe tooltip:
The tooltip shows the parent, javadocs, and declaration snippet of the entry under the cursor.
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.
Config
Tooltips and their interact-ability can each be disabled; configs are in a new
editor.tomlfile. This moves #304's persistent config toeditor.toml.editor.toml:Tasks:
EditorPanel)LineIndexer)add "bread crumbs" back button to go back to previous tooltip contentsnot tooltip-y