Repository navigation
Tornadify: gutter icon, toolbar button and new name for the AI transformation - #84
Merged
Merged
Conversation
A gutter icon on each method that AI-assisted transformation can turn into a TornadoVM kernel starts it on click. It is shown only while the transformation is enabled, in modules with the TornadoVM API, and on convertible methods with a loop; the checks run in the slow line-marker pass, in the background. It can be hidden under Gutter Icons. The editor menu item gets the same icon, and the gutter is refreshed when the transformation is switched on or off in Settings.
The editor menu item is "Tornadify..." with "Transform into TornadoVM Kernel (AI)" as its description, and Alt+Enter and the gutter icon say "Tornadify: Transform into TornadoVM Kernel (AI)". The preview dialog and progress texts are unchanged.
A Tornadify button with the brain icon, after the dynamic inspection buttons, transforms the method at the caret of the selected editor. The tool window has the focus when it is clicked, so the editor comes from the selected TextEditor when the data context has none. It is disabled, with the reason in its tooltip, while the transformation is off, there is no editor, the caret is not in a convertible method, or the module lacks the TornadoVM API.
…to use it While the caret is in a method it can transform, the button's tooltip is "Tornadify <method>", so it is clear that it acts on that method alone. While it is disabled, the tooltip says how to use it: click inside the method, then the button, or right-click the method or click the brain icon in the gutter.
…rnado-api A toolbar button shows the description under the tooltip's title only for actions that implement TooltipDescriptionProvider, so the how-to and the method's description were not shown. With the transformation on and no TornadoVM API in the module, the tooltip says to add the tornado-api dependency to the pom.xml, wherever the caret is.
The tooltips of the Tornadify button in the TornadoVM tool window are shorter and friendlier. While AI-assisted transformation is off, the tooltip has an Open settings link to its settings page.
…ice, own loops only - The Tornadify button commits the editor's document before it looks for the method at the caret, so it never transforms the wrong method after typing. While the document is not committed, its tooltip names no method and no PSI is read. - Without tornado-api, the button gives the same advice as the editor menu, for the JDK of the module (ConversionLauncher.missingApiMessage now takes any element of the module, such as the file), without assuming Maven. - The gutter icon counts only loops of the method itself, not those in lambdas or in anonymous or local classes, and is not shown on main.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The AI-assisted transformation is renamed Tornadify, and it is easier to find and start.
1. Brain gutter icon on transformable methods
A brain icon in the gutter of a method starts the transformation of that method. The icon is shown only when:
The checks resolve types and read the index, so they run in the line-marker daemon's background pass, not on the EDT. Users can hide the icon under Settings | Editor | General | Gutter Icons. Turning the transformation on or off in its settings restarts highlighting, so the icons appear or disappear at once.
2. The action is called "Tornadify"
tornado-apiit reads Tornadify (needs tornado-api).The preview dialog and progress texts are unchanged.
3. Tornadify button in the TornadoVM tool window
The tool window toolbar has a Tornadify button with the brain icon, right after Run and Debug (dynamic inspection). It transforms the method at the caret of the selected editor. The tool window has the focus when the button is clicked, so the editor comes from the selected
TextEditorwhen the data context has none.The tooltip says what the button will do, or why it can't:
<method>, so it is clear it acts on that method alone;tornado-api, the tooltip gives the Maven dependency to add, for JDK 21 and for JDK 22+.Testing
./gradlew test: all 329 tests pass. New tests cover the gutter marker (shown only on methods with a loop, hidden while the transformation is off or without the TornadoVM API, icon variants) and the toolbar button (its place after Run and Debug, enabled with the method's name for the selected editor's caret, and each disabled reason).This PR is independent of #83 (rewriting the calls to a transformed method); the two merge without conflicts.