Skip to content

Revamp the Script Editor - #81

Merged
ctrueden merged 41 commits into
mainfrom
modernize
Nov 17, 2026
Merged

ctrueden merged 41 commits into
mainfrom
modernize

Conversation

@tferr

@tferr tferr commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

This is a major face lift! with dozens of improvements:

New:

  • Side pane now hosts Bookmarks, Tasks, and Scratchpad
  • New light and dark themes (named Scijava using IntelliJ settings). The light/dark version is picked up on the L&F
  • New look

Improved:

  • Improve command palette with fuzzy matching
  • Improved drag-and-drop (file choosers, Editor area, and file pane)
  • File explorer no longer crashes the editor when an OME-ZARR/N5 is being listed. A new "fast-mode" kicks in if searches take longer than 1s (e.g., when listing cloud locations)
  • Uses latest RSyntaxTextArea (requires Java 21)
  • Better logging when killing scripts
  • Better Tab <> Spaces indentation actions
  • Opening XML, YAML, JSON, Markdown files now works without any 'txt' extension being appended

Fixed:

  • several bugs in the highlighting of errored lines
  • Closing the Save / Discard / Cancel prompt no longer discards the file(!)
  • Template scripts are no longer opened as modified
  • Layout issues

Here are some screenshots
ScreenShot 2026-11-16 at 24 08 43 
ScreenShot 2026-11-16 at 24 07 30 
ScreenShot 2026-11-16 at 24 07 01 
ScreenShot 2026-11-16 at 24 06 08 
ScreenShot 2026-11-16 at 24 02 38 
ScreenShot 2026-11-16 at 24 01 35 

NB:

  • The Command Palette (Cmd/Ctrl + Shift + P, and new icon on the far right of the menu) Lists known shortcuts too, so it should be easier to access/discover actions and commands
  • @ctrueden your new Vim mode now logs to the status bar; RSyntaxTextArea v4 had API changes, so this won't work with v3.X nor with Java 8; scijava-ui-swing is now a dependency: There is now an option to run the command that changes the L&F

(cc'ing @ctrueden, @gselzer , @hinerm as you guys worked recently in the editor.)

See the individual commits for more details. The last few commits are code audits by Claude, and IntelliJ auditing tool.
I think with this, we are pretty much at the limit of what can be done with FlatLaf and RSyntaxTextArea. The editor now looks like a mini IntelliJ prompt. And I think all my grievances with the Editor will be finally gone :)

tferr and others added 30 commits November 14, 2026 12:02
- Searching an hierarchy with an n5/Zarr folder no longer halts the EDT
- Fast mode option: Only act on listed paths, not their children
- Fast mode automatically activates if search slower than 1 sec
- Option to toggle live updates
- Improve drag and drop
- Improve layout with FlatLaft
- Add icons to file list
- Do not allow palette to outlive the TextEditor closure
- Layout/border adjustments
- Fix landscape mode toggle failing when window too narrow
- Only touch leading whitespace
- Respect a selection, or apply to whole file if none exists
- Ask for confirmation
- Checks for a locked file
- Report how many lines changed
- Some of our gutter customizations/hacks are no longer needed
- Use the new RowListener to monitor bookmarks
- It seems MatlabTokenMaker now needs declared bracket pairs
- Our themes can now use fold indicator background
- Our hacks for non-executable syntax (markdown, etc.) are no longer needed
  are now all handled by FileTypeUtil
- Fix a bug: Files whose extension has no SciJava language (data.json, notes.md)
  were being renamed to .txt without reason
- Trade-off:
  A "New_" tab w/ "None" language can no longer be given a syntax by hand.  T
  The workaround is to savein or naming (e.g. x.json): it will trigger the new fallback
- Fix: After every full-script run wrong lines were highlighted the wrong lines due to offset accumulation
- Fix Parser leak. ew ErrorStripNotifyingParser were added without removing the previous one
- Fix inverted logic in gotoPreviousError
- Fix: Highlights being re-added on every reparse
- Improve fragile parsing: we now walk the exception chain instead of scraping text
- Improve persistence of errors after editing text
- Reset all errors flagged by a previous run before each run
- Drop support for scala and R: The handbaked hacks are just too fragile
- Add proper test
- Activate REPL on display
- Color code Tasks in Error Strip
- Simplify help menu items with help buttons to Notes Panel
- Remove code duplication
- Apply blended scroll tracks to all side panels
- Add basic actions to scratchpad context menu
- Fix bookmark markers icon alignment
- Improve main tab layout
- Remember active tab in side panel across restarts
- Remove outdate menu items
Loading:
- Set the modified state more reliably when loading templates from JARs
- setFileName(File): detect the language without renaming the file

Saving:
- Add the proposed name as pre-selection in the JFileChooser
- Refresh the tab title after saving (before the outdated asterisk marker would remain)
- Closing  the Save / Discard / Cancel prompt no longer discards the file(!)
- Fix inverted logic in the GuiUtils.confirm prompt
hread.stop() throws UnsupportedOperationException since JDK 20, so
killing a script logged a stack trace per thread and only interrupted
(when anything at all). Now:

- Interrupt all threads of the executer (deduplicated), then try stop()
  only on threads still alive, giving up on the first
  UnsupportedOperationException
- After a 1s grace period, report threads that are still running
  (script name included, wrapper thread labeled "runner") in the error
  screen and in the status bar, with a new error icon
- Refresh the Kill menu and window title after obliterate(), since the
  wrapper thread's finally block may never run if it survives
- showTemporaryStatus() accepts an optional icon, and always clears the
  icon of a previous message

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- newTab(): resolve the language by extension (a leading dot is
  optional) instead of passing the extension to getLanguageByName(),
  which never matched. An unknown extension is now ignored instead of
  setting a null language. Also return null if open() fails
- newTab(): compare the last language pref with equals(), not !=
- Run selected code: return right after the "Selection required!"
  error instead of continuing with a null text
- Command history cropping: use Files.move(REPLACE_EXISTING) instead of
  File.renameTo(), which fails silently on some platforms, and use
  StandardCharsets.UTF_8
- Javadoc URL for core classes: use Runtime.version().feature(). The
  java.version parsing threw on versions without dots (e.g., "21")

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tferr and others added 3 commits November 15, 2026 23:32
- Debounce layout saving (300 ms) and window title updates (200 ms).
  Resize and divider drags fired a pref write per event, and every
  keystroke refreshed the title. The pending layout save is flushed on
  window closing, while the tabs still exist
- Stop checking for outside file changes on every edit. It still runs
  on window focus and on tab switch
- FileSystemTree: coalesce bursts of watcher events into one refresh
  per folder
- NotesPanel: run the refresh poll only while the panel is displayable
  (start in addNotify, stop in removeNotify) instead of forever
- TextEditorTab.destroy(): null-safe, and detach the listener that
  mirrors the shared error console into the combined console. It now
  runs for every closed tab, not just the current one at window close
- TextEditor.dispose(): stop the timers and remove the editor and its
  context from the static instances and contexts lists
- EditorPane.syncLanguageWithFileName(): on tab switches, only change
  the language if it differs from the one implied by the file name
- File filter: apply regular expressions with find() instead of adding
  anchors, which broke alternations such as "py|txt"

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tferr
tferr requested a review from ctrueden November 16, 2026 05:37
Discovered when testing the new layout on windows 11:

- Fix Vim mode not remembered across restarts
- Ensure menu items remain in sync with their status bar shortcuts
- Fix layout of hamburger button when tabs are placed left/right
- Rotate hamburger button when tab position rotates :)
- By default place tabs of side panel on the left
- Enable occurrences by default: it cost nothing until the word is double clicked on and it is super useful
- Make sure REPL is never displayed below 1 line height on toggle
- Fix glitch when flipping tabs top/bottom -> left/right

While at it:
- Remove unused private methods
- Store default width of side panel in a constant for consistenty
@tferr

tferr commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

Update: I was able to test this on windows 11, macOS, and briefly on Ubuntu. So I consider this done. I fixed a couple of minor issues (mainly glitches) along the way. Also:

  • I moved the tabs to the left, as that seem somehow to work best, but that is likely a personal preference. We could have it so that tab positioning becomes a persistent preference
  • I also enabled 'Mark occurrences' by default, as I suspect nobody would otherwise notice it exists: it highlights all the occurrences of a word you double-click on, which is useful to track function calls
  • While this was fresh, I went through the list of issues that were open and was able to tackle a hand full!

I am now going to mentally move on to other projects, but do let me know if you find something off. For those testing it, you likely want to run `Window > Reset Layout' at least once as I'm not sure older preferences can get in the way

tferr and others added 3 commits November 16, 2026 10:44
…window

Swing is messy. It seems it redistributes the space among the split pane’s components on every resize,
Because we assign min widths, those get enforced during layout in constant flickering
This fixes it: The new pane remember which side was collapsed just before a resize. After the layout happens it puts the divider back without flickering.
The newest RSyntaxTextArea 4.0.1 still targets Java 11 as minimum,
so we can stick with Java 11 here as well for the time being.

Of course, it makes some of the code more verbose or uglier, but not
radically so, and I prefer to follow the principle of maintaining the
oldest reasonable minimum on a per-component basis to avoid cascading
higher minimums to all downstream dependents.

Incidentally, this should also fix the CI build, because the
workflow was still set to build with Java 11 rather than 21.

Assisted-by: Claude Code (Opus 5.5)
@ctrueden

Copy link
Copy Markdown
Member

@tferr Wow, thank you so much! I'm testing it today. My only reservation thus far is the bump to Java 21, because com.fifesoft:rsyntaxtextarea:4.0.1 (newest release) still does target Java 11 as minimum:

JAR Java Version Max Bytecode Class Count
rsyntaxtextarea-4.0.1.jar 11 55 364
autocomplete-3.3.2.jar 8 52 89
languagesupport-3.3.0.jar 8 52 457
flatlaf-3.8.jar 8 52 369
gson-2.14.0.jar 8 52 216
error_prone_annotations-2.41.0.jar 8 52 29
miglayout-core-5.3.jar 8 52 28
miglayout-swing-5.3.jar 8 52 6
commons-io-2.20.0.jar 8 52 372
jfreechart-1.5.6.jar 8 52 686
jfreesvg-3.4.4.jar 8 52 19
rhino-1.7.14.jar 8 52 539
batch-processor-0.4.2.jar 8 52 11
minimaven-2.2.3.jar 8 52 17
scijava-common-2.100.1.jar 8 52 750
scijava-optional-1.0.2.jar 8 52 5
scijava-plot-0.2.0.jar 8 52 36
scijava-search-3.0.1.jar 8 52 46
scijava-table-1.0.3.jar 8 52 61
scijava-ui-awt-0.1.7.jar 8 52 36
scijava-ui-swing-1.0.3.jar 8 52 150
scripting-java-1.0.1.jar 8 52 6
swing-checkbox-tree-1.0.2.jar 8 52 5
classgraph-4.8.181.jar 7 51 266
prettytime-4.0.1.Final.jar 6 50 74
object-inspector-0.1.jar 5 49 23
jdatepicker-1.3.2.jar 5 49 22

The main code bloat for sticking with Java 11 is due to the lack of record classes.

But of course you already saw the commit about this, because you then pushed the subsequent javadoc fix; thanks for that!

@tferr

tferr commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

Yeah, sorry about the extra load for reverting the java 21 syntax. Agree. Not needed. Thanks for looking. I also got some feedback/suggestions:

  • Run timer or Time stamp acknowledging when the run is over (currently there is only a time stamp at start)
  • Zen mode ((!) Do folks really need to be in the zone when scripting Fiji!? :) )
  • Export console output (for bug reporting)
    I'm not sure I'll have time to look into these though... If not, I will probably just create an issue and it can be tackled later on

Assisted-by: Claude Code (Opus 5.5)
@ctrueden
ctrueden merged commit df0d173 into main Nov 17, 2026
1 check passed
@ctrueden
ctrueden deleted the modernize branch November 17, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants